OpenClaw飞书:快速搭建5个协作AI助理团队指南

2026-06-11阅读 0热度 0
OpenClaw

如何让多个 AI 助理各司其职、高效协作,而非依赖一个“万能助手”包揽一切?这恰恰是团队引入 AI 工具后最常见的真实痛点。

借助 OpenClaw 的多 Agent 架构,完全能够实现这样的场景:多个独立的飞书机器人,每个拥有专属角色定义;各自配备独立工作空间,数据完全隔离;而在需要时,通过 agentToAgent 通信机制无缝协作、共享长期记忆,实现跨渠道信息同步。

本文从腾讯云服务器部署起步,带你完整走通流程——配置 5 个不同角色的飞书 Agent,剖析常见踩坑问题,并展示实战协作案例,一次性讲透。


为什么需要多 Agent

与“什么都会”的通用 AI 相比,多 Agent 架构的核心价值在于两点:专业化分工,以及由此带来的协作效率飞跃。

单一 AI 的局限

诚然,通用 AI 能应对多种任务,但一旦场景复杂化,短板便暴露无遗:

  • 记忆容量有限——难以同时维护多个专业领域信息,讨论 A 领域时,B 领域细节可能丢失。
  • 上下文容易混乱——不同类型数据混合在同一上下文中,相互干扰,回答容易“串味”。
  • 缺乏持续追踪能力——无法长期独立跟踪特定领域任务进展,今天沟通完,明天就忘了进度。

多 Agent 的优势

多 Agent 架构的逻辑十分简洁:专业化分工 + 协作。每个 Agent 只聚焦自身领域,通过 agentToAgent 机制高效沟通,各司其职,各展所长。


前置准备

1. 腾讯云轻量应用服务器

  • 建议配置:前期选最低配,2 核 2GB 足够起步
  • 镜像选择:OpenClaw

2. 飞书开发者账号


5 个 Agent 角色设计

从实际业务出发,可以设计以下 5 个 Agent,各自承担明确职责:

Agent ID名称职责
aiboss大总管总协调助手,负责协调其他 Agent 和日常任务
ainews资讯助理AI 行业资讯收集,每日 8:00 和 18:00 推送
aicontent内容助理文章写作、视频脚本、社交媒体内容
aicode代码助理代码审查、技术方案、问题解决
aitask任务助理任务跟踪、提醒、进度管理

配置飞书多应用

步骤 1:创建 5 个飞书应用

  1. 登录飞书开放平台
  2. 进入“应用管理” → “创建应用” → “自建应用”
  3. 填写应用信息:
    • 应用名称:如“AI大总管”、“AI资讯助理”
    • 应用描述:简要说明该 Agent 的职责
    • 应用图标:建议每个 Agent 使用不同图标,便于区分
  4. 点击“创建”

重复以上步骤,依次创建 5 个独立应用。

步骤 2:获取应用凭证(必须先完成)

对于每个应用,在“凭证与基础信息”页面获取并记录以下信息:

  • App ID:格式如 cli_xxx
  • App Secret:格式如 i63Qyyyyy
Agent应用名称App IDApp Secret
aibossAI大总管cli_xxxxxxxxxxxxxyour_app_secret_here
aicontentAI内容助理cli_xxxxxxxxxxxxxyour_app_secret_here
ainewsAI资讯助理cli_xxxxxxxxxxxxxyour_app_secret_here
aicodeAI代码助理cli_xxxxxxxxxxxxxyour_app_secret_here
aitaskAI任务助理cli_xxxxxxxxxxxxxyour_app_secret_here

步骤 3:配置应用能力(⚠️ 关键步骤)

OpenClaw 配置完成后,需要对每个应用完成以下配置:

3.1 开启机器人能力

  1. 进入应用详情 → “权限管理”
  2. 开启“机器人能力”
  3. 添加必要的权限:
    • im:message(接收消息)
    • im:message:group_at_msg(接收群组 @ 消息)
    • im:message:send_as_bot(发送消息)

