次の方法で共有


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_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.

create_version

Create a new agent version.

create_version(agent_name: str, *, definition: _models.AgentDefinition, foundry_features: Literal[FoundryFeaturesOptInKeys.CONTAINER_AGENTS_V1_PREVIEW] | Literal[FoundryFeaturesOptInKeys.HOSTED_AGENTS_V1_PREVIEW] | Literal[FoundryFeaturesOptInKeys.WORKFLOW_AGENTS_V1_PREVIEW] | None = None, content_type: str = 'application/json', metadata: dict[str, str] | None = None, description: str | None = None, **kwargs: Any) -> _models.AgentVersionDetails

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 0x00000217BE16B1C0>
foundry_features
str or <xref:azure.ai.projects.models.CONTAINER_AGENTS_V1_PREVIEW> or str or <xref:azure.ai.projects.models.HOSTED_AGENTS_V1_PREVIEW> or str or <xref:azure.ai.projects.models.WORKFLOW_AGENTS_V1_PREVIEW>

A feature flag opt-in required when using preview operations or modifying persisted preview resources. Is one of the following types: Literal[FoundryFeaturesOptInKeys.CONTAINER_AGENTS_V1_PREVIEW], Literal[FoundryFeaturesOptInKeys.HOSTED_AGENTS_V1_PREVIEW], Literal[FoundryFeaturesOptInKeys.WORKFLOW_AGENTS_V1_PREVIEW] Default value is None.

Default value: None
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

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, *, 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.AgentVersionDetails

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 0x00000217BE16B1C0>
parameter_values

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

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

AgentVersionDetails. The AgentVersionDetails 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) -> AgentDetails

Parameters

Name Description
agent_name
Required
str

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
str

The name of the agent to retrieve. Required.

agent_version
Required
str

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", "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

Sort order by the created_at timestamp of the objects. asc for ascending order anddesc for descending order. Known values are: "asc" and "desc". 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 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
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

Sort order by the created_at timestamp of the objects. asc for ascending order anddesc for descending order. Known values are: "asc" and "desc". 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 AgentVersionDetails

Exceptions

Type Description