多 Agent 协作
为什么要多 Agent?
Section titled “为什么要多 Agent?”一个 Agent 什么都能干,但专业的 Agent 团队能干得更好。
单 Agent: "样样通,样样松"Agent 团队: "每个 Agent 都是领域专家"sessions_send
Section titled “sessions_send”Agent 之间通过 sessions_send 通信:
# CEO 分派给 Code Agentsessions_send --agent code --message "开发搜索 API 接口"
# Code Agent 汇报sessions_send --agent main --message "搜索 API 完成,PR #42 已提交。"多个 Bot 在同一个群里,透明协作:
[群聊] CEO:@code 开发登录页面[群聊] Code:收到,预计 2 小时。[群聊] Code:登录页面 PR 已提交 ✅[群聊] CEO:@ops 部署到测试环境[群聊] Ops:已部署到 staging.example.com ✅CEO 分发模式
Section titled “CEO 分发模式”用户请求 → CEO Agent ↓ 分析 & 拆解任务 ↓ ┌──────────┼──────────┐ ↓ ↓ ↓ Code Content Research Agent Agent Agent ↓ ↓ ↓ 结果 结果 结果 └──────────┼──────────┘ ↓ CEO 汇总结果 ↓ 回复用户{ agents: { main: { model: "claude-opus-4", workspace: "~/agents/ceo" }, code: { model: "claude-sonnet-4", workspace: "~/agents/code" }, content: { model: "gpt-4o", workspace: "~/agents/content" }, }, bindings: [ { agentId: "main", match: { channel: "telegram", account: "ceo" } }, { agentId: "code", match: { channel: "telegram", account: "code" } }, ]}