3.2 配置事件订阅(⚠️ 长连接)

  1. 进入“事件订阅”
  2. 选择“长连接”模式
  3. 启用以下事件:
    • im.message.receive_v1(接收消息)
    • im.message.message_read_v1(消息已读)

3.3 发布应用

  1. 进入“版本管理与发布”
  2. 创建新版本
  3. 填写更新日志
  4. 发布(可选择“开发版”或“正式版”)

OpenClaw 多 Agent 配置

部署方式选择

本文使用腾讯云轻量应用服务器的 OpenClaw 镜像进行部署。具体流程如下:

1. 购买腾讯云轻量应用服务器

参照前置准备购买服务器,进入控制台 → 概要。腾讯提供的 OpenClaw WEB 配置界面(控制台 → 应用管理)如下,但由于不支持多 Agent 配置,本文直接修改服务器上的配置文件。

2. 配置模型

以 GLM-4.7 为例,进入控制台 → 应用管理,选择智普 AI Coding Plan,输入 KEY 保存即可。

3. 登录服务器

根据实际配置选择对应的登录方式,进入服务器后台。

4. 验证 OpenClaw 安装

# 检查 OpenClaw 版本
openclaw --version
# 查看 Gateway 状态
openclaw gateway status

5. 配置方式选择

腾讯云 OpenClaw 镜像支持两种配置方式:

配置方式优点缺点适用场景
Web 界面配置可视化操作,简单直观功能有限,不支持高级配置快速体验、简单场景
直接编辑 JSON完整功能、灵活强大需要了解 JSON 格式自定义配置、多 Agent 等

本次采用直接编辑 openclaw.json 的方式,原因有二:Web 界面不支持多 Agent 高级配置;JSON 配置更灵活,能实现完整功能。

# 打开配置文件
vi /root/.openclaw/openclaw.json

配置完成后,重启 Gateway 使配置生效:

openclaw gateway restart

步骤 1:创建独立 Workspace

每个 Agent 都需要独立的工作空间,确保数据完全隔离:

# 创建 5 个独立工作区
mkdir -p /root/.openclaw/workspace-boss
mkdir -p /root/.openclaw/workspace-news
mkdir -p /root/.openclaw/workspace-content
mkdir -p /root/.openclaw/workspace-code
mkdir -p /root/.openclaw/workspace-task

步骤 2:编辑 openclaw.json

打开配置文件:

vi /root/.openclaw/openclaw.json

2.1 配置 agents 数组

agents 字段中添加 5 个 Agent:

"agents": {
  "list": [
    {
      "id": "aiboss",
      "default": true,
      "name": "aiboss",
      "workspace": "/root/.openclaw/workspace-boss",
      "model": {
        "primary": "glmcode/glm-4.7"
      }
    },
    {
      "id": "aicontent",
      "name": "aicontent",
      "workspace": "/root/.openclaw/workspace-aicontent",
      "model": {
        "primary": "glmcode/glm-4.7"
      }
    },
    {
      "id": "ainews",
      "name": "ainews",
      "workspace": "/root/.openclaw/workspace-ainews",
      "model": {
        "primary": "glmcode/glm-4.7"
      }
    },
    {
      "id": "aicode",
      "name": "aicode",
      "workspace": "/root/.openclaw/workspace-aicode",
      "model": {
        "primary": "glmcode/glm-4.7"
      }
    },
    {
      "id": "aitask",
      "name": "aitask",
      "workspace": "/root/.openclaw/workspace-aitask",
      "model": {
        "primary": "glmcode/glm-4.7"
      }
    }
  ]
}

2.2 配置飞书多账户

channels.feishu 字段中添加 5 个账户:

