创建智能体
本接口用于创建智能体(Agent),定义系统提示词、工具、MCP 服务和技能(Skill)。智能体是创建会话的前提。
创建成功后返回智能体对象,其中 id 为智能体标识,version 为版本号,创建时为 1,每次更新加 1。
权限说明
使用 API Key 鉴权调用 API 流程,具体调用流程,请查看认证鉴权。
请求参数
智能体(Agent)名称。
长度:1–256 个字符。
智能体(Agent)的系统提示词。
长度:不超过 100000 个字符。
智能体(Agent)的用途说明。
长度:不超过 2048 个字符。
多选一且必需"只能"符合其中一个
智能体使用的模型,选填。
可以直接传模型 ID 字符串,也可以传对象,两种写法等价。预置模型和自定义模型写法相同。
不传时使用 AUTO 模型。
模型 ID 不存在、未启用或不属于当前企业时返回 400。
不支持 speed、inference_geo,传入时返回 400。
显示子属性
隐藏子属性
模型 ID。预置模型和自定义模型写法相同。
显示子属性
隐藏子属性
模型 ID。
取管理平台「模型管理」中已启用的预置模型或自定义模型的模型 ID,可通过「获取模型列表」接口查询。
思考档位,选填,仅预置模型可用。
不传时按模型默认档位运行;传入该模型不支持的档位返回 400。
自定义模型不支持思考档位,传入时返回 400。
可选值与客户端的思考档位保持一致。
工具配置列表。
所有工具集合计最多 256 个工具;不传 agent_toolset_20260401 时默认支持所有内置工具。
显示子属性
隐藏子属性
显示子属性
隐藏子属性
工具类型。
可选值:agent_toolset_20260401(内置工具集,包含 bash、edit、read、write、glob、grep、web_fetch、web_search)、mcp_toolset(引用 mcp_servers 中某个服务的全部工具)、custom(自定义工具,由调用方执行后通过 user.custom_tool_result 事件回填结果)。
对工具集内全部工具生效的默认配置。
适用于 agent_toolset_20260401、mcp_toolset。
显示子属性
隐藏子属性
是否启用,默认 true。
工具执行的权限策略。
显示子属性
隐藏子属性
权限策略类型。
可选值:always_allow(直接执行)、always_ask(每次执行前推送 agent.tool_use 事件,等待调用方通过 user.tool_confirmation 确认)。
按工具名单独覆盖默认配置。
适用于 agent_toolset_20260401、mcp_toolset。
显示子属性
隐藏子属性
显示子属性
隐藏子属性
工具名称。
agent_toolset_20260401 的可选值:bash、edit、read、write、glob、grep、web_fetch、web_search。
是否启用该工具。
工具执行的权限策略。
显示子属性
隐藏子属性
权限策略类型。
可选值:always_allow(直接执行)、always_ask(每次执行前推送 agent.tool_use 事件,等待调用方通过 user.tool_confirmation 确认)。
允许访问的域名(裸主机名),最多 64 个,与 blocked_domains 互斥。
仅 web_fetch。
显示子属性
隐藏子属性
禁止访问的域名(裸主机名),最多 64 个,与 allowed_domains 互斥。
仅 web_fetch。
显示子属性
隐藏子属性
引用的 MCP 服务名称,须与 mcp_servers 中某个服务的 name 一致。
type 为 mcp_toolset 时必填。
自定义工具名称,长度 1–64。
type 为 custom 时必填。
自定义工具描述。
type 为 custom 时必填。
工具输入结构,JSON Schema 格式。
type 为 custom 时必填。
显示子属性
隐藏子属性
工具输入结构类型,固定为 object。
工具输入参数声明。
显示子属性
隐藏子属性
工具输入必传参数。
显示子属性
隐藏子属性
多智能体配置,选填。不传时为单智能体,行为不变。
配置后,主智能体可以把任务委派给名单里的子智能体,每个子智能体在各自的子线程里运行;委派能力由平台自动提供,不需要在 tools 里声明。
显示子属性
隐藏子属性
配置类型,固定为 multiagent_20261001。
传入 coordinator 或其他取值返回 400。
子智能体配置。
显示子属性
隐藏子属性
是否开启委派。
可选值:enabled(开启)、disabled(关闭)。
子智能体名单。
最多 20 个成员,不能重复;成员的 name 也不能重复,主智能体靠成员的 name 和 description 判断把任务派给谁。
成员必须是当前企业下已创建且未归档的智能体,且自身不能配置 multiagent(只支持一层委派),否则返回 400。
元素可以是智能体标识字符串,也可以是对象,两种写法等价。
成员跟随最新版本:创建会话时取每个成员当时的最新版本。成员条目里的 version 不支持,传入返回 400。
type 为 enabled 时必填且不能为空。
显示子属性
隐藏子属性
多选一且必需"只能"符合其中一个
显示子属性
隐藏子属性
智能体标识。
显示子属性
隐藏子属性
成员类型。
可选值:agent(引用已创建的智能体)、self(主智能体自己的副本,最多一个;副本使用和主智能体相同的配置,但不能再委派)。
智能体标识。
type 为 agent 时必填。
内联子智能体(主智能体临时定义的子智能体)。
省略时按关闭处理;传入 {"type": "enabled"} 返回 400。
显示子属性
隐藏子属性
固定为 disabled。
动态工作流。
省略时按关闭处理;传入 {"type": "enabled"} 返回 400。
显示子属性
隐藏子属性
固定为 disabled。
顾问。
省略时按关闭处理;传入 {"type": "enabled"} 返回 400。
显示子属性
隐藏子属性
固定为 disabled。
智能体(Agent)可连接的 MCP 服务(MCP Server)列表。
最多 20 个,name 不可重复;每个服务必须被 tools 中的 mcp_toolset 引用。
显示子属性
隐藏子属性
显示子属性
隐藏子属性
MCP 服务接入类型,固定为 url。
MCP 服务名称,长度 1–255,供 tools 中 mcp_toolset 的 mcp_server_name 引用。
MCP 服务地址,长度不超过 2048 个字符。
挂载到智能体(Agent)的技能(Skill)列表。
显示子属性
隐藏子属性
显示子属性
隐藏子属性
技能(Skill)类型,固定为 custom。
技能(Skill)标识,长度 1–64。
技能版本标识,取技能接口返回的版本标识;省略时自动使用最新版本。
自定义键值,最多 16 对。
键最长 64 个字符,值最长 512 个字符。
显示子属性
隐藏子属性
执行身份,选填。当前只支持 {"type": "service_account"},省略时等同于此;传入其他 type 返回 400。
显示子属性
隐藏子属性
挂载到智能体的文件列表。
显示子属性
隐藏子属性
显示子属性
隐藏子属性
文件标识,长度 1–128,取上传文件接口返回的 id;文件不存在时返回 404。
POST /api/dma/v1/agents HTTP/1.1
Host: api.dumate.cn
Authorization: Bearer <YOUR_API_KEY>
Content-Type: application/json
示例代码
curl --location --request POST "https://api.dumate.cn/api/dma/v1/agents" \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
--header 'Content-Type: application/json' \
--data '{
"name": "demo-agent",
"system": "You are a helpful assistant.",
"tools": [
{
"type": "agent_toolset_20260401",
"default_config": {
"permission_policy": {
"type": "always_ask"
}
}
},
{
"type": "custom",
"name": "get_order_status",
"description": "查询订单状态",
"input_schema": {
"type": "object",
"properties": {
"order_id": {
"type": "string"
}
},
"required": [
"order_id"
]
}
}
]
}'
curl --location --request POST "https://api.dumate.cn/api/dma/v1/agents" \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
--header 'Content-Type: application/json' \
--data '{
"name": "周报助手",
"description": "按周汇总销售数据并生成周报",
"system": "你是一个周报助手,根据用户提供的数据生成结构清晰的周报。",
"model": "ernie-4-5-pro",
"tools": [
{ "type": "agent_toolset_20260401" }
]
}'
curl --location --request POST "https://api.dumate.cn/api/dma/v1/agents" \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
--header 'Content-Type: application/json' \
--data '{
"name": "周报助手",
"system": "你是一个周报助手,根据用户提供的数据生成结构清晰的周报。",
"model": {
"id": "ernie-4-5-pro",
"effort": "high"
}
}'
curl --location --request POST "https://api.dumate.cn/api/dma/v1/agents" \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
--header 'Content-Type: application/json' \
--data '{
"name": "调研负责人",
"description": "负责拆解调研问题、汇总结论。",
"system": "你负责完成调研任务。问题可以拆成几个互相独立的子问题时,把每个需要大量搜索和阅读的子问题交给资料检索员,一次交一个范围明确的问题,可以同时交多个。核对来源和撰写最终结论由你自己完成。",
"tools": [
{ "type": "agent_toolset_20260401" }
],
"multiagent": {
"type": "multiagent_20261001",
"subagents": {
"type": "enabled",
"predefined_agents": [
{ "type": "agent", "id": "agt_2ad2d132c698" },
{ "type": "self" }
]
}
}
}'
返回响应
资源类型标识,固定为 agent。
智能体(Agent)标识,agt_ 前缀。
智能体(Agent)名称。
智能体(Agent)的用途说明。
智能体(Agent)的系统提示词。
工具配置列表,结构同请求参数,并补全默认值。
显示子属性
隐藏子属性
显示子属性
隐藏子属性
工具类型。
可选值:agent_toolset_20260401(内置工具集,包含 bash、edit、read、write、glob、grep、web_fetch、web_search)、mcp_toolset(引用 mcp_servers 中某个服务的全部工具)、custom(自定义工具,由调用方执行后通过 user.custom_tool_result 事件回填结果)。
对工具集内全部工具生效的默认配置。
适用于 agent_toolset_20260401、mcp_toolset。
显示子属性
隐藏子属性
是否启用,默认 true。
工具执行的权限策略。
显示子属性
隐藏子属性
权限策略类型。
可选值:always_allow(直接执行)、always_ask(每次执行前推送 agent.tool_use 事件,等待调用方通过 user.tool_confirmation 确认)。
按工具名单独覆盖默认配置。
适用于 agent_toolset_20260401、mcp_toolset。
显示子属性
隐藏子属性
显示子属性
隐藏子属性
工具名称。
agent_toolset_20260401 的可选值:bash、edit、read、write、glob、grep、web_fetch、web_search。
是否启用该工具。
工具执行的权限策略。
显示子属性
隐藏子属性
权限策略类型。
可选值:always_allow(直接执行)、always_ask(每次执行前推送 agent.tool_use 事件,等待调用方通过 user.tool_confirmation 确认)。
允许访问的域名(裸主机名),最多 64 个,与 blocked_domains 互斥。
仅 web_fetch。
显示子属性
隐藏子属性
禁止访问的域名(裸主机名),最多 64 个,与 allowed_domains 互斥。
仅 web_fetch。
显示子属性
隐藏子属性
抓取内容的最大 token 数。当前仅保存,不影响运行。
URL 来源配置。当前仅保存,不影响运行。
显示子属性
隐藏子属性
用户位置。当前仅保存,不影响运行。
显示子属性
隐藏子属性
位置类型,固定为 approximate。当前仅保存,不影响运行。
城市。当前仅保存,不影响运行。
国家,ISO 3166-1 两位代码。当前仅保存,不影响运行。
地区。当前仅保存,不影响运行。
时区,IANA 格式。当前仅保存,不影响运行。
引用的 MCP 服务名称,须与 mcp_servers 中某个服务的 name 一致。
type 为 mcp_toolset 时必填。
自定义工具名称,长度 1–64。
type 为 custom 时必填。
自定义工具描述。
type 为 custom 时必填。
工具输入结构,JSON Schema 格式。
type 为 custom 时必填。
显示子属性
隐藏子属性
工具输入结构类型,固定为 object。
工具输入参数声明。
显示子属性
隐藏子属性
工具输入必传参数。
显示子属性
隐藏子属性
MCP 服务列表,结构同请求参数,并补全默认值。
显示子属性
隐藏子属性
显示子属性
隐藏子属性
MCP 服务接入类型,固定为 url。
MCP 服务名称,长度 1–255,供 tools 中 mcp_toolset 的 mcp_server_name 引用。
MCP 服务地址,长度不超过 2048 个字符。
技能(Skill)列表,结构同请求参数,并补全默认值。
显示子属性
隐藏子属性
显示子属性
隐藏子属性
技能(Skill)类型,固定为 custom。
技能(Skill)标识,长度 1–64。
技能版本标识,取技能接口返回的版本标识;省略时自动使用最新版本。
自定义键值。
显示子属性
隐藏子属性
版本号,创建时为 1,每次更新加 1。
创建时间,RFC 3339 格式,UTC。
最近更新时间,RFC 3339 格式,UTC。
归档时间,RFC 3339 格式,UTC;未归档时为 null。
智能体使用的模型,统一以对象形式返回。
自定义模型的接入地址和密钥不会出现在返回里。
显示子属性
隐藏子属性
模型 ID。
思考档位;没有指定时不返回。
多智能体配置;未配置时为 null。
显示子属性
隐藏子属性
配置类型,固定为 multiagent_20261001。
子智能体配置。
显示子属性
隐藏子属性
是否开启委派。
可选值:enabled(开启)、disabled(关闭)。
子智能体名单,成员统一以对象形式返回。
显示子属性
隐藏子属性
显示子属性
隐藏子属性
成员类型。
可选值:agent(引用已创建的智能体)、self(主智能体自己的副本,最多一个;副本使用和主智能体相同的配置,但不能再委派)。
智能体标识。
type 为 agent 时必填。
内联子智能体(主智能体临时定义的子智能体)。固定返回 {"type": "disabled"}。
显示子属性
隐藏子属性
固定为 disabled。
动态工作流。固定返回 {"type": "disabled"}。
显示子属性
隐藏子属性
固定为 disabled。
顾问。固定返回 {"type": "disabled"}。
显示子属性
隐藏子属性
固定为 disabled。
{
"type": "agent",
"id": "agt_84cdf2ff9c2f",
"name": "demo-agent",
"description": "",
"system": "You are a helpful assistant.",
"tools": [
{
"type": "agent_toolset_20260401",
"default_config": {
"enabled": true,
"permission_policy": {
"type": "always_ask"
}
}
},
{
"type": "custom",
"name": "get_order_status",
"description": "查询订单状态",
"input_schema": {
"type": "object",
"properties": {
"order_id": {
"type": "string"
}
},
"required": [
"order_id"
]
}
}
],
"mcp_servers": [],
"skills": [],
"metadata": {},
"version": 1,
"created_at": "2026-11-04T12:40:36Z",
"updated_at": "2026-11-04T12:40:36Z",
"archived_at": null
}
{
"type": "agent",
"id": "agt_84cdf2ff9c2f",
"name": "周报助手",
"description": "按周汇总销售数据并生成周报",
"system": "你是一个周报助手,根据用户提供的数据生成结构清晰的周报。",
"model": {
"id": "ernie-4-5-pro"
},
"tools": [
{
"type": "agent_toolset_20260401",
"default_config": {
"enabled": true,
"permission_policy": { "type": "always_allow" }
}
}
],
"mcp_servers": [],
"skills": [],
"metadata": {},
"version": 1,
"created_at": "2026-11-17T06:40:36Z",
"updated_at": "2026-11-17T06:40:36Z",
"archived_at": null
}
{
"type": "agent",
"id": "agt_84cdf2ff9c2f",
"name": "调研负责人",
"description": "负责拆解调研问题、汇总结论。",
"system": "你负责完成调研任务。……",
"tools": [
{
"type": "agent_toolset_20260401",
"default_config": {
"enabled": true,
"permission_policy": { "type": "always_allow" }
}
}
],
"mcp_servers": [],
"multiagent": {
"type": "multiagent_20261001",
"subagents": {
"type": "enabled",
"predefined_agents": [
{ "type": "agent", "id": "agt_2ad2d132c698" },
{ "type": "self" }
],
"inline_agents": { "type": "disabled" }
},
"workflows": { "type": "disabled" },
"advisor": { "type": "disabled" }
},
"skills": [],
"metadata": {},
"version": 1,
"created_at": "2026-11-17T08:20:11Z",
"updated_at": "2026-11-17T08:20:11Z",
"archived_at": null
}
评价此篇文章
