5.10 多代理路由

OpenClaw 的多代理路由系统允许您运行多个隔离的 agent,每个 agent 都有自己的工作空间、会话和配置。

隔离的 Agent

每个 agent 都是完全隔离的:

  • 独立的工作空间
  • 独立的 agentDir
  • 独立的会话存储
  • 独立的沙盒和工具策略

通过绑定路由

使用 bindings 将频道/账户/对等方映射到 agent:

{
  agents: {
    list: [
      { id: "personal", workspace: "~/.openclaw/workspace-personal" },
      { id: "work", workspace: "~/.openclaw/workspace-work" }
    ]
  },
  bindings: [
    { match: { channel: "telegram" }, agentId: "personal" },
    { match: { channel: "slack", teamId: "T123" }, agentId: "work" }
  ]
}

使用场景

WhatsApp/Telegram 分离

为不同的消息平台使用不同的 agent:

bindings: [
  { match: { channel: "whatsapp" }, agentId: "personal" },
  { match: { channel: "telegram" }, agentId: "work" }
]

DM/群组定位

为直接消息和群组使用不同的 agent:

bindings: [
  { match: { channel: "slack", peer: { kind: "dm" } }, agentId: "personal" },
  { match: { channel: "slack", peer: { kind: "group" } }, agentId: "support" }
]

安全策略

每个 agent 可以有不同的工具限制和沙盒设置:

{
  agents: {
    list: [
      {
        id: "restricted",
        sandbox: { enabled: true },
        tools: { exec: { enabled: false } }
      },
      {
        id: "trusted",
        sandbox: { enabled: false },
        tools: { exec: { enabled: true } }
      }
    ]
  }
}
提示
多代理路由允许您为不同的使用场景创建专门的 agent,每个都有适当的权限和配置。