"channels": {
  "feishu": {
    "enabled": true,
    "accounts": {
      "aiboss": {
        "appId": "cli_xxxxxxxxxxxxx",
        "appSecret": "your_app_secret_here"
      },
      "aicontent": {
        "appId": "cli_xxxxxxxxxxxxx",
        "appSecret": "your_app_secret_here"
      },
      "ainews": {
        "appId": "cli_xxxxxxxxxxxxx",
        "appSecret": "your_app_secret_here"
      },
      "aitask": {
        "appId": "cli_xxxxxxxxxxxxx",
        "appSecret": "your_app_secret_here"
      },
      "aicode": {
        "appId": "cli_xxxxxxxxxxxxx",
        "appSecret": "your_app_secret_here"
      }
    }
  }
}

2.3 配置 bindings 路由

bindings 数组中添加消息路由规则:

"bindings": [
  {
    "match": {
      "channel": "feishu",
      "accountId": "aiboss"
    },
    "agentId": "aiboss"
  },
  {
    "match": {
      "channel": "feishu",
      "accountId": "aicontent"
    },
    "agentId": "aicontent"
  },
  {
    "match": {
      "channel": "feishu",
      "accountId": "ainews"
    },
    "agentId": "ainews"
  },
  {
    "match": {
      "channel": "feishu",
      "accountId": "aicode"
    },
    "agentId": "aicode"
  },
  {
    "match": {
      "channel": "feishu",
      "accountId": "aitask"
    },
    "agentId": "aitask"
  }
]

2.4 开启 agentToAgent 通信

tools 字段中配置:

"tools": {
  "agentToAgent": {
    "enabled": true,
    "allow": ["aiboss", "aicontent", "ainews", "aicode", "aitask"]
  }
}

步骤 3:为每个 Agent 创建核心文件

在每个 workspace 中创建以下文件。

3.1 IDENTITY.md(身份信息)

# 以 aiboss 为例
cat > /root/.openclaw/workspace-boss/IDENTITY.md << 'EOF'
# IDENTITY.md - AIBoss
- **Name**: AIBoss
- **Role**: 大总管,团队协调者
- **Emoji**: ????
- **Vibe**: 专业、高效、有条理
EOF

3.2 SOUL.md(人设和行为准则)

cat > /root/.openclaw/workspace-boss/SOUL.md << 'EOF'
# SOUL.md - AIBoss
你是 AIBoss,大总管,负责团队协调和任务管理。

## 核心职责
- 团队协调和任务分发
- 项目进度跟踪
- 跨 Agent 协作调度

## 工作流程
1. 接收用户需求
2. 分析任务类型
3. 分发给对应的 Agent
4. 跟踪任务进度
5. 汇总结果给用户

## 协作方式
需要其他 Agent 协作时,使用 sessions_send 工具:
- 需要最新资讯?→ sessions_send(agentId="ainews", message="...")
- 需要内容产出?→ sessions_send(agentId="aicontent", message="...")
- 需要技术支持?→ sessions_send(agentId="aicode", message="...")
- 需要任务提醒?→ sessions_send(agentId="aitask", message="...")
EOF

3.3 AGENTS.md(团队成员通讯录)

cat > /root/.openclaw/workspace-boss/AGENTS.md << 'EOF'
# AGENTS.md - 团队成员
- **AIBoss** (你) - 大总管
  - agentId: aiboss
  - 职责:团队协调、任务分发
- **AINews** - 资讯助理
  - agentId: ainews
  - 职责:AI 行业资讯收集、每日推送
- **AIContent** - 内容助理
  - agentId: aicontent
  - 职责:文章写作、视频脚本、社交媒体内容
- **AICode** - 代码助理
  - agentId: aicode
  - 职责:代码审查、技术方案、问题解决
- **AITask** - 任务助理
  - agentId: aitask
  - 职责:任务跟踪、提醒、进度管理
EOF

3.4 MEMORY.md(长期记忆)

cat > /root/.openclaw/workspace-boss/MEMORY.md << 'EOF'
# MEMORY.md - AIBoss 长期记忆

## 项目记录
### 2026-02-23
- 完成飞书多 Agent 系统搭建
- 5 个 Agent 全部上线

