API 文档

Agents 接口

查询 Agent 类型、读取和更新 Agent 配置、清理 Agent 会话。

Agent 配置只覆盖 vod / issue / coding / qa / sre 五类。chat 不是 Agent 配置域,传 chat 会返回 404。

接口一览

方法 路径 用途 认证
GET /api/agents/types Agent 类型列表 公开
GET /api/agents/{name}/{owner}/{repo} 读 Agent 配置 用户级
PUT /api/agents/{name}/{owner}/{repo} 更新 Agent 配置 用户级
POST /api/agents/{name}/{owner}/{repo}/clean 清理会话 用户级

“用户级”指 grape_ API Key 或 Web JWT;tk_ 会话 token 返回 403。认证细节见 认证与凭据。

GET /api/agents/types

公开端点,不带 token 也可以调用。

响应

{
  "types": [
    {
      "agent_type": "vod",
      "display_name": "需求洞察",
      "description": "",
      "default_backend": "",
      "icon": "",
      "order_num": 1,
      "enable": true,
      "color": "",
      "bg": ""
    }
  ]
}

外层是对象,列表在 types 键里;顺序由 order_num 决定。

GET /api/agents/{name}/{owner}/{repo}

读取某个仓库的 Agent 配置。

Path

参数 说明
name vod / issue / coding / qa / sre
owner 仓库 owner
repo 仓库名

Query

参数 默认 说明
issue_number — 高亮某个 Issue
keyword — 按 seq / issue_id / event_type / title 检索事件历史
page 1 页码
page_size 10 每页数量,上限 100

响应关键字段

{
  "agent_type": "vod",
  "display_name": "需求洞察",
  "backends": [],
  "declared_runtime_ids": [],
  "effective_runtime_id": 0,
  "skill": "<skill-name>",
  "skill_id": 0,
  "skill_scope": "repo",
  "repo_token_exists": false,
  "subscribe_events": [],
  "status": "idle",
  "metrics": {"total_events": 0, "event_stats": {}},
  "recent_events": [],
  "im": {"im_app_id": "", "connected": false, "conversations": []}
}

repo_token_exists 只表示有没有存 token,不返回 token 内容;im 只有 VOD 有对象,其余为 null。

PUT /api/agents/{name}/{owner}/{repo}

更新 Agent 配置。

请求体

字段 类型 说明
backend string 引擎名(兼容字段)
backends array 引擎集合
skill string 技能名(兼容字段)
skill_id int 技能 id
skill_scope string official / repo / user
enable bool 启停
subscribe_events array 订阅的事件
im_app_id / im_app_secret string 飞书配置
im_unbind bool 仅 VOD:true 时解绑 IM,不动引擎和技能

响应

{"message":"Agent 配置已更新","session_id":"..."}

常见错误

状态 原因
400 引擎无效,或 DevOps Agent 绑定个人引擎
404 未知 Agent

skill_id 无效不会报 400,服务端会记 warning 并沿用默认技能。

POST /api/agents/{name}/{owner}/{repo}/clean

清理该 Agent 的会话,把 runtime_session_id 置空。

响应

{"message":"Agent 会话已清理","cleaned":true,"agent_type":"vod"}

cleaned=false 表示原先没有会话行。

相关

场景与引擎配置 | 运行时与 Worker | 认证与凭据