Share via


AgentsOperations Class

Warning

DO NOT instantiate this class directly.

Instead, you should access the following operations through

AIProjectClient's

<xref:agents> attribute.

Constructor

AgentsOperations(*args, **kwargs)

Methods

create

Creates the agent.

create_from_manifest

Creates an agent from a manifest.

create_version

Create a new agent version.

create_version_from_manifest

Create a new agent version from a manifest.

delete

Deletes an agent.

delete_version

Deletes a specific version of an agent.

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.

update

Updates the agent by adding a new version if there are any changes to the agent definition. If no changes, returns the existing agent version.

update_from_manifest

Updates the agent from a manifest by adding a new version if there are any changes to the agent definition. If no changes, returns the existing agent version.

create

Creates the agent.

create(*, name: str, definition: _models.AgentDefinition, content_type: str = 'application/json', metadata: dict[str, str] | None = None, description: str | None = None, **kwargs: Any) -> _models.AgentObject

Parameters

Name Description
body
<xref:JSON> or IO[bytes]

Is either a JSON type or a IO[bytes] type. Required.

Keyword-Only Parameters

Name Description
name
str

The unique name that identifies the agent. Name can be used to retrieve/update/delete the agent.

  • Must start and end with alphanumeric characters,

  • Can contain hyphens in the middle

  • Must not exceed 63 characters. Required.

Default value: <object object at 0x0000027FE672F260>
definition

The agent definition. This can be a workflow, hosted agent, or a simple agent definition. Required.

Default value: <object object at 0x0000027FE672F260>
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
str

A human-readable description of the agent. Default value is None.

Default value: None

Returns

Type Description

AgentObject. The AgentObject is compatible with MutableMapping

Exceptions

Type Description

create_from_manifest

Creates an agent from a manifest.

create_from_manifest(*, name: str, manifest_id: str, parameter_values: dict[str, Any], content_type: str = 'application/json', metadata: dict[str, str] | None = None, description: str | None = None, **kwargs: Any) -> _models.AgentObject

Parameters

Name Description
body
<xref:JSON> or IO[bytes]

Is either a JSON type or a IO[bytes] type. Required.

Keyword-Only Parameters

Name Description
name
str

The unique name that identifies the agent. Name can be used to retrieve/update/delete the agent.

  • Must start and end with alphanumeric characters,

  • Can contain hyphens in the middle

  • Must not exceed 63 characters. Required.

Default value: <object object at 0x0000027FE672F260>
manifest_id
str

The manifest ID to import the agent version from. Required.

Default value: <object object at 0x0000027FE672F260>
parameter_values

The inputs to the manifest that will result in a fully materialized Agent. Required.

Default value: <object object at 0x0000027FE672F260>
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
str

A human-readable description of the agent. Default value is None.

Default value: None

Returns

Type Description

AgentObject. The AgentObject is compatible with MutableMapping

Exceptions

Type Description

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, **kwargs: Any) -> _models.AgentVersionObject

Parameters

Name Description
agent_name
Required
str

The unique name that identifies the agent. Name can be used to retrieve/update/delete the agent.

  • Must start and end with alphanumeric characters,

  • Can contain hyphens in the middle

  • Must not exceed 63 characters. Required.

body
<xref:JSON> or IO[bytes]

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 0x0000027FE672F260>
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
str

A human-readable description of the agent. Default value is None.

Default value: None

Returns

Type Description

AgentVersionObject. The AgentVersionObject 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, *, manifest_id: str, parameter_values: dict[str, Any], content_type: str = 'application/json', metadata: dict[str, str] | None = None, description: str | None = None, **kwargs: Any) -> _models.AgentVersionObject

Parameters

Name Description
agent_name
Required
str

The unique name that identifies the agent. Name can be used to retrieve/update/delete the agent.

  • Must start and end with alphanumeric characters,

  • Can contain hyphens in the middle

  • Must not exceed 63 characters. Required.

body
<xref:JSON> or IO[bytes]

Is either a JSON type or a IO[bytes] type. Required.

Keyword-Only Parameters

Name Description
manifest_id
str

The manifest ID to import the agent version from. Required.

Default value: <object object at 0x0000027FE672F260>
parameter_values

The inputs to the manifest that will result in a fully materialized Agent. Required.

Default value: <object object at 0x0000027FE672F260>
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
str

A human-readable description of the agent. Default value is None.

Default value: None

Returns

Type Description

AgentVersionObject. The AgentVersionObject is compatible with MutableMapping

