POST /agents

注册或更新 Agent(upsert 语义)。

POST /cells/{cellID}/agents

路径参数

参数类型说明
cellIDstringCell ID

请求参数

{
  "id": "agent-legal",
  "name": "合同审查助手",
  "description": "专业审查各类商业合同,识别风险条款并给出修改建议",
  "model": "gpt-4o",
  "system_prompt": "你是一位资深法务专家,擅长审查商业合同...",
  "skills": ["code-review", "legal-analysis"]
}
字段类型必填说明
idstring✅Agent ID,全局唯一标识
namestring✅显示名称
descriptionstring否功能描述
modelstring否默认使用的模型(如 gpt-4o、claude-sonnet-4)
system_promptstring否系统提示词
skillsstring[]否技能白名单。null = 使用全部可用技能;[](空数组)= 不使用任何技能

curl 示例

创建一个合同审查 Agent:

curl -s -X POST "http://localhost:9091/cells/dept-legal/agents" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "id": "agent-legal",
    "name": "合同审查助手",
    "description": "专业审查各类商业合同,识别风险条款并给出修改建议",
    "model": "gpt-4o",
    "system_prompt": "你是一位资深法务专家。审查合同时重点关注:1) 违约责任条款 2) 知识产权归属 3) 保密义务 4) 争议解决方式。",
    "skills": null
  }' | jq .

响应

200 OK

返回创建或更新后的 Agent 对象:

{
  "id": "agent-legal",
  "name": "合同审查助手",
  "description": "专业审查各类商业合同,识别风险条款并给出修改建议",
  "model": "gpt-4o",
  "system_prompt": "你是一位资深法务专家,擅长审查商业合同...",
  "skills": ["code-review", "legal-analysis"],
  "created_at": "2026-09-21T14:00:00Z",
  "updated_at": "2026-09-21T14:00:00Z"
}

错误码

HTTP错误说明
400—请求体格式错误或缺少必填字段
401—未认证或 Token 无效
403—Token scope 不足(需要 cell:admin)
404—Cell 不存在

相关端点