13-api-design.md 1.89 KB

13. API 设计

13.1 Agent 管理

方法 路径 说明
POST /api/agents 创建 Agent
GET /api/agents 列出所有 Agent
GET /api/agents/:id 获取 Agent 详情
PUT /api/agents/:id 更新 Agent 配置
DELETE /api/agents/:id 删除 Agent
POST /api/agents/:id/start 启动 Agent
POST /api/agents/:id/stop 停止 Agent
PUT /api/agents/:id/define v1.1: 热更新 Agent Define

13.2 BossAgent 调度

方法 路径 说明
POST /api/boss/init 初始化 BossAgent(分析业务 → 动态创建组织架构)
POST /api/boss/goal 设定公司 Goal
GET /api/boss/status 获取全局运行状态(含 Pipeline DAG)
POST /api/boss/reflect 手动触发一次反思
GET /api/boss/report 获取最近一轮反思报告
GET /api/boss/pipeline v1.1: 获取当前 Pipeline DAG

13.3 Loop 引擎

方法 路径 说明
GET /api/loop/:agentId/status 获取 Agent 的 Loop 状态
GET /api/loop/:agentId/history 获取 Loop 运行历史
POST /api/loop/:agentId/pause 暂停 Agent 的 Loop
POST /api/loop/:agentId/resume 恢复 Agent 的 Loop

13.4 Gateway(Webhook 接收)

方法 路径 说明
POST /api/gateway/feishu/event 飞书事件回调
POST /api/gateway/dingtalk/event 钉钉事件回调
GET /api/gateway/whatsapp/qr WhatsApp 二维码获取

13.5 实时流(SSE / WebSocket)

端点 协议 说明
/api/agents/:id/stream SSE 单 Agent 实时输出流
/ws/boss WebSocket BossAgent 全局状态流(含 Pipeline 变更事件)
/ws/dashboard WebSocket 仪表盘实时数据推送