Enabling and disabling agents¶
Activation methods enable or disable an agent on its remote platform. Their effect depends on the provider and agent type.
Danger
Disabling an agent can permanently delete it from its remote platform.
For the following agent types, start_disable() and start_disable_agents() perform a deletion:
Snowflake Cortex agents: the agent is permanently deleted.
Vertex Agent Engine agents: the reasoning engine is deleted, including child resources such as sessions.
Amazon Bedrock AgentCore Harnesses: the Harness is deleted, and its backing Runtimes are blocked for all versions.
For these agent types, passing allow_destructive=True means that you explicitly accept permanent, irreversible deletion. Agent Management cannot undo this deletion.
start_enable() and start_enable_agents() cannot restore these deleted agents.
You must recreate them on their platform if you need them again.
Cancelling an operation does not restore agents that have already been deleted.
The server rejects these destructive operations by default. For a selection, allow_destructive=True authorizes permanent deletion of every selected agent whose disabling requires deletion.
In the following examples, client is an AgentManagementClient created as described in The main AgentManagementClient class.
Reading the last known activation state¶
agent = client.get_agent("production", "support-agent")
print(agent.get_status().platform_activation_state)
The value is UNKNOWN, ENABLED, or DISABLED and represents the last known state on the provider.
Disabling an agent¶
operation = agent.start_disable()
result = operation.wait_for_result()
print(result)
With the default allow_destructive=False, this example is rejected if disabling the agent would permanently delete it.
See Asynchronous operations to track progress, read operation logs, and inspect failures.
Enabling an agent¶
Enabling is available only for agent types that support both disabling and enabling.
result = agent.start_enable().wait_for_result()
See Asynchronous operations to inspect the enabling operation’s status and logs.
Enabling or disabling a selection¶
Use an explicit filter to select agents on one platform. The server validates the whole selection before starting the operation.
from dataikuapi import AgentFilter
platform = client.get_platform("production")
selection = AgentFilter().with_agent_ids("support-agent", "sales-agent")
result = platform.start_disable_agents(selection).wait_for_result()
# When the provider supports enabling these agents again:
result = platform.start_enable_agents(selection).wait_for_result()
The platform restricts the filter to its own agents. Without allow_destructive=True, a selection containing an agent that requires destructive disabling is rejected as a whole.
For operation status, history, and cancellation, see Asynchronous operations.
Reference documentation¶
Classes¶
Agent filter accepted by search, metric retrieval and bulk action methods. |
Functions¶
|
Returns a handle to an agent. |
|
Returns a handle to an Agent Management platform. |
Returns status information about this agent. |
|
|
Starts disabling this agent on its remote platform. |
|
Starts disabling the agents matching a filter on their remote platform. |
Starts enabling this agent on its remote platform. |
|
|
Starts enabling the agents matching a filter on their remote platform. |
Waits for this operation to complete successfully and returns its result. |
|
|
