Phase 7 / Ep 32: 创建你的 Agent 军团 —— 专业化分工的多 Agent 架构

⏱ 预计阅读 4 分钟 更新于 2026/4/13

🎯 学习目标:设计和部署多 Agent 协作系统。

1. 四大 Agent 架构

graph TB
    subgraph Channels["用户入口"]
        TG["📱 Telegram"]
        DC["💬 Discord"]
        CLI["💻 CLI"]
    end

    subgraph Agents["Agent 军团"]
        PA["🧑‍💼 Personal Agent\nprofile: basic\n日常对话 · 提醒 · 日程"]
        CA["💻 Code Agent\nprofile: coding\n开发 · 测试 · 部署"]
        OA["🔧 Ops Agent\nprofile: full(容器内)\n运维 · 监控 · 告警"]
        RA["📚 Research Agent\nprofile: standard\n阅读 · 总结 · 翻译"]
    end

    TG --> PA
    DC -->|"#dev"| CA
    DC -->|"#ops"| OA
    CLI --> CA
    CLI --> RA

2. 创建全部 Agent

# 创建 Agent(personal 已默认存在)
openclaw agents add code-agent
openclaw agents add ops-agent
openclaw agents add research-agent

# 设置权限
openclaw agents config personal tools.profile basic
openclaw agents config code-agent tools.profile coding
openclaw agents config ops-agent tools.profile full
openclaw agents config research-agent tools.profile standard

# 绑定频道
openclaw agents bind personal telegram
openclaw agents bind code-agent cli
openclaw agents bind code-agent discord --channel dev
openclaw agents bind ops-agent discord --channel ops
openclaw agents bind research-agent cli

3. Agent 协作

Agent 之间可以相互调用:

你(Telegram)→ Personal Agent: "帮我调研一下 OpenClaw v4 的新功能"
Personal Agent → Research Agent: "请搜索 OpenClaw v4 changelog 并总结"
Research Agent → Personal Agent: "总结完成:1. 新增 XXX 2. 优化 YYY..."
Personal Agent → 你(Telegram): "调研结果:..."

4. 设计原则

原则 说明
单一职责 每个 Agent 专注一个领域
最小权限 按需分配权限等级
频道绑定 避免误触(ops 命令不应该出现在 personal 对话中)
独立记忆 每个 Agent 有独立的 memory 和 sessions

下节预告: Ep 33,通过 SOUL.md 定制 Agent 的人格和行为准则。