Discovering agents

A platform scan discovers agents on a connected provider and refreshes their discovered metadata. This is distinct from fetching execution logs or running uptime tests.

In the following examples, client is an AgentManagementClient created as described in The main AgentManagementClient class.

Running a scan

Scanning is asynchronous. Wait for the returned operation before listing the resulting inventory. See Asynchronous operations for monitoring progress, reading logs, and requesting cancellation.

platform = client.get_platform("production")
operation = platform.start_scan()
scan_result = operation.wait_for_result()
print(scan_result)

for item in platform.list_agents():
    print(item.id, item.display_name, item.state)

Use this on a platform that supports scanning. OpenTelemetry receiver platforms use manual agent creation and do not support scans.

For detailed scan diagnostics, open the platform’s Logs page. See Accessing logs for log access and required privileges.

Narrowing scan

Platform settings determine which resources a scan discovers. To update them, call platform.get_settings(), modify the settings.raw dictionary, then call settings.save(). You need platform administration permissions to make these changes. The updated settings apply to subsequent manual and scheduled scans.

The available restrictions depend on the platform type. A scan can only access resources allowed by the credentials in its connection. The examples below use existing platforms; replace their IDs and resource names with your own.

Dataiku

A Dataiku platform supports the following restrictions:

  • selectProjectsToScan=True enables selection by the project keys in projectKeysToScan.

  • selectProjectTagsToScan=True enables selection by the project tags in projectTagsToScan. A project matches if it has any selected tag.

  • When both selectors are enabled, the scan includes projects matching either the selected keys or the selected tags. If neither selector is enabled, it includes all readable projects. Enabling selection with no keys or tags selects no projects.

  • ignoreExternalAgent=True excludes external agents.

  • agentHubMyAgentPolicy controls Agent Hub My Agents: KEEP_ALL includes all of them, REMOVE_DRAFT_ONLY excludes drafts (the default), and REMOVE_ALL excludes all My Agents.

platform = client.get_platform("production")
settings = platform.get_settings()
settings.raw["selectProjectsToScan"] = True
settings.raw["projectKeysToScan"] = ["SUPPORT", "SALES"]
settings.raw["selectProjectTagsToScan"] = True
settings.raw["projectTagsToScan"] = ["production"]
settings.raw["ignoreExternalAgent"] = True
settings.raw["agentHubMyAgentPolicy"] = "REMOVE_DRAFT_ONLY"
settings.save()

scan_result = platform.start_scan().wait_for_result()

The connection must use a personal or global API key on the remote Dataiku instance. Project selection determines which agents the scan discovers. The scan may still read their dependencies or log datasets from other projects. See Asynchronous operations to follow the scan’s progress and inspect failures.

Microsoft Foundry

For an AzureFoundry platform, subscriptionsToScan selects Azure subscriptions and, within each subscription, resource groups. Each entry contains a subscriptionId and a list of resourceGroupNames.

An empty subscriptionsToScan list includes all accessible subscriptions. An empty resourceGroupNames list includes all resource groups in that subscription.

platform = client.get_platform("foundry-production")
settings = platform.get_settings()
settings.raw["subscriptionsToScan"] = [
    {
        "subscriptionId": "00000000-0000-0000-0000-000000000001",
        "resourceGroupNames": ["support-agents", "sales-agents"],
    },
    {
        "subscriptionId": "00000000-0000-0000-0000-000000000002",
        "resourceGroupNames": [],
    },
]
settings.save()

Snowflake

For a Snowflake platform, databasesToScan selects databases and schemas. Each entry contains a databaseName and a list of schemaNames. Names must match the identifiers returned by Snowflake, including their case.

An empty databasesToScan list includes all accessible databases. An empty schemaNames list includes all accessible schemas in that database.

platform = client.get_platform("snowflake-production")
settings = platform.get_settings()
settings.raw["databasesToScan"] = [
    {"databaseName": "PRODUCTION", "schemaNames": ["SUPPORT", "SALES"]},
    {"databaseName": "ANALYTICS", "schemaNames": []},
]
settings.save()

Google Cloud

A Vertex platform uses region to select one Google Cloud region. This field is required. projectIds selects individual projects, and organizationIds includes projects discovered in the selected organizations.

When both lists contain values, the scan includes both the selected projects and the projects found in the selected organizations. When both lists are empty, Agent Management discovers accessible projects and organizations automatically. The scan uses the configured region for all selected projects.

platform = client.get_platform("vertex-production")
settings = platform.get_settings()
settings.raw["region"] = "europe-west1"
settings.raw["projectIds"] = ["support-production", "sales-production"]
settings.raw["organizationIds"] = ["123456789012"]
settings.save()

Amazon Bedrock

A Bedrock platform scans the AWS account and region configured by its connection. classicAgentsDiscoveryEnabled controls whether classic Bedrock agents are included, in addition to AgentCore resources. It defaults to True; set it to False to discover only AgentCore resources.

platform = client.get_platform("bedrock-production")
settings = platform.get_settings()
settings.raw["classicAgentsDiscoveryEnabled"] = False
settings.save()

Other platforms

The following platform types have no additional scan-selection fields in their platform settings:

Platform type

Discovery scope

Agentforce

Agents accessible in the Salesforce organization configured by the connection.

Databricks

Agents accessible in the Databricks workspace configured by the connection.

MicrosoftCopilotStudio

Bots accessible in the Dataverse environment configured by the connection.

N8N

Workflows with an active version on the n8n instance configured by the connection.

OpenTelemetryReceiver

No platform scan. Agents are added manually; see Managing agents.

Use Searching and filtering agents to filter the inventory after discovery.

Scheduling scans

settings = platform.get_settings()
settings.raw["periodicInfraScanEnabled"] = True
settings.raw["periodicInfraScanScheduleMode"] = "MINUTES"
settings.raw["periodicInfraScanFrequencyMinutes"] = 60
settings.save()

Scheduled scans appear in the operation history described in Asynchronous operations.

Finding agents missing from the latest scan

Use discovery status to distinguish an agent that is no longer found on its provider from its management state in Agent Management.

from dataikuapi import AgentFilter

missing = platform.list_agents(
    agent_filter=AgentFilter().with_discovery_statuses(
        AgentFilter.DISCOVERY_NOT_FOUND
    )
)
for item in missing:
    print(item.id, item.display_name)

To filter on managed, ignored, or archived agents, see Searching and filtering agents.

Reference documentation

Classes

dataikuapi.agentmanagement.agent.AgentFilter()

Agent filter accepted by search, metric retrieval and bulk action methods.

dataikuapi.agentmanagement.operations.Operation(...)

An Agent Management asynchronous operation.

Functions

get_platform(platform_id)

Returns a handle to an Agent Management platform.

get_settings()

Returns the settings of this platform.

list_agents([as_type, agent_filter])

Lists agents on this platform.

save()

Saves the settings of this platform, using fetchedRevision to detect concurrent changes.

start_scan()

Starts an platform scan.

wait_for_result()

Waits for this operation to complete successfully and returns its result.

with_discovery_statuses(*discovery_statuses)