创建 Agent
/v1/agents创建一个版本为 1 的已保存 Agent。请求体为严格 JSON:未知字段会返回 400。multi_agent 必须省略或为 null。
请求头
可选。省略时由服务生成,因此重试请求可能会创建重复项。重试时请发送你自己的固定键。
请求体
JSON 对象。
必填,来自 Models API 的模型 ID,最多 200 个字符。没有默认值;省略 model 会返回 400。示例使用 deepseek/deepseek-v4-flash。
显示名称,最多 128 个字符。
系统指令,最大 256 KiB。
执行运行时:codex(默认)、claude 或 mcode。
技能引用:{"skill_id": "skl_…", "version": null | "<version>"}。最多 32 个。对于新绑定,null 会在保存 Agent 时固定为当前默认版本。对于已有绑定,null 会保留其已固定的版本;如需升级,请显式指定版本。
MCP 引用:{connection_id, server_label, allowed_tools, required}。最多 32 个;server_label 在 Agent 内必须唯一。省略时使用内置 SandBase 工具({"connection_id": "builtin:sandbase", "server_label": "sandbase_builtin"});发送的列表会替换该默认值,传入 [] 则创建不带工具的 Agent。参见内置 SandBase 工具(/agents/mcp-tools#built-in-sandbase-tools)。
最多 64 个 function 工具,外加至多一个 web_search 工具。会话目前要求禁用 web_search 模式,且暂不支持客户端返回 function 结果。
format.type 为 text 或 json_schema(需提供 object schema);verbosity 为 low、medium 或 high。
effort 为 none、minimal、low、medium、high、xhigh 或 max;summary 为 concise、detailed 或 auto。
auto(默认)、default、flex、priority 或 fast。
最多 16 个字符串键值对;键最多 64 个字符,值最多 512 个字符。
较长的描述,最多 4096 个字符。
记录在版本 1 上的变更说明。
Agent 对象
由 create、get、update、archive、unarchive、restore 和 clone 返回。
带 agt_ 前缀的 Agent ID。
始终为 agent。
当前版本。每次有效写入都会创建一个新版本。
用于 PATCH、archive、unarchive 和 restore 的比较并设置(compare-and-set)令牌。
active 或 archived。
当前版本的执行就绪状态。会话需要 ready;新建的 Agent 可能会短暂显示 pending。
codex、claude 或 mcode。
你的 Agents 为 private;目录条目为 public。
Unix 秒级时间戳。处于 active 状态时 archived_at 为 null。