GetAgent

Updated at:
Copy as MD

Queries agents visible to the current identity by name.

Operation description

  • You can retrieve agents created by yourself, agents visible within the current tenant, and official agents provided by the platform.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

ada:GetAgent

get

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

Name

string

Yes

The name of the agent.

code-review-agent

Request example

{
  "Name": "code-review-agent"
}

Response elements

Element

Type

Description

Example

object

The response result.

AgentId

string

The agent ID.

agent_00000000000000000000000000000001

Name

string

The name of the agent.

code-review-agent

DisplayName

string

The display name of the agent. This field may not be returned if it is not configured.

CR code review agent

Description

string

The description of the agent. This field may not be returned if it is not configured.

Analyzes code changes and generates CR review comments

Model

any

The saved model configuration. This information is returned only for official agents. Object arrays are supported, and historical single objects and strings are compatible. An empty array returns [ ]. Object arrays retain the original order, duplicate names, and object fields.

[{"name":"base","default":true},{"name":"base"},{"name":"base","settings":{"thinking":false,"topK":5}}]

SystemPrompt

string

The system prompt. This field may not be returned if it is not configured.

Please check the correctness, security, and maintainability of the code changes in the CR, and provide review comments based on severity

Tools

any

The list of MCP server and connector name references. For element fields, see the following sections.

[{"mcpServerName":"code-repository-mcp"},{"connectorName":"code-review-data"}]

Skills

any

The list of skill references. For specific fields, see the supplementary description of response parameters.

[{"name":"code-review"}]

KnowledgeBases

any

The list of knowledge base references. The list contains at most one element.

[{"name":"code-review-guidelines"}]

Metadata

any

The display metadata of the agent. For specific fields, see the supplementary description of response parameters.

{"iconUrl":"https://example.com/icons/code-review-agent.png"}

Visibility

string

The visibility scope of the agent. Valid values: user and tenant.

Valid values:

  • user
  • tenant

user

Status

string

The status of the agent. The default status of a newly created agent is draft.

draft

AgentVersion

integer

The current configuration revision number.

2

CreatedAt

integer

The creation time. The value is a UNIX timestamp in milliseconds.

1788332400000

UpdatedAt

integer

The last update time. The value is a UNIX timestamp in milliseconds.

1788332700000

CanModify

boolean

Specifies whether the current identity can modify the agent.

true

CanDelete

boolean

Specifies whether the current identity can delete the agent.

true

Official

boolean

Specifies whether the agent is an official agent provided by the platform.

false

RequestId

string

The request ID. It is used for Tracing Analysis and troubleshooting.

0A1B2C3D-4E5F-6789-ABCD-EF0123456789

Model

NameTypeDescriptionExample
namestringThe model name in the configuration. The original value is returned.base
defaultbooleanThe default model flag. In the same model array, only one element can have default set to true.true
settingsobjectThe model configuration parameters. The original values are returned.{"thinking":false,"topK":5}

Tools (MCP server and connector)

MCP server
NameTypeDescriptionExample
mcpServerNamestringThe name of the MCP server. When a name reference omits items, all public tools are used. Historical explicit kind/items whitelists retain their original values.code-repository-mcp
Connector
NameTypeDescriptionExample
connectorNamestringThe name of the connector.code-review-data

Skills

NameTypeDescriptionExample
namestringThe name of the skill.code-review

KnowledgeBases

NameTypeDescriptionExample
namestringThe name of the knowledge base.code-review-guidelines

Metadata

NameTypeDescriptionExample
iconUrlstringThe HTTP or HTTPS URL of the agent icon.https://example.com/icons/code-review-agent.png

Sample success response

{
  "AgentId": "agent_00000000000000000000000000000001",
  "Name": "code-review-agent",
  "DisplayName": "CR code review agent",
  "Description": "Analyzes code changes and generates CR review comments",
  "Model": [
    {
      "name": "base",
      "default": true
    },
    {
      "name": "base"
    },
    {
      "name": "base",
      "settings": {
        "thinking": false,
        "topK": 5
      }
    }
  ],
  "SystemPrompt": "Please check the correctness, security, and maintainability of the code changes in the CR, and provide review comments based on severity.",
  "Tools": [
    {
      "mcpServerName": "code-repository-mcp"
    },
    {
      "connectorName": "code-review-data"
    }
  ],
  "Skills": [
    {
      "name": "code-review"
    }
  ],
  "KnowledgeBases": [
    {
      "name": "code-review-guidelines"
    }
  ],
  "Metadata": {
    "iconUrl": "https://example.com/icons/code-review-agent.png"
  },
  "Visibility": "user",
  "Status": "draft",
  "AgentVersion": 2,
  "CreatedAt": 1788332400000,
  "UpdatedAt": 1788332700000,
  "CanModify": true,
  "CanDelete": true,
  "Official": false,
  "RequestId": "0A1B2C3D-4E5F-6789-ABCD-EF0123456789"
}

Examples

Success response

JSON format

{
  "AgentId": "agent_00000000000000000000000000000001",
  "Name": "code-review-agent",
  "DisplayName": "Code review agent",
  "Description": "Analyze code changes and generate code review comments",
  "Model": "[{\"name\":\"base\",\"default\":true},{\"name\":\"base\"},{\"name\":\"base\",\"settings\":{\"thinking\":false,\"topK\":5}}]",
  "SystemPrompt": "Check the correctness, security, and maintainability of code changes in the code review, and provide review comments based on severity",
  "Tools": "[{\"mcpServerName\":\"code-repository-mcp\"},{\"connectorName\":\"code-review-data\"}]",
  "Skills": "[{\"name\":\"code-review\"}]",
  "KnowledgeBases": "[{\"name\":\"code-review-guidelines\"}]",
  "Metadata": "{\"iconUrl\":\"https://example.com/icons/code-review-agent.png\"}",
  "Visibility": "user",
  "Status": "draft",
  "AgentVersion": 2,
  "CreatedAt": 1788332400000,
  "UpdatedAt": 1788332700000,
  "CanModify": true,
  "CanDelete": true,
  "Official": false,
  "RequestId": "0A1B2C3D-4E5F-6789-ABCD-EF0123456789"
}

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidParameter The specified parameter is invalid.
401 Unauthenticated Authentication required.
500 InternalError Internal server error.
404 Agent.NotFound The specified Agent does not exist.
404 Agent.VersionNotFound The specified Agent version does not exist.
503 ServiceUnavailable The service is not ready or temporarily unavailable.
504 ServiceTimeout A required service timed out.

See Error CodesError Codes for a complete list.

Release notes

See Release NotesRelease Notes for a complete list.