Exceptions

Type Description

delete

Deletes an agent.

delete(agent_name: str, **kwargs: Any) -> DeleteAgentResponse

Parameters

Name Description
agent_name
Required
str

The name of the agent to delete. Required.

Returns

Type Description

DeleteAgentResponse. The DeleteAgentResponse is compatible with MutableMapping

Exceptions

Type Description

delete_version

Deletes a specific version of an agent.

delete_version(agent_name: str, agent_version: str, **kwargs: Any) -> DeleteAgentVersionResponse

Parameters

Name Description
agent_name
Required
str

The name of the agent to delete. Required.

agent_version
Required
str

The version of the agent to delete. Required.

Returns

Type Description

DeleteAgentVersionResponse. The DeleteAgentVersionResponse is compatible with MutableMapping

Exceptions

Type Description

get

Retrieves the agent.

get(agent_name: str, **kwargs: Any) -> AgentObject

Parameters

Name Description
agent_name
Required
str

The name of the agent to retrieve. Required.

Returns

Type Description

AgentObject. The AgentObject 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) -> AgentVersionObject

Parameters

Name Description
agent_name
Required
str

The name of the agent to retrieve. Required.

agent_version
Required
str

The version of the agent to retrieve. Required.

Returns

Type Description

AgentVersionObject. The AgentVersionObject 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: Literal['asc', 'desc'] | None = None, before: str | None = None, **kwargs: Any) -> ItemPaged[AgentObject]

Keyword-Only Parameters

Name Description
kind

Filter agents by kind. If not provided, all agents are returned. Known values are: "prompt", "hosted", "container_app", and "workflow". Default value is None.

Default value: None
limit
int

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
str or str

Sort order by the created_at timestamp of the objects. asc for ascending order anddesc for descending order. Is either a Literal["asc"] type or a Literal["desc"] type. Default value is None.

Default value: None
before
str

A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. Default value is None.

Default value: None

Returns

Type Description

An iterator like instance of AgentObject

Exceptions

Type Description

list_versions

Returns the list of versions of an agent.

list_versions(agent_name: str, *, limit: int | None = None, order: Literal['asc', 'desc'] | None = None, before: str | None = None, **kwargs: Any) -> ItemPaged[AgentVersionObject]

Parameters

Name Description
agent_name
Required
str

The name of the agent to retrieve versions for. Required.

Keyword-Only Parameters

Name Description
limit
int

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
str or str

Sort order by the created_at timestamp of the objects. asc for ascending order anddesc for descending order. Is either a Literal["asc"] type or a Literal["desc"] type. Default value is None.

Default value: None
before
str

A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. Default value is None.

Default value: None

Returns

Type Description

An iterator like instance of AgentVersionObject

Exceptions

Type Description

update

Updates the agent by adding a new version if there are any changes to the agent definition. If no changes, returns the existing agent version.

update(agent_name: str, *, definition: _models.AgentDefinition, content_type: str = 'application/json', metadata: dict[str, str] | None = None, description: str | None = None, **kwargs: Any) -> _models.AgentObject

Parameters

Name Description
agent_name
Required
str

The name of the agent to retrieve. Required.

body
<xref:JSON> or IO[bytes]

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 0x0000027FE672F260>
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
str

A human-readable description of the agent. Default value is None.

Default value: None

Returns

Type Description

AgentObject. The AgentObject is compatible with MutableMapping

Exceptions

Type Description

update_from_manifest

Updates the agent from a manifest by adding a new version if there are any changes to the agent definition. If no changes, returns the existing agent version.

update_from_manifest(agent_name: str, *, manifest_id: str, parameter_values: dict[str, Any], content_type: str = 'application/json', metadata: dict[str, str] | None = None, description: str | None = None, **kwargs: Any) -> _models.AgentObject

Parameters

Name Description
agent_name
Required
str

The name of the agent to update. Required.

body
<xref:JSON> or IO[bytes]

Is either a JSON type or a IO[bytes] type. Required.

Keyword-Only Parameters

Name Description
manifest_id
str

The manifest ID to import the agent version from. Required.

Default value: <object object at 0x0000027FE672F260>
parameter_values

The inputs to the manifest that will result in a fully materialized Agent. Required.

Default value: <object object at 0x0000027FE672F260>
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
str

A human-readable description of the agent. Default value is None.

Default value: None

Returns

Type Description

AgentObject. The AgentObject is compatible with MutableMapping

Exceptions

Type Description