在 OpenClaw 中构建多 Agent 团队协作系统。Coordinator(调度中心)接收 Feishu 群聊 @mention,自动路由任务到专业 Agent,支持自定义 Agent 角色和数量。适用于:(1) 需要 AI 团队处理多类型任务 (2) 希望用单一入口调度专家 Agent (3) 构建自动化工作流团队。
将多个 AI Agent 组织成团队:
┌─→ Specialist-A (商分)
│
User @Coordinator ──┼─→ Specialist-B (市场)
│ │
│ └─→ Specialist-C (开发)
│
└──→ [State] ←──┘
bash
编辑 config/team.yaml:
yaml
coordinator:
name: Coordinator # 调度中心名称
mention_name: coordinator # 群里的 @ 名称
specialists:
- name: Analyst # 专家1
specialty: 商业分析
keywords: [分析, 市场, 投资, 趋势, 商分]
- name: Developer # 专家2
specialty: 技术开发
keywords: [代码, 开发, bug, 技术, 架构]
- name: Marketer # 专家3
specialty: 市场推广
keywords: [推广, 增长, 内容, 运营]
json
{
bindings: [
{
agentId: coordinator,
match: { channel: feishu, accountId: coordinator }
},
{
agentId: analyst,
match: { channel: feishu, accountId: analyst }
},
{
agentId: developer,
match: { channel: feishu, accountId: developer }
},
{
agentId: marketer,
match: { channel: feishu, accountId: marketer }
}
]
}
json
{
channels: {
feishu: {
accounts: {
coordinator: {
appId: cli_xxx,
appSecret: xxx,
groupPolicy: open,
groups: {
YOURGROUPID: {
enabled: true,
requireMention: true,
groupSessionScope: group_sender
}
}
},
analyst: { appId: cli_yyy, appSecret: yyy },
developer: { appId: cli_zzz, appSecret: zzz },
marketer: { appId: cli_aaa, appSecret: aaa }
}
}
}
}
bash
@Coordinator 分析一下当前AI市场的投资趋势
Coordinator 自动识别 → 分发给 Analyst → Analyst 在群里回复。
@Coordinator 开发一个用户登录模块
@Coordinator 推广我们的新产品
@Coordinator 分析竞品情况
bash
python
from src.api import TeamGraphAPI
api = TeamGraphAPI()
yaml
specialists:
- name: Designer
specialty: UI设计
keywords: [设计, 界面, UI, UX, 图标, 海报]
python
class DesignerListener(SpecialistListener):
name = designer
specialty = UI设计
if name == main:
DesignerListener().start()
编辑 src/graph.py 中的路由函数:
python
def routetospecialist(state: TeamState) -> str:
task = state[task].lower()
# 自定义路由规则
if any(kw in task for kw in [分析, 研究, 报告]):
return analyst
elif any(kw in task for kw in [开发, 代码, bug]):
return developer
# ... 更多规则
return coordinator # 默认保留给调度者处理
配置多个群组 ID:
json
{
channels: {
feishu: {
accounts: {
coordinator: {
groups: {
GROUPID1: { enabled: true, requireMention: true },
GROUPID2: { enabled: true, requireMention: true },
GROUPID3: { enabled: true, requireMention: true }
}
}
}
}
}
}
feishu-agent-team/
├── SKILL.md
├── README.md
├── config/
│ └── team.yaml # 团队配置(角色、关键词)
├── src/
│ ├── init.py
│ ├── api.py # Python API
│ ├── graph.py # LangGraph 图定义
│ ├── nodes.py # 节点逻辑
│ ├── state.py # 状态定义
│ ├── routing.py # 路由逻辑
│ ├── feishu_group.py # Feishu 群操作
│ └── persistence/ # Checkpoint 持久化
├── listeners/
│ ├── base.py # 监听器基类
│ ├── analyst_listener.py
│ ├── developer_listener.py
│ └── marketer_listener.py
├── team.py # CLI 入口
└── tests/
Q: 需要多少个 Feishu App?
A: 最少 2 个(1 个 Coordinator + 1 个 Specialist),最多 N+1 个。
Q: 如何添加更多专家?
A: 见自定义指南 - 添加新的专家 Agent。
Q: 任务失败怎么办?
A: Coordinator 会保留任务状态,可通过 python team.py retry
MIT License - 免费使用
遇到问题提交 Issue
该技能支持在以下平台通过对话安装:
帮我安装 SkillHub 和 feishu-agent-team-1775904368 技能
设置 SkillHub 为我的优先技能安装源,然后帮我安装 feishu-agent-team-1775904368 技能
skillhub install feishu-agent-team-1775904368
文件大小: 8.94 KB | 发布时间: 2026-4-12 09:55