UpdateAgent

Updated at:
Copy as MD

Updates the configuration of an agent.

Operation description

  • Name is used only to locate the agent and cannot be modified after creation.

  • Each agent can be bound to only one knowledge base.

  • Tools is updated according to the rules below. If Skills or KnowledgeBases is not passed, the original value is retained. If a non-empty array is passed, it replaces the original value entirely. If an empty array is passed, the corresponding binding is removed. Other optional fields retain their original values if not passed.

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:UpdateAgent

update

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

Name

string

Yes

The name of the agent to be updated.

code-review-agent

ExpectedVersion

integer

No

The expected current configuration revision number. This parameter is omitted by default. Pass the AgentVersion returned by the most recent GetAgent call when concurrency protection is required.

2

DisplayName

string

No

The new display name. If this parameter is not passed, the original value is retained.

CR Code and Security Review Agent

Description

string

No

The new description. If this parameter is not passed, the original value is retained.

Analyze CR code changes and check for correctness, security, and maintainability

SystemPrompt

string

No

The new system prompt. If this parameter is not passed, the original value is retained.

Check for code defects, security risks, and compatibility issues in the CR, and provide actionable modification suggestions

Tools

any

No

The list of MCP server and connector name references. The same array supports the coexistence of both types of entries. Specify only one type of reference for each entry. For MCP, omitting items indicates all public tools, and historically specified items retain their original values.

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

Skills

any

No

The list of skill references. If this parameter is not passed, the original value is retained. If a non-empty array is passed, it replaces the original value entirely. If [ ] is passed, all bindings are removed.

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

KnowledgeBases

any

No

The list of knowledge base bindings, which can contain at most one element. If this parameter is not passed, the original value is retained. If a non-empty array is passed, it replaces the original value entirely. If [ ] is passed, all bindings are removed.

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

Visibility

string

No

The new visibility scope. Valid values: user and tenant. If this parameter is not passed, the original value is retained.

Valid values:

  • user
  • tenant

tenant

Tools (MCP servers and connectors)

NameTypeDescriptionExample
mcpServerNamestringThe name of the registered MCP server.code-repository-mcp
connectorNamestringThe name of the connector that is visible, not deleted, and available to the current identity.code-review-data

A single Tools array can contain both types of entries at the same time. For a single name entry, specify only one of mcpServerName or connectorName. If the name is empty, does not exist, is invisible, is unavailable, contains unknown fields, or is a duplicate reference, the request fails and partial configurations are not saved.

Skills

NameTypeDescriptionExample
namestringThe name of the skill. The currently available version is used at runtime.code-review

KnowledgeBases

NameTypeDescriptionExample
namestringThe name of the knowledge base that exists and is accessible to the current identity.code-review-guidelines

Update rules for Tools

InputMCP referenceConnector reference
Tools omittedRetainedRetained
Tools=[ ]ClearedCleared
Tools contains only MCPReplaced with the passed MCPCleared
Tools contains only ConnectorClearedReplaced with the passed connector
Tools contains both typesReplaced with the passed MCPReplaced with the passed connector

When passing Tools, you should provide all MCP and connector references that you want to retain. Old references that are not included will be removed.

Request example

{
  "Name": "code-review-agent",
  "DisplayName": "CR Code and Security Review Agent",
  "Description": "Analyze CR code changes and check for correctness, security, and maintainability",
  "SystemPrompt": "Check for code defects, security risks, and compatibility issues in the CR, and provide actionable modification suggestions.",
  "Tools": [
    {
      "mcpServerName": "code-repository-mcp"
    },
    {
      "connectorName": "code-review-data"
    }
  ],
  "Skills": [
    {
      "name": "code-review"
    }
  ],
  "KnowledgeBases": [
    {
      "name": "code-review-guidelines"
    }
  ],
  "Visibility": "tenant"
}

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

UpdatedAt

integer

The time of the most recent update. The value is a UNIX timestamp in milliseconds.

1788332700000

Success

boolean

Indicates whether the agent was successfully updated. A success response always returns true. An error response is returned upon failure.

true

RequestId

string

The request ID, which is used for Tracing Analysis and troubleshooting.

0A1B2C3D-4E5F-6789-ABCD-EF0123456789

Success response example

{
  "AgentId": "agent_00000000000000000000000000000001",
  "Name": "code-review-agent",
  "UpdatedAt": 1788332700000,
  "Success": true,
  "RequestId": "0A1B2C3D-4E5F-6789-ABCD-EF0123456789"
}

Examples

Success response

JSON format

{
  "AgentId": "agent_00000000000000000000000000000001",
  "Name": "code-review-agent",
  "UpdatedAt": 1788332700000,
  "Success": true,
  "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.
403 Agent.Forbidden You are not authorized to operate the specified Agent.
404 Agent.NotFound The specified Agent does not exist.
503 ServiceUnavailable The service is not ready or temporarily unavailable.
504 ServiceTimeout A required service timed out.
504 Agent.OperationResultUnknown The Agent operation result is unknown.
409 Agent.VersionConflict The Agent was modified by another request.
409 Agent.InvalidState The Agent is not in a state that permits this operation.

See Error CodesError Codes for a complete list.

Release notes

See Release NotesRelease Notes for a complete list.