Update an agent configuration; omitted top-level fields keep their values, and supplied objects or arrays replace the whole field.
Endpoint
POST /agents/{agent_id}
Returns 200 and the complete updated Agent object. Update uses top-level replacement: omitted fields keep their current values, supplied objects or arrays replace the whole field, and null clears nullable fields. Update is not a recursive JSON Merge Patch; metadata:{"a":"new"} removes old keys that are not in the new object.
model can be omitted, but an explicit null returns 400. On conflict, the service rereads and merges the latest value, up to 3 attempts, then returns 500. No public version or ETag conditional-update field is provided. {} does not change business fields and does not guarantee that updated_at changes.
Request body
| Field | Required | Type | Description |
|---|---|---|---|
model | No | string | Model ID, omitted keeps the current value; explicit null returns 400; after a change the model must be available in the current workspace, or the API returns 404 model_not_found. For available models, see Available models for creating an agent. |
name | No | string / null | Display name, up to 128 characters; null clears it |
instructions | No | string / null | Custom instructions, up to 1,048,576 characters; null clears them |
metadata | No | object / null | Metadata, string key-value pairs; replaced as a whole, null clears, {} replaces with an empty object |
reasoning | No | object / null | Reasoning configuration, replaced as a whole; null clears. |
reasoning.effort | No | string / null | Reasoning effort: none, minimal, low, medium, high, xhigh, max |
reasoning.summary | No | string / null | Reasoning summary: concise, detailed, auto |
text | No | object / null | Text configuration, replaced as a whole; null clears. Only fixed text output is supported |
tools | No | array / null | Tool list, replaced as a whole; null clears, [] replaces with an empty list. |
tools[].function.name | Yes | string | Function name, must be unique within the agent |
tools[].function.description | Yes | string / null | Function description, can be null |
tools[].function.parameters | Yes | object | Function input JSON Schema; must declare type: object |
tools[].mcp.server_label | Yes | string | MCP server label, must be unique within the agent |
tools[].mcp.transport | Yes | object | Transport configuration; see the branches below |
tools[].mcp.allowed_tools | No | array<string> / null | Allowed tool names; null means no filter |
tools[].mcp.required | No | boolean | Whether MCP initialization must succeed |
tools[].mcp.connection_origin | No | string / null | Connection origin, service or environment, defaults to service |
tools[].mcp.transport.type | Yes | string | Transport type, http or stdio |
tools[].mcp.transport.server_url | Conditional | string / null | MCP server URL |
tools[].mcp.transport.headers | No | object<string,string> / null | Additional HTTP headers; do not put secrets here |
tools[].mcp.transport.command | Conditional | string | Command to start the server |
tools[].mcp.transport.cwd | Conditional | string | Working directory; must be an absolute path whose segments are not . or .. |
tools[].mcp.transport.args | No | array<string> / null | Command arguments |
tools[].web_search.type | Yes | string | Tool type, fixed as web_search |
multi_agent | No | object / null | Multi-agent configuration, replaced as a whole; null clears, default concurrency is not filled in |
type. The current supported types are function, mcp, and web_search. Update only saves the configuration; it does not mean the tool can execute.
Unknown top-level fields do not produce an error and may be filtered out and recorded; do not assume a field is applied just because the request succeeds.
Update validates the patch before looking up the resource. If the patch is invalid and the resource does not exist at the same time, the API can return 400 first.
Request example
Response example
Response fields
Returns the complete updated agent object. Optional fields that were never set can be null.
| Field | Type | Description |
|---|---|---|
id | string | Agent ID. Treat it as an opaque string |
object | string | Agent object type, fixed as agent |
created_at | integer | Creation time as a Unix timestamp in seconds |
updated_at | integer | Last modification time as a Unix timestamp in seconds; not a version number |
name | string / null | Display name |
metadata | object / null | Metadata, stored string key-value pairs |
model | string | Stored model ID |
reasoning | object / null | Reasoning configuration. Either subfield can be null. |
reasoning.effort | string / null | Reasoning effort: none, minimal, low, medium, high, xhigh, max |
reasoning.summary | string / null | Reasoning summary: concise, detailed, auto |
text | object / null | Text output configuration. |
text.format | object | Output format. |
text.format.type | string / null | Output format type, fixed as text |
text.verbosity | string / null | Output verbosity, low, medium, high |
instructions | string / null | Stored custom instructions |
tools | array / null | Stored tool configuration; each branch returns only its own fields |
tools[].function | object | Function tool configuration; returns name, description, and parameters |
tools[].mcp | object | MCP tool configuration; returns server_label, transport, allowed_tools, required, and connection_origin; transport is http or stdio |
tools[].web_search | object | Web search tool configuration; returns type and the saved configuration |
multi_agent | object / null | Subagent configuration. |
multi_agent.enabled | boolean | Whether subagent tools are enabled |
multi_agent.max_concurrent_subagents | integer / null | Maximum number of concurrent subagents; no default is applied |
Error codes
Business errors return an error object with type, code, message, and param. Common errors:
| HTTP status | Error type / code | Solution |
|---|---|---|
400 | invalid_request_error / invalid_request_error | Fix field types, enums, lengths, and cross-field constraints as described; omit model instead of sending null |
400 | invalid_request_error / string_above_max_length | Shorten instructions to 1,048,576 characters or fewer |
401 | authentication_error / invalid_api_key | Send a valid Authorization: Bearer $DASHSCOPE_API_KEY header |
404 | invalid_request_error / model_not_found | Use a model ID that is available in the current workspace |
404 | not_found_error / not_found_error | Use an agent ID that exists and has not been deleted in the current workspace |
500 | server_error / server_error | Retry later. If it keeps failing, submit a ticket with x-request-id |