## 重要决策
- 使用 OpenClaw 框架
- 部署在腾讯云服务器
- 飞书作为主要沟通渠道
EOF

重复以上步骤,为其他 4 个 Agent 创建对应文件。

步骤 4:重启 OpenClaw Gateway

# 重启 Gateway 使配置生效
openclaw gateway restart
# 查看 Gateway 状态
openclaw gateway status
# 查看日志(确认 Agent 启动)
openclaw logs --follow

踩坑与解决方案

配置过程中容易遇到一些常见问题,这里整理了 6 个典型坑位及解决方案。

坑 1:Bot 无法上线

症状:飞书应用配置完成,但 Bot 状态一直是离线。
原因:未配置“长连接事件订阅”。
解决方案:进入飞书开放平台 → 应用详情 → “事件订阅”,选择“长连接”模式,启用 im.message.receive_v1 事件,保存并发布应用。


坑 2:Agent 无法协作

症状:Agent 之间无法通信,协作请求失败。
原因:未配置 AGENTS.md 团队成员列表,Agent 不知道彼此的存在。
解决方案:在每个 Agent 的 workspace 中创建 AGENTS.md,列出所有团队成员。

# AGENTS.md - 团队成员
- **AIBoss** - agentId: aiboss
- **AINews** - agentId: ainews
- **AIContent** - agentId: aicontent
- **AICode** - agentId: aicode
- **AITask** - agentId: aitask

坑 3:Workspace 数据混乱

症状:不同 Agent 的数据出现混乱或覆盖。
原因:多个 Agent 共用同一个 workspace 路径。
解决方案:确保每个 Agent 的 workspace 路径独立且不重复。

{
  "workspace": "/root/.openclaw/workspace-boss"
  // 每个 Agent 独立路径
}

坑 4:消息路由错误

症状:发给某个 Agent 的消息被路由到了其他 Agent。
原因bindings 配置中的 accountIdagentId 不匹配。
解决方案:检查 bindings 数组,确保每个飞书账户的 accountId 正确对应到目标 agentId

{
  "match": {
    "channel": "feishu",
    "accountId": "aicode"  // 飞书账户标识
  },
  "agentId": "aicode"      // 目标 Agent ID
}

坑 5:ID 大小写导致配置失效

症状:配置完成后,Agent 无法启动或消息无法路由。
原因:agent、channels 等 ID 定义使用了大小写混合(如 AIContentaIBoss),OpenClaw 不能正常处理。
解决方案:确保所有 ID 定义都是纯小写字母。

// ✅ 正确 - 全小写
{"id": "aiboss", "name": "aiboss"}
// ❌ 错误 - 大小写混合
{"id": "AIBoss", "name": "AIContent"}  // 错误!

影响范围

  • agents.list[].id - Agent ID 必须小写
  • channels.feishu.accounts 的 key - 账户标识必须小写
  • bindings[].agentId - Agent ID 引用必须小写
  • channels.feishu.accounts 的 key - 必须与 bindings 中的 accountId 对应(全小写)

