跳到正文

更新 Agent

POST/v1/agents/{agent_id}

SDK 风格的部分更新。提供的字段会替换已保存的值并创建新版本;省略的字段保持原值。无需 row_version。此处不接受 description 和 note;如需修改请使用 Replace (PATCH)。已归档的 Agent 返回 404。

路径参数

stringagent_id必填

Agent ID(agt_ 前缀)。

请求头

可选<string>Idempotency-Key

可选。省略时服务会自动生成一个,因此重试请求可能会创建重复项。重试时请发送你自己的固定键。

请求体

以下字段的任意子集。其他字段返回 400。

可选<string>model

来自 Models API 的模型 ID,最多 200 个字符。

可选<string>name

显示名称,最多 128 个字符。

可选<string>instructions

系统指令,最大 256 KiB。

可选<string>runtime_profile

执行运行时:codex(默认)、claude 或 mcode。

可选<array>skills

技能引用:{"skill_id": "skl_…", "version": null | "<version>"}。最多 32 个。对于新绑定,null 会在保存 Agent 时固定为当前默认版本。对于已有绑定,null 会保留其固定版本;如需升级,请指定明确版本。

可选<array>mcp_connections

MCP 引用:{connection_id, server_label, allowed_tools, required}。最多 32 个;server_label 在 Agent 内必须唯一。

可选<array>tools

最多 64 个 function 工具,以及最多一个 web_search 工具。目前会话要求 web_search 的 mode 为 disabled,且暂不支持客户端返回 function 结果。

可选<object>text

format.type 为 text 或 json_schema(使用对象 schema);verbosity 为 low、medium 或 high。

可选<object>reasoning

effort 为 none、minimal、low、medium、high、xhigh 或 max;summary 为 concise、detailed 或 auto。

可选<string>service_tier

auto(默认)、default、flex、priority 或 fast。

可选<object>metadata

最多 16 个字符串键值对;键最多 64 个字符,值最多 512 个字符。