跳到正文

替换 Agent(CAS)

PATCH/v1/agents/{agent_id}

以比较并设置(compare-and-set)方式进行产品级更新。row_version 为必填项,且必须等于当前值,否则返回 409。所提供的字段会替换已保存的值;显式传入 null 将返回 400。当多个编辑者可能修改同一个 Agent 时,请使用此方式。

路径参数

stringagent_id必填

Agent ID(agt_ 前缀)。

请求头

可选<string>Idempotency-Key

可选。省略时由服务自动生成,因此重试的请求可能会产生重复记录。重试时请发送你自己的稳定键。

请求体

row_version 以及任意 Agent 字段子集。

integerrow_version必填

你最近一次读取到的 row_version。值已过期时返回 409。

可选<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 个函数工具,外加最多一个 web_search 工具。会话目前要求禁用 web_search 模式,且暂不支持客户端函数结果。

可选<object>text

format.type 为 text 或 json_schema(需配合 object 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 个字符。

可选<string>description

最多 4096 个字符。

可选<string>note

记录在新版本上的变更说明。