创建智能体
/anthropic/v1/agents◐ 部分支持请求体
namestring必填智能体的显示名称,去除首尾空白后 1–256 个字符,不含 NUL 与换行。它只是标签,不要求唯一:两个智能体可以同名。
modelstring | object必填智能体使用的模型:从 Praxis 模型目录(praxis.model.models.list)取得 ID 字符串,或传 model_config 对象。与 Anthropic 不同,不在目录中的 Claude 模型 ID 会被拒绝。
展开子字段 (4)
idstring必填模型 ID,取自 Praxis 模型目录(praxis.model.models.list)。
effortstring | object可选每次推理的思考力度:可传级别字符串(如 high)或 {type: high} 对象。创建时省略取该模型的默认值;更新时省略保持不变。
inference_geostring可选模型推理的地理区域;不传沿用工作区默认。model 是整体替换字段,更新时省略子字段即清除该项。
speedstring可选推理速度模式:fast 出字显著更快但按溢价计费;并非所有模型都支持,不支持的组合在创建时被拒。
systemstring可选智能体的系统提示词。
descriptionstring可选智能体的用途说明。
mcp_serversarray可选智能体连接的 MCP 服务器列表,最多 20 个,名称必须唯一;每个服务器都要被 tools 里的 mcp_toolset 引用,否则整笔请求被拒。
展开子字段 (3)
typestring必填服务器类型:url(HTTP 或 SSE 端点)或 stdio(受信任的本地命令)。
namestring必填MCP 服务器在本列表内的唯一名称,1–255 个字符,供 mcp_toolset 配置引用。
urlstring必填MCP 服务器的端点地址。
metadataobject可选自定义元数据键值对,最多 16 个键、每个值最长 512 字符。
multiagentobject可选多智能体协作拓扑:会话主线程作为协调者,从 agents 名单派生会话线程执行工作。
展开子字段 (2)
agentsarray必填协调者可以派生为会话线程的智能体名单,1–20 项;支持 ID 字符串、{type: agent, id, version?} 和最多一个 {type: self}。创建/更新时固定版本。成员须唯一、存在且未归档,不能自身带 multiagent。每个 coordinator 最多一个 advisor,模型须可用且不同于智能体模型;仅主会话可咨询,每次咨询为独立 advisor 线程,建议以 agent.thread_message_received 返回。
typestring必填拓扑类型,目前只有 coordinator。
skillsarray可选◐ 部分支持挂载到智能体的自定义技能 [{type:"custom", skill_id, version?}],skill_id 取自 skills.create 或 skills.list,最多 20 个且不得重复。省略 version 或传 "latest" 表示会话开始时该技能的最新版本;type 为 anthropic 返回 400。
toolsarray可选智能体可用的工具配置,所有工具合计最多 128 个。
返回
200
支持文本提示词、模型、元数据、内置工具与 custom 自定义工具定义。/agent/v1 和 /anthropic 都保存并原样返回 custom 定义:最多 32 个,名称区分大小写且匹配 [a-zA-Z0-9_-]{1,64}、不得与内置工具或其他 custom 重名,description 长度 1–1024,input_schema 为 type=object 的对象且序列化 UTF-8 JSON 不超过 16 KB。模型调用 custom 工具时发出 agent.custom_tool_use 并等待客户端发送 user.custom_tool_result。MCP 及额外模型控制尚不支持,传入会返回 400。skills 以 [{type:"custom",skill_id,version?}] 挂载已上传的技能,只支持 custom(type 为 anthropic 返回 400);最多 20 个,skill_id 不得重复,技能及固定的版本须存在于本组织且未删除。省略 version 或传 "latest" 表示创建会话时该技能的最新版本;之后上传的新版本不影响已运行的会话。更新时省略 skills 保留,传数组整体替换,传 null 清空。会话带机器时,每个技能在会话启动时安装到 /home/user/.praxis/skills/<name>/;机器上已有同名技能时不覆盖,会话收到一条提示。无机器的会话不安装。 兼容 API 的响应总会填 version:固定的版本号或 "latest"。 multiagent 接受 null 或 coordinator 名册,1–20 项:智能体 ID、{type:"agent",id,version?} 或最多一个 {type:"self"}。创建/更新时固定版本:省略 version 时固定为名册成员保存当时的生效版本,只传字符串 ID 会被接受并改写为对象形式;成员去重且须存在、未归档、不能自身带 multiagent。兼容 API 只提供 bash、edit、glob、grep、read、write、web_search、web_fetch 这 8 个官方工具;configs 不接受其他工具名,经此入口创建的会话不提供后台任务、Monitor 或子智能体。完整原生工具请使用 /agent/v1。每个 coordinator 最多一个 advisor,模型须可用且不同于智能体模型;仅主会话可咨询,每次咨询为独立 advisor 线程,建议以 agent.thread_message_received 返回。
错误按 Claude Managed Agents 格式返回,参见 错误码
请求示例
curl
curl https://api.deepraxis.com/anthropic/v1/agents \
-H "x-api-key: $PRAXIS_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "anthropic-beta: managed-agents-2026-04-01" \
-H "Content-Type: application/json" \
-d '{"name":"文档助手","model":"deepseek-flash","system":"用一句话简短回答。"}'Python
from anthropic import Anthropic
client = Anthropic(
base_url="https://api.deepraxis.com/anthropic",
api_key="$PRAXIS_API_KEY",
)
result = client.beta.agents.create(name="文档助手", model="deepseek-flash", system="用一句话简短回答。")
print(result)TypeScript
import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({
baseURL: "https://api.deepraxis.com/anthropic",
apiKey: "$PRAXIS_API_KEY",
});
const result = await client.beta.agents.create({
"name": "文档助手",
"model": "deepseek-flash",
"system": "用一句话简短回答。"
});
console.log(result);响应示例 200
{
"id": "agent_d491cb4e-690a-4f8e-8977-d8186eee6919",
"type": "agent",
"name": "文档助手",
"description": null,
"system": "用一句话简短回答。",
"model": {
"id": "deepseek-flash"
},
"metadata": {},
"tools": [
{
"type": "agent_toolset_20260401",
"default_config": {
"enabled": true,
"permission_policy": {
"type": "always_allow"
}
},
"configs": [
{
"name": "bash",
"enabled": true,
"permission_policy": null
},
{
"name": "edit",
"enabled": true,
"permission_policy": null
},
{
"name": "glob",
"enabled": true,
"permission_policy": null
},
{
"name": "grep",
"enabled": true,
"permission_policy": null
},
{
"name": "read",
"enabled": true,
"permission_policy": null
},
{
"name": "write",
"enabled": true,
"permission_policy": null
},
{
"name": "web_search",
"type": "web_search",
"enabled": true,
"permission_policy": null
},
{
"name": "web_fetch",
"type": "web_fetch",
"enabled": true,
"permission_policy": null
}
]
}
],
"mcp_servers": [],
"skills": [],
"multiagent": null,
"version": 1,
"created_at": "2026-10-23T01:35:25.425Z",
"updated_at": "2026-10-23T01:35:25.425Z",
"archived_at": null
}响应
HTTP 200
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | |
| archived_at | null | string | A timestamp in RFC 3339 format |
| created_at | string | A timestamp in RFC 3339 format |
| description | null | string | |
| mcp_servers | array<object> | |
| mcp_servers[].type | string | |
| mcp_servers[].name | string | |
| mcp_servers[].url | string | |
| metadata | object | |
| model | object | Model identifier and configuration. |
| model.id | string | A model id from the Praxis model catalog (praxis.model.models.list). Unlike Anthropic, Claude model ids other than those in the catalog are rejected. |
| model.effort | object | How hard Claude works on each turn. Sets output_config.effort on every Messages call the session makes. |
| model.inference_geo | string | Geographic region for model inference. When unset, requests fall through to the workspace's default_inference_geo. |
| model.speed | string | Inference speed mode. fast provides significantly faster output token generation at premium pricing. Not all models support fast; invalid combinations are rejected at create time. |
| multiagent | null | object | Resolved coordinator topology with a concrete agent roster. |
| multiagent.agents | array<object> | Agents the coordinator may spawn as session threads, each resolved to a specific version. |
| multiagent.type | string | |
| name | string | |
| skills | array<object> | |
| skills[].skill_id | string | |
| skills[].type | string | |
| skills[].version | string | |
| system | null | string | |
| tools | array<object> | |
| tools[].configs | array<object> | array | null | |
| tools[].default_config | object | object | null | Resolved default configuration for agent tools. |
| tools[].type | string | |
| tools[].mcp_server_name | string | |
| tools[].description | string | |
| tools[].input_schema | object | JSON Schema for custom tool input parameters. |
| tools[].name | string | |
| type | string | |
| updated_at | string | A timestamp in RFC 3339 format |
| version | number | The agent's current version. Starts at 1 and increments when the agent is modified. |