OpenClaw 飞书多 Agent 配置实战指南
本教程将帮你快速在飞书上配置 OpenClaw 多 Agent 协作,支持产品经理、开发、项目经理等不同角色分流。
一、前置准备
# 1. 升级 OpenClaw 到最新版本
root@ubuntu:~# openclaw update
# 2. 启用飞书插件
openclaw plugins enable feishu
二、飞书应用配置
2.1 创建企业自建应用
-
登录 飞书开放平台
-
创建企业自建应用,填写:
- 应用名称:
瓜酱 - 应用描述:
openclaw 小助手
- 应用名称:
-
添加应用能力:机器人
2.2 配置应用权限
在权限管理中批量导入以下权限:
{
"scopes": {
"tenant": [
"im:message:send_as_bot",
"im:message:send_multi_users",
"im:message:readonly",
"im:chat:readonly",
"im:chat:update",
"docx:document",
"drive:file:upload",
"drive:file:download"
],
"user": [
"im:message",
"contact:user.base:readonly",
"wiki:node:read"
]
}
}
2.3 启用机器人能力
在应用能力 → 机器人页面:
- 开启机器人能力
- 配置机器人名称
三、OpenClaw 飞书配置
3.1 配置飞书参数
# 启用飞书插件
openclaw plugins enable feishu
# 配置应用凭证
export CLAW_FEISHU_APP_ID="你的App ID"
export CLAW_FEISHU_APP_SECRET="你的App Secret"
# 推荐使用 WebSocket 模式
export CLAW_FEISHU_CONNECTION_MODE="websocket"
export CLAW_FEISHU_DM_POLICY="open"
export CLAW_FEISHU_GROUP_POLICY="open"
# 重启网关
export CLAW_GATEWAY_RESTART="true"
3.2 调整安全策略
编辑 openclaw.json,调整安全模式:
{
"compaction": {
"mode": "default"
},
"tools": {
"profile": "full"
}
}
3.3 配置事件订阅
- 运行
openclaw channels add添加飞书渠道 - 确保网关已启动:
openclaw gateway status - 在飞书开放平台添加事件:
im.message.receive_v1 - 选择「使用长连接接收事件」(WebSocket 模式)
四、多 Agent 配置
4.1 创建 Agent
使用智能体向导创建隔离 Agent:
openclaw agents add insight # 产品经理 - 社区迭代规划
openclaw agents add dev # 开发 - 算法/应用开发
openclaw agents add ops # 项目经理 - 事项进度追踪
4.2 配置模型(推荐)
在 openclaw.json 中配置模型:
{
"models": {
"custom-ali": {
"baseUrl": "https://coding.dashscope.aliyuncs.com/v1",
"apiKey": "你的密钥",
"models": [
{"id": "MiniMax-M2.5", "name": "MiniMax-M2.5", "contextWindow": 200000},
{"id": "kimi-k2.5", "name": "Kimi 2.5", "input": ["text", "image"]},
{"id": "qwen3-coder-next", "name": "Qwen3-Coder", "reasoning": true}
]
}
}
}
4.3 绑定 Agent 到群聊
在 bindings 中配置消息路由:
{
"bindings": [
{
"type": "route",
"agentId": "insight",
"match": {
"channel": "feishu",
"accountId": "oc_产品规划群ID"
}
},
{
"type": "route",
"agentId": "dev",
"match": {
"channel": "feishu",
"accountId": "oc_开发群ID"
}
},
{
"type": "route",
"agentId": "ops",
"match": {
"channel": "feishu",
"accountId": "oc_项目群ID"
}
}
]
}
4.4 完整配置示例
{
"agents": {
"defaults": {
"model": {"primary": "custom-ali/MiniMax-M2.5"},
"workspace": "/Users/xgs/.openclaw/workspace"
},
"list": [
{"id": "insight", "name": "产品规划", "model": "MiniMax-M2.5"},
{"id": "dev", "name": "开发", "model": "kimi-k2.5"},
{"id": "ops", "name": "项目管理", "model": "MiniMax-M2.5"}
]
},
"channels": {
"feishu": {
"appId": "cli_xxx",
"appSecret": "xxx",
"enabled": true,
"connectionMode": "websocket",
"dmPolicy": "open",
"groupPolicy": "open"
}
}
}
五、验证
# 查看所有 Agent
openclaw agents list --bindings
# 检查网关状态
openclaw gateway status
配置完成后,在对应的飞书群聊中发送消息,即可自动路由到对应的 Agent 处理!