第17章 实战:团队协作 Agent
一句话:用多 Agent + 多渠道搭建虚拟团队——代码审查、客服问答、Discord 多频道协作,一人顶一支队伍。
17.1 Solo Founder 4-Agent 虚拟团队
Section titled “17.1 Solo Founder 4-Agent 虚拟团队”复现社区经典案例:一个独立创业者用 4 个 Agent 组建虚拟公司。
| Agent | 名字 | 角色 | Telegram 触发 |
|---|---|---|---|
milo | Milo | 策略与产品 | @milo |
josh | Josh | 商务与营销 | @josh |
angela | Angela | 内容与设计 | @angela |
bob | Bob | 编码与 DevOps | @bob |
{ agents: { defaults: { memorySearch: { extraPaths: ["/shared/company-docs"], // 共享知识库 }, }, list: [ { id: "milo", workspace: "~/.openclaw/workspace-milo", model: { primary: "zai/glm-5" }, // 深度思考 groupChat: { mentionPatterns: ["@milo", "milo"] }, }, { id: "josh", workspace: "~/.openclaw/workspace-josh", model: { primary: "moonshot/kimi-k2.5" }, groupChat: { mentionPatterns: ["@josh", "josh"] }, }, { id: "angela", workspace: "~/.openclaw/workspace-angela", model: { primary: "moonshot/kimi-k2.5" }, groupChat: { mentionPatterns: ["@angela", "angela"] }, }, { id: "bob", default: true, workspace: "~/.openclaw/workspace-bob", model: { primary: "minimax/MiniMax-M2.5" }, // 编码能力强 groupChat: { mentionPatterns: ["@bob", "bob"] }, }, ], },
channels: { telegram: { enabled: true, botToken: "<token>", dmPolicy: "allowlist", allowFrom: ["<user-id>"], groups: { "TEAM_GROUP_ID": { requireMention: true, // 需要 @ 才触发 }, }, }, },
// 注意:按 @名字 路由到不同 Agent 的功能通过 // agents.list[].groupChat.mentionPatterns 配合 bindings 实现。 // 以下 bindings 按渠道路由,群组中通过 mentionPatterns 触发对应 Agent。 bindings: [ { agentId: "bob", match: { channel: "telegram" } }, // 默认路由到 Bob ],}各 Agent 的 SOUL.md
Section titled “各 Agent 的 SOUL.md”Milo(策略):
# Soul你是 Milo,一个资深策略顾问。- 沉稳、理性,习惯用数据支撑观点- 对不确定的事会明确说"这个需要更多数据才能判断"- 喜欢用框架思考(SWOT、Porter's Five Forces)- 说话直接,不绕弯子Josh(商务):
# Soul你是 Josh,一个商务开发专家。- 外向、热情,擅长建立关系- 对商业机会敏感,行动导向- 邮件专业但不刻板Angela(市场):
# Soul你是 Angela,一个市场营销专家。- 活泼、有创意,对社交媒体趋势敏感- 数据驱动,对品牌一致性有执念- 内容保持品牌调性Bob(编码):
# Soul你是 Bob,一个资深全栈工程师。- 严谨、注重细节,不喜欢过度设计- 遇到问题给 2-3 个方案- 代码变更要有测试,安全问题零容忍你:@milo 帮我分析一下 SaaS 产品定价策略
Milo:收到。让我用价值定价框架来分析...
你:@josh 根据 Milo 的分析,帮我写一封给投资人的邮件
Josh:好的,结合 Milo 的分析...
你:@angela 定价确定了,帮我准备 Product Hunt launch 文案
Angela:太好了!让我看看产品特点...
你:@bob 帮我实现定价页面的前端代码
Bob:收到,让我先搭好组件结构...17.2 代码审查 Agent + GitHub Webhook
Section titled “17.2 代码审查 Agent + GitHub Webhook”配置代码审查 Agent
Section titled “配置代码审查 Agent”{ agents: { list: [ { id: "reviewer", workspace: "~/.openclaw/workspace-reviewer", model: { primary: "minimax/MiniMax-M2.5" }, // 代码审查用更强的模型 }, ], },}workspace-reviewer/SOUL.md:
# Soul你是一个严格的代码审查员。- 检查代码风格、最佳实践、潜在 bug、安全问题- 问题分级:CRITICAL / HIGH / MEDIUM / LOW- 给出具体的修复建议,附代码示例- 认可写得好的代码,不只是挑毛病GitHub Webhook 集成
Section titled “GitHub Webhook 集成”设置 GitHub Webhook 在 PR 创建时触发审查:
# GitHub Webhook → OpenClaw /hooks/agentcurl -X POST http://your-server:18789/hooks/agent \ -H "Content-Type: application/json" \ -d '{ "agentId": "reviewer", "message": "请审查 PR #42: https://github.com/example/repo/pull/42" }'Agent 收到后会:
- 通过浏览器访问 PR 页面
- 阅读代码变更
- 生成审查报告
- 发送到指定渠道(或直接在 PR 上评论)
17.3 客服 Agent + FAQ 知识库
Section titled “17.3 客服 Agent + FAQ 知识库”{ agents: { list: [ { id: "support", workspace: "~/.openclaw/workspace-support", }, ], }, bindings: [ { agentId: "support", match: { channel: "discord", peer: { kind: "channel", id: "SUPPORT_CHANNEL_ID" } } }, ],}FAQ 知识库
Section titled “FAQ 知识库”在 workspace-support/AGENTS.md 中维护 FAQ:
# Operating Instructions
## FAQ 知识库
### 账户相关Q: 如何注册?A: 访问 https://example.com/signup,填写邮箱和密码即可。
Q: 如何重置密码?A: 点击登录页的"忘记密码",输入注册邮箱。
### 技术支持Q: API 限流规则?A: 免费版 100 次/分钟,专业版 1000 次/分钟。
Q: 支持哪些编程语言?A: 提供 Python、Node.js、Go、Java 的 SDK。
## 工作流程1. 理解用户问题2. 先在 FAQ 中查找答案3. 如果没有,尝试从文档中查找4. 如果还是无法解决,告知用户提交工单17.4 Discord 多频道协作
Section titled “17.4 Discord 多频道协作”利用 Bindings 将 Discord 不同频道路由到不同 Agent:
{ bindings: [ { agentId: "support", match: { channel: "discord", peer: { kind: "channel", id: "SUPPORT_CHANNEL_ID" } } }, { agentId: "reviewer", match: { channel: "discord", peer: { kind: "channel", id: "CODE_REVIEW_CHANNEL_ID" } } }, { agentId: "milo", match: { channel: "discord", peer: { kind: "channel", id: "STRATEGY_CHANNEL_ID" } } }, { agentId: "bob", match: { channel: "discord", peer: { kind: "channel", id: "DEV_CHANNEL_ID" } } }, ],}每个频道对应一个专业 Agent:
#support→ 客服 Agent#code-review→ 代码审查 Agent#strategy→ 策略 Agent#dev→ 编码 Agent
17.5 权限隔离 + 成本分摊
Section titled “17.5 权限隔离 + 成本分摊”不同 Agent 配置不同的 Sandbox 和 Exec 权限:
{ agents: { list: [ { id: "support", workspace: "~/.openclaw/workspace-support", // 客服只需要对话能力,可通过 tools.allow/deny 限制 }, { id: "bob", workspace: "~/.openclaw/workspace-bob", // 编码 Agent 需要完整工具集(tools.profile 在顶层设置) }, ], },}通过模型选择控制不同 Agent 的成本:
{ agents: { list: [ { id: "support", model: { primary: "deepseek/deepseek-v3.2" }, // 客服用便宜的模型 }, { id: "reviewer", model: { primary: "minimax/MiniMax-M2.5" }, // 审查用更强的模型 }, ], },}17.6 小结
Section titled “17.6 小结”| 场景 | 方案 |
|---|---|
| Solo Founder | 4 Agent 虚拟团队,Telegram 群组协作 |
| 代码审查 | 专用 Agent + GitHub Webhook |
| 客服 | FAQ 知识库 Agent + Discord 频道 |
| 多频道协作 | Bindings 按频道路由到不同 Agent |
| 权限控制 | Tool profiles + 模型分级 |
至此,实战篇全部完成。附录中提供了配置参考、CLI 速查、FAQ、踩坑记录等工具性内容。