AgentsOperations Class
Warning
DO NOT instantiate this class directly.
Instead, you should access the following operations through
<xref:agents> attribute.
Constructor
AgentsOperations(*args, **kwargs)
Methods
| create_version |
Create a new agent version. |
| create_version_from_manifest |
Create a new agent version from a manifest. |
| delete |
Deletes an agent. For hosted agents, if any version has active sessions, the request is
rejected with HTTP 409 unless |
| delete_version |
Deletes a specific version of an agent. For hosted agents, if the version has active sessions,
the request is rejected with HTTP 409 unless |
| get |
Retrieves the agent. |
| get_version |
Retrieves a specific version of an agent. |
| list |
Returns the list of all agents. |
| list_versions |
Returns the list of versions of an agent. |
create_version
Create a new agent version.
create_version(agent_name: str, *, definition: _models.AgentDefinition, content_type: str = 'application/json', metadata: dict[str, str] | None = None, description: str | None = None, blueprint_reference: _models.AgentBlueprintReference | None = None, **kwargs: Any) -> _models.AgentVersionDetails
Parameters
| Name | Description |
|---|---|
|
agent_name
Required
|
The unique name that identifies the agent. Name can be used to retrieve/update/delete the agent.
|
|
body
|
Is either a JSON type or a IO[bytes] type. Required. |
Keyword-Only Parameters
| Name | Description |
|---|---|
|
definition
|
The agent definition. This can be a workflow, hosted agent, or a simple agent definition. Required. Default value: <object object at 0x0000020BF5381A50>
|
|
metadata
|
Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters. Default value is None. Default value: None
|
|
description
|
A human-readable description of the agent. Default value is None. Default value: None
|
|
blueprint_reference
|
The blueprint reference for the agent. Default value is None. Default value: None
|
Returns
| Type | Description |
|---|---|
|
AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping |
Exceptions
| Type | Description |
|---|---|
create_version_from_manifest
Create a new agent version from a manifest.
create_version_from_manifest(agent_name: str, body: ~collections.abc.MutableMapping[str, ~typing.Any] | ~typing.IO[bytes] = <object object>, *, manifest_id: str = <object object>, parameter_values: dict[str, typing.Any] = <object object>, metadata: dict[str, str] | None = None, description: str | None = None, **kwargs: ~typing.Any) -> AgentVersionDetails
Parameters
| Name | Description |
|---|---|
|
agent_name
Required
|
The unique name that identifies the agent. Name can be used to retrieve/update/delete the agent.
|
|
body
|
Is either a JSON type or a IO[bytes] type. Required. |
Keyword-Only Parameters
| Name | Description |
|---|---|
|
manifest_id
|
The manifest ID to import the agent version from. Required. Default value: <object object at 0x0000020BF5381A50>
|
|
parameter_values
|
The inputs to the manifest that will result in a fully materialized Agent. Required. Default value: <object object at 0x0000020BF5381A50>
|
|
metadata
|
Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters. Default value is None. Default value: None
|
|
description
|
A human-readable description of the agent. Default value is None. Default value: None
|
Returns
| Type | Description |
|---|---|
|
AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping |
Exceptions
| Type | Description |
|---|---|
delete
Deletes an agent. For hosted agents, if any version has active sessions, the request is
rejected with HTTP 409 unless force is set to true. When force is true, all associated
sessions are cascade-deleted along with the agent and its versions.
delete(agent_name: str, *, force: bool | None = None, **kwargs: Any) -> DeleteAgentResponse
Parameters
| Name | Description |
|---|---|
|
agent_name
Required
|
The name of the agent to delete. Required. |
Keyword-Only Parameters
| Name | Description |
|---|---|
|
force
|
For Hosted Agents, if Default value: None
|
Returns
| Type | Description |
|---|---|
|
DeleteAgentResponse. The DeleteAgentResponse is compatible with MutableMapping |
Exceptions
| Type | Description |
|---|---|
delete_version
Deletes a specific version of an agent. For hosted agents, if the version has active sessions,
the request is rejected with HTTP 409 unless force is set to true. When force is true, all
sessions associated with this version are cascade-deleted.
delete_version(agent_name: str, agent_version: str, *, force: bool | None = None, **kwargs: Any) -> DeleteAgentVersionResponse
Parameters
| Name | Description |
|---|---|
|
agent_name
Required
|
The name of the agent to delete. Required. |
|
agent_version
Required
|
The version of the agent to delete. Required. |
Keyword-Only Parameters
| Name | Description |
|---|---|
|
force
|
For Hosted Agents, if Default value: None
|
Returns
| Type | Description |
|---|---|
|
DeleteAgentVersionResponse. The DeleteAgentVersionResponse is compatible with MutableMapping |
Exceptions
| Type | Description |
|---|---|
get
Retrieves the agent.
get(agent_name: str, **kwargs: Any) -> AgentDetails
Parameters
| Name | Description |
|---|---|
|
agent_name
Required
|
The name of the agent to retrieve. Required. |
Returns
| Type | Description |
|---|---|
|
AgentDetails. The AgentDetails is compatible with MutableMapping |
Exceptions
| Type | Description |
|---|---|
get_version
Retrieves a specific version of an agent.
get_version(agent_name: str, agent_version: str, **kwargs: Any) -> AgentVersionDetails
Parameters
| Name | Description |
|---|---|
|
agent_name
Required
|
The name of the agent to retrieve. Required. |
|
agent_version
Required
|
The version of the agent to retrieve. Required. |
Returns
| Type | Description |
|---|---|
|
AgentVersionDetails. The AgentVersionDetails is compatible with MutableMapping |
Exceptions
| Type | Description |
|---|---|
list
Returns the list of all agents.
list(*, kind: str | AgentKind | None = None, limit: int | None = None, order: str | PageOrder | None = None, before: str | None = None, **kwargs: Any) -> ItemPaged[AgentDetails]
Keyword-Only Parameters
| Name | Description |
|---|---|
|
kind
|
Filter agents by kind. If not provided, all agents are returned. Known values are: "prompt", "hosted", "workflow", and "external". Default value is None. Default value: None
|
|
limit
|
A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. Default value is None. Default value: None
|
|
order
|
Sort order by the Default value: None
|
|
before
|
A cursor for use in pagination. Default value: None
|
Returns
| Type | Description |
|---|---|
|
An iterator like instance of AgentDetails |
Exceptions
| Type | Description |
|---|---|
list_versions
Returns the list of versions of an agent.
list_versions(agent_name: str, *, limit: int | None = None, order: str | PageOrder | None = None, before: str | None = None, **kwargs: Any) -> ItemPaged[AgentVersionDetails]
Parameters
| Name | Description |
|---|---|
|
agent_name
Required
|
The name of the agent to retrieve versions for. Required. |
Keyword-Only Parameters
| Name | Description |
|---|---|
|
limit
|
A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. Default value is None. Default value: None
|
|
order
|
Sort order by the Default value: None
|
|
before
|
A cursor for use in pagination. Default value: None
|
Returns
| Type | Description |
|---|---|
|
An iterator like instance of AgentVersionDetails |
Exceptions
| Type | Description |
|---|---|