检查清单

  • 所有 Agent ID 都是纯小写(如 aibossaicontent
  • 飞书账户标识都是纯小写(如 aibossainews
  • bindings 中的 accountIdagentId 都是纯小写

验证与测试

配置完成后,按以下步骤验证。

1. 检查 Agent 状态

# 查看 Agent 运行状态
openclaw status

期望输出:

Agent: aiboss   Status: running ✅
Agent: aicontent Status: running ✅
Agent: ainews   Status: running ✅
Agent: aicode   Status: running ✅
Agent: aitask   Status: running ✅

2. 单 Agent 测试

首次使用需要配对。第一次向 Bot 发送消息时,会收到配对提示:

OpenClaw: access not configured.
Your Feishu user id: ou_xxx
Pairing code: xxxx
Ask the bot owner to approve with:
openclaw pairing approve feishu xxxx

在服务器上执行批准命令:

openclaw pairing approve feishu xxxx

批准后即可正常聊天。

测试消息

在飞书中向每个 Bot 发送测试消息:

  • AIBoss:“你好,你是谁?”
  • AINews:“今天有什么 AI 资讯?”
  • AIContent:“帮我写一个文章大纲”
  • AICode:“这段代码有什么问题?”
  • AITask:“创建一个任务提醒”

3. Agent 间协作测试

在飞书中 @AIBoss,让它调用其他 Agent:

@AIBoss 帮我让 AINews 推送今天的 AI 资讯

AIBoss 应该能够:

  1. 接收你的指令
  2. 调用 sessions_send 联系 AINews
  3. AINews 执行并返回结果
  4. AIBoss 汇总结果给你

4. 检查清单

  • 5 个飞书应用全部发布
  • OpenClaw Gateway 运行正常
  • 5 个 Agent 状态全部显示 running
  • 单独向每个 Bot 发送测试消息
  • 测试 Agent 间协作

5. 最终效果


总结

通过 OpenClaw 的多 Agent 架构,在腾讯云服务器上即可快速搭建 5 个专业化 AI 助理。每个 Agent 拥有独立工作空间,通过飞书实现无缝协作。感兴趣的话可以上手试一试。


附录:完整 openclaw.json 示例
{
  "meta": {
    "lastTouchedVersion": "2026.2.9",
    "lastTouchedAt": "2026-02-21T06:24:18.113Z"
  },
  "wizard": {
    "lastRunAt": "2026-02-11T09:47:49.711Z",
    "lastRunVersion": "2026.2.9",
    "lastRunCommand": "onboard",
    "lastRunMode": "local"
  },
  "tools": {
    "agentToAgent": {
      "enabled": true,
      "allow": ["aiboss", "aicontent", "ainews", "aicode", "aitask"]
    }
  },
  "agents": {
    "list": [
      {
        "id": "aiboss",
        "default": true,
        "name": "aiboss",
        "workspace": "/root/.openclaw/workspace-boss",
        "model": {
          "primary": "glmcode/glm-4.7"
        }
      },
      {
        "id": "aicontent",
        "name": "aicontent",
        "workspace": "/root/.openclaw/workspace-aicontent",
        "model": {
          "primary": "glmcode/glm-4.7"
        }
      },
      {
        "id": "ainews",
        "name": "ainews",
        "workspace": "/root/.openclaw/workspace-ainews",
        "model": {
          "primary": "glmcode/glm-4.7"
        }
      },
      {
        "id": "aicode",
        "name": "aicode",
        "workspace": "/root/.openclaw/workspace-aicode",
        "model": {
          "primary": "glmcode/glm-4.7"
        }
      },
      {
        "id": "aitask",
        "name": "aitask",
        "workspace": "/root/.openclaw/workspace-aitask",
        "model": {
          "primary": "glmcode/glm-4.7"
        }
      }
    ]
  },
  "bindings": [
    {
      "match": {
        "channel": "feishu",
        "accountId": "aiboss"
      },
      "agentId": "aiboss"
    },
    {
      "match": {
        "channel": "feishu",
        "accountId": "aicontent"
      },
      "agentId": "aicontent"
    },
    {
      "match": {
        "channel": "feishu",
        "accountId": "ainews"
      },
      "agentId": "ainews"
    },
    {
      "match": {
        "channel": "feishu",
        "accountId": "aicode"
      },
      "agentId": "aicode"
    },
    {
      "match": {
        "channel": "feishu",
        "accountId": "aitask"
      },
      "agentId": "aitask"
    }
  ],
  "messages": {
    "ackReactionScope": "group-mentions"
  },
  "commands": {
    "native": "auto",
    "nativeSkills": "auto"
  },
  "gateway": {
    "port": 18789,
    "mode": "local",
    "bind": "loopback",
    "controlUi": {
      "allowInsecureAuth": false
    },
    "auth": {
      "mode": "token",
      "token": "***REDACTED***"
    },
    "tailscale": {
      "mode": "off",
      "resetOnExit": false
    }
  },
  "skills": {
    "install": {
      "nodeManager": "npm"
    }
  },
  "plugins": {
    "entries": {
      "feishu": {
        "enabled": true
      },
      "qqbot": {
        "enabled": true
      },
      "ddingtalk": {
        "enabled": true
      },
      "wecom": {
        "enabled": true
      },
      "adp-openclaw": {
        "enabled": true
      }
    },
    "installs": {
      "qqbot": {
        "source": "npm",
        "spec": "@sliverp/qqbot@latest",
        "installPath": "/root/.openclaw/extensions/qqbot",
        "version": "1.4.4",
        "installedAt": "2026-02-11T09:48:41.090Z"
      },
      "feishu": {
        "source": "npm",
        "spec": "@openclaw/feishu",
        "installPath": "/root/.openclaw/extensions/feishu",
        "version": "2026.02.22",
        "installedAt": "2026-02-22T09:48:41.090Z"
      },
      "ddingtalk": {
        "source": "npm",
        "spec": "git+https://cnb.cool/lighthouse/lighthousebackend/openclaw-dingtalk.git",
        "installPath": "/root/.openclaw/extensions/ddingtalk",
        "version": "1.2.0",
        "installedAt": "2026-02-11T09:49:01.618Z"
      },
      "wecom": {
        "source": "npm",
        "spec": "git+https://cnb.cool/lighthouse/lighthousebackend/openclaw-wecom.git",
        "installPath": "/root/.openclaw/extensions/wecom",
        "version": "2026.2.5",
        "installedAt": "2026-02-11T09:49:25.555Z"
      },
      "adp-openclaw": {
        "source": "npm",
        "spec": "adp-openclaw",
        "installPath": "/root/.openclaw/extensions/adp-openclaw",
        "version": "0.0.24",
        "installedAt": "2026-02-11T09:49:33.241Z"
      }
    }
  },
  "models": {
    "providers": {
      "glmcode": {
        "baseUrl": "https://open.bigmodel.cn/api/anthropic",
        "apiKey": "***REDACTED***",
        "api": "anthropic-messages",
        "models": [
          {
            "id": "glm-4.7",
            "name": "GLM-4.7"
          },
          {
            "id": "glm-5",
            "name": "GLM-5"
          },
          {
            "id": "glm-4.6",
            "name": "GLM-4.6"
          },
          {
            "id": "glm-4.5-air",
            "name": "GLM-4.5-Air"
          },
          {
            "id": "glm-4.5",
            "name": "GLM-4.5"
          }
        ]
      }
    },
    "mode": "merge"
  },
  "channels": {
    "qqbot": {
      "enabled": true,
      "appId": "10xxxxxx",
      "clientSecret": "***REDACTED***"
    },
    "feishu": {
      "enabled": true,
      "accounts": {
        "aiboss": {
          "appId": "cli_xx",
          "appSecret": "***REDACTED***"
        },
        "aicontent": {
          "appId": "cli_xx",
          "appSecret": "***REDACTED***"
        },
        "ainews": {
          "appId": "cli_xx",
          "appSecret": "***REDACTED***"
        },
        "aitask": {
          "appId": "cli_xx",
          "appSecret": "***REDACTED***"
        },
        "aicode": {
          "appId": "cli_xx",
          "appSecret": "***REDACTED***"
        }
      }
    }
  }
}
免责声明

本网站新闻资讯均来自公开渠道,力求准确但不保证绝对无误,内容观点仅代表作者本人,与本站无关。若涉及侵权,请联系我们处理。本站保留对声明的修改权,最终解释权归本站所有。

相关阅读

更多
欢迎回来 登录或注册后,可保存提示词和历史记录
登录后可同步收藏、历史记录和常用模板
注册即表示同意服务条款与隐私政策