跳转到主要内容
Agent

创建 Agent

创建一个新的智能体

POST
/api/v1/agentstudio/agents
cURL
curl --request POST \
  --url 'https://dashscope.aliyuncs.com/api/v1/agentstudio/agents' \
  --header 'Authorization: Bearer <YOUR_API_KEY>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "data-analyst",
  "description": "数据分析助手",
  "model": {
    "id": "qwen3-max"
  },
  "system": "你是数据分析专家,使用 pandas 处理 CSV 文件。",
  "tools": [
    {
      "type": "builtin_toolkit",
      "default_config": {
        "enabled": true,
        "permission_policy": {
          "type": "always_allow"
        }
      },
      "configs": [
        {
          "name": "bash",
          "enabled": true,
          "permission_policy": {
            "type": "always_ask"
          }
        },
        {
          "name": "read",
          "enabled": true
        },
        {
          "name": "write",
          "enabled": true
        }
      ]
    }
  ],
  "mcp_servers": [],
  "skills": [
    {
      "type": "customer",
      "skill_id": "skill_xxx",
      "version": "1.0"
    }
  ],
  "multiagent": {
    "type": "coordinator",
    "agents": [
      {
        "type": "self"
      },
      {
        "type": "agent",
        "id": "agent_researcher",
        "version": 3
      }
    ]
  },
  "metadata": {
    "team": "data"
  }
}
'
{
  "id": "agent_xxx",
  "type": "agent",
  "version": 1,
  "name": "data-analyst",
  "description": "数据分析助手",
  "model": {
    "id": "qwen3-max"
  },
  "system": "你是数据分析专家,使用 pandas 处理 CSV 文件。",
  "tools": [],
  "mcp_servers": [],
  "skills": [],
  "multiagent": {
    "type": "coordinator",
    "agents": [
      {
        "type": "self"
      },
      {
        "type": "agent",
        "id": "agent_researcher",
        "version": 3
      }
    ]
  },
  "metadata": {
    "team": "data"
  },
  "created_at": "2026-05-28T16:23:11.456+08:00",
  "updated_at": "2026-05-28T16:23:11.456+08:00",
  "archived_at": null,
  "workspace_id": "ws_xxx",
  "request_id": "req_xxx"
}

鉴权

string
header
必填

DashScope API Key

请求体

application/json
string
必填

智能体名称,用于在控制台与列表中辨识

object
必填

模型配置,id 必填,可选 enable_thinking、temperature、max_tokens、thinking_budget

string

智能体用途说明

string

系统提示词,定义角色与行为约束

object[]

工具包列表,按类型分组。每项含 type(builtin_toolkit | mcp_toolkit)、default_config、configs,MCP 类还需 mcp_server_name。builtin_toolkit 至多一项,mcp_toolkit 可多项

object[]

MCP Server 引用列表,每项含 type(official | customer)与 name

object[]

挂载的技能列表,每项含 type(official | customer)、skill_id 与 version(必须锁定到具体版本号)

object

多智能体协作配置。不传或为空表示单智能体;配置后该智能体作为 coordinator 编排编队成员

object

业务自定义键值,不影响模型行为

响应

200-application/json
string

智能体 ID,格式 agent_<ULID>

string

固定为 agent

integer

当前版本号,每次更新自动递增;会话创建时锁定该值

string

智能体名称

string

智能体用途说明

object

模型配置

string

系统提示词

object[]

工具包列表

object[]

MCP Server 引用列表

object[]

挂载技能列表

object

多智能体协作配置。不传或为空表示单智能体

object

业务自定义键值,不影响模型行为

string | null

归档时间,未归档时为 null

string

创建时间,ISO 8601

string

最近更新时间,ISO 8601

string

所属业务空间 ID

string

本次请求的唯一标识,排查问题时附带