Create a reusable agent configuration that stores the model, instructions, tools, and multi-agent settings.
Endpoint
POST /agents
Returns 201 and the complete agent object. Creation only saves the configuration. It does not start a session, model, or MCP server. Submitting the same request body again creates a new resource.
Request body
| Field | Required | Type | Description |
|---|---|---|---|
model | Yes | string | Model ID. It must match a model available in the current workspace; otherwise the API returns 404 model_not_found. For available models, see Available models. |
name | No | string / null | Display name, up to 128 characters. |
instructions | No | string / null | Custom instructions appended to the agent's default instructions, up to 1,048,576 characters. |
metadata | No | object / null | Metadata, string key-value pairs. Recommended limits are 16 items, key up to 64 characters, and value up to 512 characters. All values must be strings. |
reasoning | No | object / null | Reasoning settings, containing the following fields. |
reasoning.effort | No | string / null | Reasoning effort: none, minimal, low, medium, high, xhigh, or max. |
reasoning.summary | No | string / null | Reasoning summary: concise, detailed, or auto. |
text | No | object / null | Text output settings, containing the following fields. |
text.format.type | Conditional | string | Output format type, fixed as text. |
text.verbosity | No | string / null | Output verbosity, low, medium, or high. Session execution currently accepts only medium. |
tools | No | array / null | Tool configuration. Each tool must provide a type. The current supported types are function, mcp, and web_search. Creation only saves the configuration; it does not mean the tool can execute. |
tools[].function.name | Yes | string | Function name |
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 |
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 | Subagent configuration, containing the following fields. |
multi_agent.enabled | Yes | boolean | Whether subagent tools are enabled; required when the parent object is present. |
multi_agent.max_concurrent_subagents | No | integer / null | Concurrent subagent limit. Execution currently supports 1..32, default 6. |
Request example
Response example
Response fields
| 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, saved string key-value pairs. |
model | string | Saved 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 | Saved custom instructions. |
tools | array / null | Saved 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 |
Available models
model supports the following models:
| Brand | Model ID | Capabilities |
|---|---|---|
| Qwen | qwen4-max | Reasoning, visual understanding, text generation |
| Qwen | qwen3.8-max | Reasoning, visual understanding, text generation |
| Qwen | qwen3.7-max | Reasoning, text generation |
| Qwen | qwen3.7-plus | Reasoning, visual understanding, text generation |
| Qwen | qwen3.6-plus | Reasoning, visual understanding, text generation |
| DeepSeek | deepseek-v4-pro | Reasoning, text generation |
| Zhipu AI | glm-5.3 | Reasoning, text generation |
| Zhipu AI | glm-5.2 | Reasoning, text generation |
| Moonshot AI | kimi-k3 | Reasoning, visual understanding, text generation |
The model list is continuously updated. The dropdown list shown when creating an agent in the console is authoritative.
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 | Provide model as described, fix field types and enums, satisfy tool cross-field constraints, and send valid JSON |
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 |
500 | server_error / server_error | Retry later. If it keeps failing, submit a ticket with x-request-id |