1、方式一:多智能体隔离
1.1 创建新智能体
openclaw agents add 你的智能体名称
1.2 系统配置,支持新智能体建立群聊
1、让机器人在特定群里主动发言(无需 @)
2、配置tool使用最大权限
各 Profile 详解
3、飞书创建群聊 1、创建群聊 2、拉入机器人 3、询问群id
4、openclaw配置群聊信息
bindings: [ { agentId: "alex", match: { channel: "whatsapp", peer: { kind: "dm", id: "+15551230001" } } }]
5、重启openclaw
openclaw gateway restart
2、方式二:多智能体协作
1、配置新的agent
{
id: 'pm',
name: 'pm',
workspace: 'C:\\Users\\Administrator\\.openclaw\\workspace-pm',
agentDir: 'C:\\Users\\Administrator\\.openclaw\\agents\\pm\\agent',
},
{
id: 'rd',
name: 'rd',
workspace: 'C:\\Users\\Administrator\\.openclaw\\workspace-rd',
agentDir: 'C:\\Users\\Administrator\\.openclaw\\agents\\rd\\agent',
},
2、账号、渠道间 session隔离
{
session: {
// 按账号 + 渠道 + 发送者完全隔离(推荐)
dmScope: "per-account-channel-peer"
}
}
3、tool权限以及agent间通信权限配置
tools: {
profile: 'full',
sessions: {
visibility: 'all',
},
agentToAgent: {
enabled: true,
},
},
4、飞书多机器人
accounts: {
default: {}, //很关键的配置,不配置 之前的机器人就用不了了
pm: {
appId: '',
appSecret: '__OPENCLAW_REDACTED__',
dmPolicy: 'allowlist',
allowFrom: [
'',
],
},
rd: {
appId: '',
appSecret: '__OPENCLAW_REDACTED__',
dmPolicy: 'allowlist',
allowFrom: [
'',
],
},
},
5、路由绑定配置
{
agentId: 'pm', //agent名称
match: {
channel: 'feishu',
accountId: 'pm', //绑定的飞书机器人账号,和上面的account一致
},
},
{
agentId: 'rd',
match: {
channel: 'feishu',
accountId: 'rd',
},
},
6、一份完整的openclaw.json配置
{
meta: {
lastTouchedVersion: '2026.3.28',
lastTouchedAt: '2026-03-31T14:39:45.446Z',
},
wizard: {
lastRunAt: '2026-03-30T14:41:56.688Z',
lastRunVersion: '2026.3.28',
lastRunCommand: 'configure',
lastRunMode: 'local',
},
auth: {
profiles: {
'ollama:default': {
provider: 'ollama',
mode: 'api_key',
},
},
},
models: {
mode: 'merge',
providers: {
doubao: {
baseUrl: 'https://ark.cn-beijing.volces.com/api/coding/v3',
apiKey: '你的模型apiKey',
api: 'openai-completions',
models: [
{
id: 'ark-code-latest',
name: 'ark-code-latest',
},
],
},
ollama: {
baseUrl: 'http://127.0.0.1:11434',
apiKey: '__OPENCLAW_REDACTED__',
api: 'ollama',
models: [
{
id: 'glm-4.7-flash',
name: 'glm-4.7-flash',
reasoning: false,
input: [
'text',
],
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
contextWindow: 128000,
maxTokens: 8192,
},
{
id: 'qwen3:8b',
name: 'qwen3:8b',
reasoning: false,
input: [
'text',
],
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
contextWindow: 40960,
maxTokens: 8192,
},
{
id: 'llama3.2:3b',
name: 'llama3.2:3b',
reasoning: false,
input: [
'text',
],
cost: {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,
},
contextWindow: 131072,
maxTokens: 8192,
},
],
},
},
},
agents: {
defaults: {
model: {
primary: 'doubao/ark-code-latest',
},
models: {
'doubao/ark-code-latest': {
alias: 'doubao',
},
'ollama/qwen3:8b': {},
},
workspace: 'C:\\Users\\Administrator\\.openclaw\\workspace',
},
list: [
{
id: 'main',
},
{
id: 'news',
name: 'news',
workspace: 'C:\\Users\\Administrator\\.openclaw\\workspace-news',
agentDir: 'C:\\Users\\Administrator\\.openclaw\\agents\\news\\agent',
},
{
id: 'daily',
name: 'daily',
workspace: 'C:\\Users\\Administrator\\.openclaw\\workspace-daily',
agentDir: 'C:\\Users\\Administrator\\.openclaw\\agents\\daily\\agent',
},
{
id: 'pm',
name: 'pm',
workspace: 'C:\\Users\\Administrator\\.openclaw\\workspace-pm',
agentDir: 'C:\\Users\\Administrator\\.openclaw\\agents\\pm\\agent',
},
{
id: 'rd',
name: 'rd',
workspace: 'C:\\Users\\Administrator\\.openclaw\\workspace-rd',
agentDir: 'C:\\Users\\Administrator\\.openclaw\\agents\\rd\\agent',
},
],
},
tools: {
profile: 'full',
sessions: {
visibility: 'all',
},
agentToAgent: {
enabled: true,
},
},
bindings: [
{
agentId: 'news',
match: {
channel: 'feishu',
peer: {
kind: 'group',
id: '你的群ID',
},
},
},
{
agentId: 'daily',
match: {
channel: 'feishu',
peer: {
kind: 'group',
id: '你的群ID',
},
},
},
{
agentId: 'pm',
match: {
channel: 'feishu',
accountId: 'pm',
},
},
{
agentId: 'rd',
match: {
channel: 'feishu',
accountId: 'rd',
},
},
],
commands: {
native: 'auto',
nativeSkills: 'auto',
restart: true,
ownerDisplay: 'raw',
},
session: {
dmScope: 'per-account-channel-peer',
},
channels: {
feishu: {
enabled: true,
appId: 'cli_a94036fa3c781bc3',
appSecret: '__OPENCLAW_REDACTED__',
connectionMode: 'websocket',
domain: 'feishu',
groupPolicy: 'open',
dmPolicy: 'open',
allowFrom: [
'*',
],
webhookPath: '/feishu/events',
reactionNotifications: 'own',
typingIndicator: true,
resolveSenderNames: true,
requireMention: false,
accounts: {
pm: {
appId: '你的机器人appid',
appSecret: '你的机器人appSecret',
dmPolicy: 'allowlist',
allowFrom: [
'你的会话id',
],
},
rd: {
appId: '你的机器人appid',
appSecret: '你的机器人appSecret',
dmPolicy: 'allowlist',
allowFrom: [
'你的会话id',
],
},
default: {},
},
},
},
gateway: {
port: 18789,
mode: 'local',
bind: 'loopback',
controlUi: {
allowInsecureAuth: true,
},
auth: {
mode: 'token',
token: '__OPENCLAW_REDACTED__',
},
tailscale: {
mode: 'off',
resetOnExit: false,
},
nodes: {
denyCommands: [
'camera.snap',
'camera.clip',
'screen.record',
'contacts.add',
'calendar.add',
'reminders.add',
'sms.send',
],
},
},
plugins: {
entries: {
feishu: {
enabled: true,
config: {},
},
},
},
}
7、配置各自的身份
你是专业极简产品经理 Agent,专注拆解用户业务需求。
1. 接收用户原始需求,梳理**核心目标、使用场景、核心功能 3 点、排除无关需求**;
1. 输出标准化需求文档:需求背景 + 核心功能清单 + 简易业务流程 + 验收标准;
1. 不写技术代码、不纠结实现细节,只把需求理清楚,给到可直接给开发的清晰文档;
1. 语言简洁直白,无冗余废话。
你是落地开发程序员 Agent,只对接产品经理的标准化需求文档。
1. 严格按照产品经理输出的需求清单、流程、验收标准开发;
1. 输出开发方案:技术选型 + 核心代码 / 功能逻辑 + 部署 / 使用说明;
1. 不擅自新增需求、不修改产品定义,有模糊点直接标注疑问;
1. 代码规整、注释简易,方案通俗易懂。
# 将如下规则写到你的记忆文件里面去
1. 核心调度流程(严格执行,禁止跳过):
只要用户提出开发类需求(如做功能、写代码、实现业务、开发工具等),必须严格按「先产品分析→再开发实现」的顺序执行:
- 第一步:通过 sessions_send 调用【pm agent】,将用户原始需求完整发送,要求其输出标准化需求文档(需求背景+核心功能+业务流程+验收标准)
- 第二步:拿到产品经理完整需求后,立即通过 sessions_send 调用【rd agent】,将需求文档完整同步,要求其输出开发方案与可落地代码
- 禁止自己分析需求、禁止直接写代码、禁止跳过产品经理直接调用开发
2. Agent 固定调用规则(解决找不到Agent问题,严格按sessionKey调用):
- 绝对禁止用label/名称模糊查找,必须使用固定sessionKey精准调用
- pm 固定sessionKey:agent:pm:feishu:pm:direct:ou_38bfccd5cbc4c1d85e8e0320bf154f47
- rd 固定sessionKey:agent:rd:feishu:rd:direct:ou_92097a94a9cfc105d29f121250ff5638
- 调用格式必须为:sessions_send(sessionKey="固定sessionKey", message="任务内容")
3. 会话创建规则:
处理开发类任务时,默认不新建临时agent,优先用已有agent协作;
仅当目标agent不存在、或用户明确要求新开会话时,才使用sessions_spawn创建新会话。
4. 输出要求:
每次调用后,同步产品经理的需求文档和程序员的开发方案给用户,确保流程透明。
问题一:无法主agent和其他agent通信
解决:是配对的问题,执行下面命令可以看到请求,可以直接对话主agent,让他解决
openclaw devices approve --latest