Update Agent
Uses full replacement semantics: the request body must include version along with the complete agent configuration. Omitted fields are treated as cleared. On success, version is auto-incremented.
Prerequisites
Endpoint and authentication configured. For details, see Overview and authentication.
Endpoint
/agents/{agent_id}Semantics
Uses full replacement: the request body must include version (current version number, used for optimistic locking) along with the complete name, model, system, tools, and other fields. Omitted fields are treated as cleared. If version does not match the server-side value, a 409 Conflict is returned. On success, the version in the response is auto-incremented; sessions bound to a previous version are not affected.
Path parameters
agent_idstringRequiredAgent ID, format agent_<ULID>
Request body
versionintRequiredCurrent version number, used for optimistic locking. Returns 409 Conflict if it does not match the server-side value
namestringRequiredAgent name; omitted fields are treated as cleared
modelobjectRequiredModel configuration, structure {"id": "qwen3.7-max"}, required sub-field id
model properties
idstringModel ID, e.g. qwen3.7-max
enable_thinkingbooleanWhether to enable thinking mode
max_tokensintegerMaximum generation length
temperaturenumberTemperature that controls randomness
thinking_budgetintegerThinking budget length
descriptionstringOptionalAgent purpose description; omitted fields are treated as cleared
systemstringOptionalSystem prompt; omitted fields are treated as cleared
toolsarray<object>OptionalToolkit list, same as create; omitted fields are treated as cleared. builtin_toolkit at most one, mcp_toolkit can be multiple
tools properties
typestringbuiltin_toolkit or mcp_toolkit
default_configobjectDefault tool config with enabled and permission_policy
configsarray<object>Per-tool config that overrides default_config; supports params
mcp_server_namestringRequired for MCP tools
mcp_serversarray<object>OptionalMCP Server reference list, same as create; omitted fields are treated as cleared
mcp_servers properties
typestringofficial or customer
namestringMCP server name
skillsarray<object>OptionalMounted skill list, same as create; omitted fields are treated as cleared
skills properties
typestringofficial or customer
skill_idstringSkill ID
versionstringMust be a concrete version number
multiagentobjectOptionalMulti-agent collaboration configuration. The semantics are the same as create; omission is treated as clearing the configuration. When sending it, include the agents, workflows, and reuse_workflows you want to keep; do not rely on the server to merge nested objects field by field
multiagent properties
typestringCurrently only coordinator
agentsarray<object>Fleet entries (1-20); each contains type, id, and version
metadataobjectOptionalCustom business key-value pairs; omitted fields are treated as cleared
The fields above form the complete request body; omitted fields are treated as cleared.
Request example
curl -X POST "$AGENTSTUDIO_URL/agents/agent_xxx" \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"version": 1,
"name": "data-analyst",
"description": "Data analysis assistant",
"model": {"id": "qwen3.7-max"},
"system": "You are a senior data analyst. Include a confidence level with each conclusion.",
"tools": [],
"mcp_servers": [],
"skills": [],
"multiagent": {
"type": "coordinator",
"agents": [
{"type": "self"},
{"type": "agent", "id": "agent_researcher", "version": 3}
]
},
"metadata": {"team": "data"}
}'
current = client.agents.retrieve("agent_xxx")
agent = client.agents.update(
"agent_xxx",
version=current.version,
name="data-analyst",
model="qwen3.8-max",
description="Data analysis assistant",
system_prompt="You are a senior data analyst. Include a confidence level with each conclusion.",
tools=[],
mcp_servers=[],
skills=[],
metadata={"team": "data"},
)
Agent current = client.agents().retrieve("agent_xxx");
Agent updated = client.agents().update("agent_xxx", AgentUpdateParam.builder()
.version(current.getVersion())
.name("data-analyst")
.model("qwen3.7-max")
.description("Data analysis assistant")
.instructions("You are a senior data analyst. Include a confidence level with each conclusion.")
.metadata(Map.of("team", "data"))
.build());
Dynamic Workflow Configuration Example
When updating an existing agent, multiagent is replaced as a whole. The following example disables inline scripts, keeps published workflow reuse, and clears the formation. Include agents if you want to keep the formation. Replace the example Workflow ID with a real bound ID.
{
"version": 1,
"multiagent": {
"type": "coordinator",
"agents": [],
"workflows": {
"type": "disabled",
"inline_agents": {"type": "disabled"},
"predefined_agents": []
},
"reuse_workflows": {
"type": "enabled",
"workflows": [
{"id": "wf_01M7RMD9PRNVEPY2QKW1MA36TE", "version": 1}
]
}
}
}
Response fields
idstringAgent ID
typestringAlways agent
versionintNew version number (auto-incremented); sessions bound to a previous version are not affected
namestringAgent name
descriptionstringDescription
systemstringSystem prompt
modelobjectModel configuration, including id and other model parameters
model properties
idstringModel ID, e.g. qwen3.7-max
enable_thinkingbooleanWhether to enable thinking mode
max_tokensintegerMaximum generation length
temperaturenumberTemperature that controls randomness
thinking_budgetintegerThinking budget length
toolsarray<object>Toolkit list, grouped by type
tools properties
typestringbuiltin_toolkit or mcp_toolkit
default_configobjectDefault tool config with enabled and permission_policy
configsarray<object>Per-tool config that overrides default_config; supports params
mcp_server_namestringRequired for MCP tools
mcp_serversarray<object>MCP server reference list
mcp_servers properties
typestringofficial or customer
namestringMCP server name
skillsarray<object>Mounted skill list
skills properties
typestringofficial or customer
skill_idstringSkill ID
versionstringMust be a concrete version number
multiagentobjectMulti-agent configuration
multiagent properties
typestringCurrently only coordinator
agentsarray<object>Fleet entries (1-20); each contains type, id, and version
metadataobjectCustom business key-value pairs that do not affect model behavior.
archived_atstring | nullArchive timestamp; null if not archived
created_atstringCreation time
updated_atstringLast update time
workspace_idstringWorkspace ID
request_idstringUnique identifier for this request
Response example
{
"type": "agent",
"id": "agent_xxx",
"name": "data-analyst",
"model": {
"id": "qwen3.8-max",
"temperature": null,
"max_tokens": null,
"enable_thinking": null,
"thinking_budget": null
},
"system": "You are a data analysis expert.",
"description": "Data analysis assistant",
"tools": [],
"mcp_servers": [],
"skills": [],
"multiagent": null,
"metadata": {},
"version": 2,
"created_at": "2026-05-28T16:23:11.456+08:00",
"updated_at": "2026-05-28T16:30:00.000+08:00",
"archived_at": null,
"workspace_id": "ws_xxx",
"request_id": "req_xxx"
}