OpenClaw 多飞书机器人配置指南:一个 Gateway 运行多个 Agent

AI摘要

OpenClaw Gateway支持配置多个飞书机器人并绑定不同Agent。通过在channels.feishu.accounts中定义多个机器人账号,并在bindings中根据accountId将消息路由到对应的Agent(如main或wp),实现单网关多机器人的灵活管理。配置过程包括创建Agent、修改配置文件为多账号结构、设置路由绑定三个关键步骤。

之前我写过一篇文章介绍 OpenClaw 多 Agent 架构,有读者问:一个 Gateway 能不能配置多个飞书机器人?每个机器人绑定到不同的 Agent?

答案是可以的!本文记录我的配置过程。

┌─────────────────────────────────────┐
│           1 个 Gateway              │
│  ┌─────────────────────────────┐   │
│  │   channels.feishu.accounts  │   │
│  │   ├── main (机器人1)         │   │
│  │   └── wp   (机器人2)         │   │
│  └─────────────────────────────┘   │
│                                     │
│  ┌───────┐ ┌───────┐              │
│  │ main  │ │  wp   │              │
│  │ Agent │ │ Agent │              │
│  └───────┘ └───────┘              │
│                                     │
│  bindings 路由消息到不同 Agent      │
└─────────────────────────────────────┘

核心概念:

  • 1 个 Gateway
  • 1 个 channels.feishu 配置块
  • 多个 accounts(每个飞书机器人一个)
  • 通过 bindings + accountId 路由到不同 Agent

首先创建 WP Agent:

openclaw agents add wp \
  --workspace ~/.openclaw/workspace-wp \
  --model zai/glm-5

编辑 ~/.openclaw/openclaw.json,将飞书配置从单账号改为多账号。

修改前(单账号):

{
  "channels": {
    "feishu": {
      "enabled": true,
      "appId": "cli_xxxxxxxxxxxxxxxx",
      "appSecret": "your_app_secret_here",
      "dmPolicy": "allowlist",
      "allowFrom": ["ou_xxxxxxxxxxxx"]
    }
  }
}

修改后(多账号):

{
  "channels": {
    "feishu": {
      "enabled": true,
      "accounts": {
        "main": {
          "appId": "cli_xxxxxxxxxxxxxxxx",
          "appSecret": "your_main_bot_secret"
        },
        "wp": {
          "appId": "cli_yyyyyyyyyyyyyyyy",
          "appSecret": "your_wp_bot_secret"
        },
        "default": {
          "dmPolicy": "allowlist",
          "allowFrom": ["ou_xxxxxxxxxxxx"],
          "groupPolicy": "allowlist",
          "groupAllowFrom": ["oc_xxxxxxxxxxxx"]
        }
      },
      "heartbeat": {"showOk": true, "showAlerts": true},
      "stt": {"provider": "siliconflow", "model": "FunAudioLLM/SenseVoiceSmall"},
      "streaming": true,
      "footer": {"elapsed": true, "status": true},
      "connectionMode": "websocket",
      "domain": "feishu"
    }
  }
}

注意:

  • accounts.mainaccounts.wp 是两个飞书机器人
  • accounts.default 存放共享配置(dmPolicy、allowFrom 等)
  • 其他配置(heartbeat、stt、streaming)保持在外层

添加 bindings 配置,将不同账号路由到不同 Agent:

{
  "bindings": [
    {
      "type": "route",
      "agentId": "main",
      "match": {
        "channel": "feishu",
        "accountId": "main"
      }
    },
    {
      "type": "route",
      "agentId": "wp",
      "match": {
        "channel": "feishu",
        "accountId": "wp"
      }
    }
  ]
}

# 验证 JSON 格式
node -e "JSON.parse(require('fs').readFileSync('$HOME/.openclaw/openclaw.json', 'utf8')); console.log('OK')"

# 运行 doctor 自动修复格式
openclaw doctor --fix

# 查看绑定关系
openclaw agents list --bindings

输出应该类似:

Agents:
- main (default)
  Routing rules:
    - feishu accountId=main
- wp
  Routing rules:
    - feishu accountId=wp

systemctl --user restart openclaw-gateway

A: 当前版本的 channels add 命令不支持飞书的 --app-id--app-secret 参数,需要手动编辑配置文件。

A: 不会。消息根据 accountId 路由到对应的 Agent。给机器人1发消息 → main Agent 回复;给机器人2发消息 → wp Agent 回复。

A: 在飞书里分别给两个机器人发消息,看回复的"人格"是否不同(如果配置了不同的 SOUL.md)。

方案 Gateway 飞书机器人 配置方式
单 Agent 单机器人 1 1 默认配置
多 Agent 单机器人 1 1 bindings 按 peer 路由
多 Agent 多机器人 1 accounts + bindings 按 accountId 路由

一个 Gateway 可以配置多个飞书机器人,每个机器人绑定到不同的 Agent,实现真正的"独立团"模式。

Saiita

我还没有学会写个人说明!

相关推荐

#8 OpenClaw 多渠道管理

OpenClaw是一个支持同时接入飞书、Telegram、钉钉、Discord、WhatsApp等多平台消息渠道的AI助手网关。它通过统一配置实现多渠道管理,允许将不同性格与功能的Agent绑定至特定渠道,并自动适配各平台的消息格式。系统提供群聊防刷屏、静默时段等策略,确保在不同场景下提供恰当、一致的服务体验。

OpenClaw v2026.4.10:新增 Active Memory 自动记忆、Codex 原生支持、本地 MLX 语音

OpenClaw v2026.4.10版本带来了多项重要更新。核心亮点是全新的Active Memory插件,它能自动管理用户偏好和历史上下文,实现“无感记忆”,显著提升长期对话体验。同时,版本原生集成了Codex,方便开发者直接进行编程任务。针对macOS用户,新增了实验性的本地MLX语音支持,提供更低延迟和更好隐私的语音对话。其他更新还包括视频生成模型支持、Microsoft Teams功能增强、CLI

暂无评论