Update Agent

Updated at:

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

POST/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_idstringRequired

Agent ID, format agent_<ULID>

Request body

versionintRequired

Current version number, used for optimistic locking. Returns 409 Conflict if it does not match the server-side value

namestringRequired

Agent name; omitted fields are treated as cleared

modelobjectRequired

Model configuration, structure {"id": "qwen3.7-max"}, required sub-field id

model properties

idstring

Model ID, e.g. qwen3.7-max

enable_thinkingboolean

Whether to enable thinking mode

max_tokensinteger

Maximum generation length

temperaturenumber

Temperature that controls randomness

thinking_budgetinteger

Thinking budget length

descriptionstringOptional

Agent purpose description; omitted fields are treated as cleared

systemstringOptional

System prompt; omitted fields are treated as cleared

toolsarray<object>Optional

Toolkit list, same as create; omitted fields are treated as cleared. builtin_toolkit at most one, mcp_toolkit can be multiple

tools properties

typestring

builtin_toolkit or mcp_toolkit

default_configobject

Default tool config with enabled and permission_policy

configsarray<object>

Per-tool config that overrides default_config; supports params

mcp_server_namestring

Required for MCP tools

mcp_serversarray<object>Optional

MCP Server reference list, same as create; omitted fields are treated as cleared

mcp_servers properties

typestring

official or customer

namestring

MCP server name

skillsarray<object>Optional

Mounted skill list, same as create; omitted fields are treated as cleared

skills properties

typestring

official or customer

skill_idstring

Skill ID

versionstring

Must be a concrete version number

multiagentobjectOptional

Multi-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

typestring

Currently only coordinator

agentsarray<object>

Fleet entries (1-20); each contains type, id, and version

metadataobjectOptional

Custom 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

idstring

Agent ID

typestring

Always agent

versionint

New version number (auto-incremented); sessions bound to a previous version are not affected

namestring

Agent name

descriptionstring

Description

systemstring

System prompt

modelobject

Model configuration, including id and other model parameters

model properties

idstring

Model ID, e.g. qwen3.7-max

enable_thinkingboolean

Whether to enable thinking mode

max_tokensinteger

Maximum generation length

temperaturenumber

Temperature that controls randomness

thinking_budgetinteger

Thinking budget length

toolsarray<object>

Toolkit list, grouped by type

tools properties

typestring

builtin_toolkit or mcp_toolkit

default_configobject

Default tool config with enabled and permission_policy

configsarray<object>

Per-tool config that overrides default_config; supports params

mcp_server_namestring

Required for MCP tools

mcp_serversarray<object>

MCP server reference list

mcp_servers properties

typestring

official or customer

namestring

MCP server name

skillsarray<object>

Mounted skill list

skills properties

typestring

official or customer

skill_idstring

Skill ID

versionstring

Must be a concrete version number

multiagentobject

Multi-agent configuration

multiagent properties

typestring

Currently only coordinator

agentsarray<object>

Fleet entries (1-20); each contains type, id, and version

metadataobject

Custom business key-value pairs that do not affect model behavior.

archived_atstring | null

Archive timestamp; null if not archived

created_atstring

Creation time

updated_atstring

Last update time

workspace_idstring

Workspace ID

request_idstring

Unique 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"
}