OpenClaw多代理協(xié)同工作模式配置完整指南
一、核心架構(gòu)思路
OpenClaw 采用 中央網(wǎng)關(guān)(Gateway)+ 多代理隔離 的架構(gòu)模式來實現(xiàn)代理協(xié)同:
1. 代理完全隔離
每個代理擁有完全獨立的運行環(huán)境:
- 獨立工作空間:每個代理有自己的文件系統(tǒng)和配置文件(AGENTS.md、SOUL.md 等)
- 獨立狀態(tài)目錄:認(rèn)證信息、模型注冊、會話存儲都相互隔離
- 獨立會話存儲:會話歷史存儲在各自的目錄下
An **agent** is a fully scoped brain with its own: - **Workspace** (files, AGENTS.md/SOUL.md/USER.md, local notes, persona rules). - **State directory** (`agentDir`) for auth profiles, model registry, and per-agent config. - **Session store** (chat history + routing state) under `~/.openclaw/agents/<agentId>/sessions` . Auth profiles are **per-agent** . Each agent reads from its own: ~/.openclaw/agents/<agentId>/agent/auth-profiles.json Main agent credentials are **not** shared automatically. Never reuse `agentDir` across agents (it causes auth/session collisions). If you want to share creds, copy `auth-profiles.json` into the other agent's `agentDir` . Skills are per-agent via each workspace’s `skills/` folder, with shared skills available from `~/.openclaw/skills`. See [Skills: per-agent vs shared](/tools/skills#per-agent-vs-shared-skills) .
2. 協(xié)同通信機制
OpenClaw 提供三種主要的協(xié)同模式:
A. 代理間直接消息傳遞(sessions_send)
- 用于代理之間的點對點通信
- 支持等待回復(fù)模式和即發(fā)即忘模式
- 包含自動的 ping-pong 回復(fù)循環(huán)和宣告機制
## sessions_send
Send a message into another session.
Parameters:
- `sessionKey` (required; accepts session key or `sessionId` from `sessions_list`)
- `message` (required)
- `timeoutSeconds?: number` (default >0; 0 = fire-and-forget)
Behavior:
- `timeoutSeconds = 0`: enqueue and return `{ runId, status: "accepted" }`.
- `timeoutSeconds > 0`: wait up to N seconds for completion, then return `{ runId, status: "ok", reply }`.
- If wait times out: `{ runId, status: "timeout", error }`. Run continues; call `sessions_history` later.
- If the run fails: `{ runId, status: "error", error }`.
- Announce delivery runs after the primary run completes and is best-effort; `status: "ok"` does not guarantee the announce was delivered.
- Waits via gateway `agent.wait` (server-side) so reconnects don't drop the wait.
- Agent-to-agent message context is injected for the primary run.
- After the primary run completes, OpenClaw runs a **reply-back loop**:
- Round 2+ alternates between requester and target agents.
- Reply exactly `REPLY_SKIP` to stop the ping?pong.
- Max turns is `session.agentToAgent.maxPingPongTurns` (0–5, default 5).
- Once the loop ends, OpenClaw runs the **agent?to?agent announce step** (target agent only):
- Reply exactly `ANNOUNCE_SKIP` to stay silent.
- Any other reply is sent to the target channel.
- Announce step includes the original request + round?1 reply + latest ping?pong reply.B. 子代理委派(sessions_spawn)
- 父代理可以生成子代理處理特定任務(wù)
- 子代理在獨立會話中運行,完成后自動回報結(jié)果
- 支持跨代理委派(需配置白名單)
title: "Sub-Agents" --- # Sub-agents Sub-agents are background agent runs spawned from an existing agent run. They run in their own session (`agent:<agentId>:subagent:<uuid>`) and, when finished, **announce** their result back to the requester chat channel. ## Slash command Use `/subagents` to inspect or control sub-agent runs for the **current session**: - `/subagents list` - `/subagents stop <id|#|all>` - `/subagents log <id|#> [limit] [tools]` - `/subagents info <id|#>` - `/subagents send <id|#> <message>` `/subagents info` shows run metadata (status, timestamps, session id, transcript path, cleanup). Primary goals: - Parallelize “research / long task / slow tool” work without blocking the main run. - Keep sub-agents isolated by default (session separation + optional sandboxing). - Keep the tool surface hard to misuse: sub-agents do **not** get session tools by default. - Avoid nested fan-out: sub-agents cannot spawn sub-agents. Cost note: each sub-agent has its **own** context and token usage. For heavy or repetitive tasks, set a cheaper model for sub-agents and keep your main agent on a higher-quality model. You can configure this via `agents.defaults.subagents.model` or per-agent overrides.
C. 廣播組(Broadcast Groups)
- 多個代理同時處理同一消息
- 支持并行或順序處理策略
- 適用于專業(yè)團隊協(xié)作場景
Broadcast Groups enable multiple agents to process and respond to the same message simultaneously. This allows you to create specialized agent teams that work together in a single WhatsApp group or DM — all using one phone number. Current scope: **WhatsApp only** (web channel). Broadcast groups are evaluated after channel allowlists and group activation rules. In WhatsApp groups, this means broadcasts happen when OpenClaw would normally reply (for example: on mention, depending on your group settings). ## Use Cases ### 1. Specialized Agent Teams Deploy multiple agents with atomic, focused responsibilities: Group: "Development Team" Agents: - CodeReviewer (reviews code snippets) - DocumentationBot (generates docs) - SecurityAuditor (checks for vulnerabilities) - TestGenerator (suggests test cases)
二、配置方法
1. 基礎(chǔ)代理配置
在 ~/.openclaw/openclaw.json 中配置多個代理:
{
agents: {
list: [
{
id: "commander",
name: "總指揮",
workspace: "~/.openclaw/workspace-commander",
agentDir: "~/.openclaw/agents/commander/agent",
model: "anthropic/claude-opus-4-6"
},
{
id: "project-manager",
name: "項目經(jīng)理",
workspace: "~/.openclaw/workspace-pm",
agentDir: "~/.openclaw/agents/project-manager/agent",
model: "anthropic/claude-sonnet-4-5"
},
{
id: "developer",
name: "開發(fā)工程師",
workspace: "~/.openclaw/workspace-dev",
agentDir: "~/.openclaw/agents/developer/agent"
},
{
id: "tester",
name: "測試工程師",
workspace: "~/.openclaw/workspace-test",
agentDir: "~/.openclaw/agents/tester/agent"
}
]
}
}2. 啟用代理間通信
必須顯式啟用并配置白名單:
{
tools: {
agentToAgent: {
enabled: true,
allow: ["commander", "project-manager", "developer", "tester"]
}
}
}3. 配置子代理權(quán)限
允許代理生成和委派子代理:
{
agents: {
list: [
{
id: "commander",
subagents: {
allowAgents: ["project-manager"] // 總指揮可以委派給項目經(jīng)理
}
},
{
id: "project-manager",
subagents: {
allowAgents: ["developer", "tester"] // 項目經(jīng)理可以委派給開發(fā)和測試
}
}
]
}
}4. 配置沙箱隔離(可選但推薦)
為不同代理配置不同的安全級別:
{
agents: {
list: [
{
id: "commander",
sandbox: {
mode: "off" // 總指揮無沙箱限制
}
},
{
id: "project-manager",
sandbox: {
mode: "all",
scope: "agent"
},
tools: {
allow: ["read", "write", "exec", "sessions_send", "sessions_spawn"]
}
},
{
id: "developer",
sandbox: {
mode: "all",
scope: "agent",
sessionToolsVisibility: "spawned" // 只能看到自己生成的會話
},
tools: {
allow: ["read", "write", "exec"]
}
}
]
}
}三、實現(xiàn)步驟
步驟 1:總指揮代理分析和規(guī)劃
總指揮代理收到需求后,進行分析并生成任務(wù)清單:
- 在自己的工作空間創(chuàng)建項目規(guī)劃文檔
- 定義各子任務(wù)和交付標(biāo)準(zhǔn)
- 使用
sessions_spawn委派任務(wù)給項目經(jīng)理代理
工具調(diào)用示例:
{
"tool": "sessions_spawn",
"task": "根據(jù)以下需求制定詳細的項目執(zhí)行方案:[需求描述]。要求包含:1) 任務(wù)分解 2) 資源分配 3) 時間表 4) 質(zhì)量標(biāo)準(zhǔn)",
"label": "項目規(guī)劃會話",
"agentId": "project-manager",
"cleanup": "keep"
}步驟 2:項目經(jīng)理代理細化任務(wù)
項目經(jīng)理代理在獨立會話中工作:
- 接收總指揮的任務(wù)描述
- 進一步拆解為具體的執(zhí)行單元
- 使用
sessions_spawn為每個團隊成員創(chuàng)建子任務(wù)
連續(xù)委派示例:
// 委派給開發(fā)工程師
{
"tool": "sessions_spawn",
"task": "實現(xiàn)功能模塊 X,要求:[具體技術(shù)規(guī)格]",
"label": "開發(fā)任務(wù)-模塊X",
"agentId": "developer"
}
// 委派給測試工程師
{
"tool": "sessions_spawn",
"task": "為模塊 X 編寫測試用例,覆蓋率要求 >80%",
"label": "測試任務(wù)-模塊X",
"agentId": "tester"
}步驟 3:團隊成員并行工作
開發(fā)和測試代理在各自隔離的會話中獨立工作:
- 會話隔離:每個代理使用
agent:<agentId>:subagent:<uuid>格式的會話鍵 - 獨立上下文:不會看到其他代理的消息歷史
- 獨立工作空間:文件操作在各自的沙箱中進行 11
步驟 4:子代理自動回報結(jié)果
每個子代理完成任務(wù)后自動執(zhí)行宣告步驟:
- 系統(tǒng)運行宣告步驟(announce step)
- 子代理總結(jié)工作成果
- 結(jié)果自動發(fā)送回父代理的聊天頻道
- 包含統(tǒng)計信息:運行時間、token 使用、會話信息等
## Tool Use `sessions_spawn`: - Starts a sub-agent run (`deliver: false`, global lane: `subagent`) - Then runs an announce step and posts the announce reply to the requester chat channel - Default model: inherits the caller unless you set `agents.defaults.subagents.model` (or per-agent `agents.list[].subagents.model`); an explicit `sessions_spawn.model` still wins. - Default thinking: inherits the caller unless you set `agents.defaults.subagents.thinking` (or per-agent `agents.list[].subagents.thinking`); an explicit `sessions_spawn.thinking` still wins. Tool params: - `task` (required) - `label?` (optional) - `agentId?` (optional; spawn under another agent id if allowed) - `model?` (optional; overrides the sub-agent model; invalid values are skipped and the sub-agent runs on the default model with a warning in the tool result) - `thinking?` (optional; overrides thinking level for the sub-agent run) - `runTimeoutSeconds?` (default `0`; when set, the sub-agent run is aborted after N seconds) - `cleanup?` (`delete|keep`, default `keep`) Allowlist: - `agents.list[].subagents.allowAgents`: list of agent ids that can be targeted via `agentId` (`["*"]` to allow any). Default: only the requester agent. Discovery: - Use `agents_list` to see which agent ids are currently allowed for `sessions_spawn`. Auto-archive: - Sub-agent sessions are automatically archived after `agents.defaults.subagents.archiveAfterMinutes` (default: 60). - Archive uses `sessions.delete` and renames the transcript to `*.deleted.<timestamp>` (same folder). - `cleanup: "delete"` archives immediately after announce (still keeps the transcript via rename). - Auto-archive is best-effort; pending timers are lost if the gateway restarts. - `runTimeoutSeconds` does **not** auto-archive; it only stops the run. The session remains until auto-archive.
步驟 5:項目經(jīng)理整合子項目
項目經(jīng)理代理收到所有團隊成員的回報后:
- 使用
sessions_history查看各子任務(wù)的詳細歷史(如需要) - 整合所有交付成果
- 進行質(zhì)量檢查和驗證
- 在自己的宣告步驟中將整合結(jié)果回報給總指揮
查看子任務(wù)歷史示例:
{
"tool": "sessions_history",
"sessionKey": "agent:developer:subagent:abc-123",
"limit": 50,
"includeTools": true
}步驟 6:總指揮最終整合
總指揮代理接收項目經(jīng)理的整合報告后:
- 審查所有交付成果
- 進行最終質(zhì)量把關(guān)
- 如需補充工作,可再次使用
sessions_send發(fā)送反饋 - 生成最終完整的項目交付
使用 sessions_send 進行雙向溝通:
{
"tool": "sessions_send",
"sessionKey": "agent:project-manager:subagent:xyz-789",
"message": "開發(fā)模塊 X 需要補充單元測試,請協(xié)調(diào)處理",
"timeoutSeconds": 300
}四、工作流程圖示

五、高級協(xié)同模式
1. Ping-Pong 交互模式
當(dāng)需要代理間多輪對話時,sessions_send 自動支持 ping-pong 循環(huán):
- 最多 5 輪交互(可配置)
- 任一方回復(fù)
REPLY_SKIP即可終止循環(huán) - 適用于需要澄清或迭代的場景
2. 使用 Lobster 實現(xiàn)確定性工作流
對于需要嚴(yán)格步驟控制和審批的場景,可以結(jié)合 Lobster 工具:
- 定義多步驟管道
- 內(nèi)置審批檢查點
- 可恢復(fù)的工作流狀態(tài)
- 適合替代復(fù)雜的代理間協(xié)調(diào)
# Lobster Lobster is a workflow shell that lets OpenClaw run multi-step tool sequences as a single, deterministic operation with explicit approval checkpoints. ## Hook Your assistant can build the tools that manage itself. Ask for a workflow, and 30 minutes later you have a CLI plus pipelines that run as one call. Lobster is the missing piece: deterministic pipelines, explicit approvals, and resumable state. ## Why Today, complex workflows require many back-and-forth tool calls. Each call costs tokens, and the LLM has to orchestrate every step. Lobster moves that orchestration into a typed runtime: - **One call instead of many**: OpenClaw runs one Lobster tool call and gets a structured result. - **Approvals built in**: Side effects (send email, post comment) halt the workflow until explicitly approved. - **Resumable**: Halted workflows return a token; approve and resume without re-running everything.
3. 廣播組用于專業(yè)團隊
如果需要多個代理同時評審?fù)蝗蝿?wù):
{
broadcast: {
strategy: "parallel",
"+15555550123": ["developer", "tester", "security-auditor"]
}
}所有代理會并行處理相同消息,各自提供專業(yè)視角。
六、最佳實踐建議
1. 隔離性保障
- ? 為每個代理配置獨立的工作空間
- ? 使用沙箱限制敏感代理的工具訪問
- ? 配置
sessionToolsVisibility: "spawned"限制會話可見性
2. 協(xié)同效率
- ? 總指揮和項目經(jīng)理使用更強大的模型(如 Opus)
- ? 執(zhí)行型代理可使用較快的模型(如 Sonnet)
- ? 設(shè)置合理的
runTimeoutSeconds避免長時間掛起
3. 錯誤處理
- ? 檢查子代理的
status字段(success/error/timeout) - ? 使用
sessions_history查看失敗任務(wù)的詳細日志 - ? 配置自動歸檔清理完成的子代理會話
Notes
關(guān)鍵配置要點:
必須顯式啟用跨代理通信:
tools.agentToAgent.enabled: true是前提條件,否則代理間消息會被拒絕會話鍵格式:子代理使用
agent:<agentId>:subagent:<uuid>格式,確保完全隔離認(rèn)證信息隔離:每個代理的認(rèn)證配置存儲在各自的
~/.openclaw/agents/<agentId>/agent/auth-profiles.json工具策略是安全關(guān)鍵:通過
agents.list[].tools.allow/deny精確控制每個代理的能力邊界宣告機制是異步的:子代理完成后的回報是盡力而為(best-effort),網(wǎng)關(guān)重啟可能導(dǎo)致宣告丟失
OpenClaw 的這種架構(gòu)設(shè)計使得代理既能保持完全獨立(各自的工作空間、會話、權(quán)限),又能通過結(jié)構(gòu)化的工具調(diào)用實現(xiàn)無縫協(xié)同,非常適合您描述的層級化任務(wù)委派場景。
Citations
File: /concepts/multi-agent.md
An **agent** is a fully scoped brain with its own: - **Workspace** (files, AGENTS.md/SOUL.md/USER.md, local notes, persona rules). - **State directory** (`agentDir`) for auth profiles, model registry, and per-agent config. - **Session store** (chat history + routing state) under `~/.openclaw/agents/<agentId>/sessions`. Auth profiles are **per-agent**. Each agent reads from its own:
~/.openclaw/agents//agent/auth-profiles.json
Main agent credentials are **not** shared automatically. Never reuse `agentDir` across agents (it causes auth/session collisions). If you want to share creds, copy `auth-profiles.json` into the other agent's `agentDir`. Skills are per-agent via each workspace’s `skills/` folder, with shared skills available from `~/.openclaw/skills`. See [Skills: per-agent vs shared](/tools/skills#per-agent-vs-shared-skills).
File: concepts/multi-agent.md
`~/.openclaw/openclaw.json` (JSON5):
```js
{
agents: {
list: [
{
id: "home",
default: true,
name: "Home",
workspace: "~/.openclaw/workspace-home",
agentDir: "~/.openclaw/agents/home/agent",
},
{
id: "work",
name: "Work",
workspace: "~/.openclaw/workspace-work",
agentDir: "~/.openclaw/agents/work/agent",
},
],
},
// Deterministic routing: first match wins (most-specific first).
bindings: [
{ agentId: "home", match: { channel: "whatsapp", accountId: "personal" } },
{ agentId: "work", match: { channel: "whatsapp", accountId: "biz" } },
// Optional per-peer override (example: send a specific group to work agent).
{
agentId: "work",
match: {
channel: "whatsapp",
accountId: "personal",
peer: { kind: "group", id: "1203630...@g.us" },
},
},
],
// Off by default: agent-to-agent messaging must be explicitly enabled + allowlisted.
tools: {
agentToAgent: {
enabled: false,
allow: ["home", "work"],
},
},
channels: {
whatsapp: {
accounts: {
personal: {
// Optional override. Default: ~/.openclaw/credentials/whatsapp/personal
// authDir: "~/.openclaw/credentials/whatsapp/personal",
},
biz: {
// Optional override. Default: ~/.openclaw/credentials/whatsapp/biz
// authDir: "~/.openclaw/credentials/whatsapp/biz",
},
},
},
},
}File: concepts/multi-agent.md
Starting with v2026.1.6, each agent can have its own sandbox and tool restrictions:
```js
{
agents: {
list: [
{
id: "personal",
workspace: "~/.openclaw/workspace-personal",
sandbox: {
mode: "off", // No sandbox for personal agent
},
// No tool restrictions - all tools available
},
{
id: "family",
workspace: "~/.openclaw/workspace-family",
sandbox: {
mode: "all", // Always sandboxed
scope: "agent", // One container per agent
docker: {
// Optional one-time setup after container creation
setupCommand: "apt-get update && apt-get install -y git curl",
},
},
tools: {
allow: ["read"], // Only read tool
deny: ["exec", "write", "edit", "apply_patch"], // Deny others
},
},
],
},
}
Note: `setupCommand` lives under `sandbox.docker` and runs once on container creation.
Per-agent `sandbox.docker.*` overrides are ignored when the resolved scope is `"shared"`.
**Benefits:**
- **Security isolation**: Restrict tools for untrusted agents
- **Resource control**: Sandbox specific agents while keeping others on host
- **Flexible policies**: Different permissions per agent
Note: `tools.elevated` is **global** and sender-based; it is not configurable per agent.
If you need per-agent boundaries, use `agents.list[].tools` to deny `exec`.
For group targeting, use `agents.list[].groupChat.mentionPatterns` so @mentions map cleanly to the intended agent.
See [Multi-Agent Sandbox & Tools](/tools/multi-agent-sandbox-tools) for detailed examples.File: concepts/session-tool.md
Fetch transcript for one session. Parameters: - `sessionKey` (required; accepts session key or `sessionId` from `sessions_list`) - `limit?: number` max messages (server clamps) - `includeTools?: boolean` (default false) Behavior: - `includeTools=false` filters `role: "toolResult"` messages. - Returns messages array in the raw transcript format. - When given a `sessionId`, OpenClaw resolves it to the corresponding session key (missing ids error).
File: concepts/session-tool.md
Send a message into another session.
Parameters:
- `sessionKey` (required; accepts session key or `sessionId` from `sessions_list`)
- `message` (required)
- `timeoutSeconds?: number` (default >0; 0 = fire-and-forget)
Behavior:
- `timeoutSeconds = 0`: enqueue and return `{ runId, status: "accepted" }`.
- `timeoutSeconds > 0`: wait up to N seconds for completion, then return `{ runId, status: "ok", reply }`.
- If wait times out: `{ runId, status: "timeout", error }`. Run continues; call `sessions_history` later.
- If the run fails: `{ runId, status: "error", error }`.
- Announce delivery runs after the primary run completes and is best-effort; `status: "ok"` does not guarantee the announce was delivered.
- Waits via gateway `agent.wait` (server-side) so reconnects don't drop the wait.
- Agent-to-agent message context is injected for the primary run.
- After the primary run completes, OpenClaw runs a **reply-back loop**:
- Round 2+ alternates between requester and target agents.
- Reply exactly `REPLY_SKIP` to stop the ping?pong.
- Max turns is `session.agentToAgent.maxPingPongTurns` (0–5, default 5).
- Once the loop ends, OpenClaw runs the **agent?to?agent announce step** (target agent only):
- Reply exactly `ANNOUNCE_SKIP` to stay silent.
- Any other reply is sent to the target channel.
- Announce step includes the original request + round?1 reply + latest ping?pong reply.File: concepts/session-tool.md
Behavior:
- Starts a new `agent:<agentId>:subagent:<uuid>` session with `deliver: false`.
- Sub-agents default to the full tool set **minus session tools** (configurable via `tools.subagents.tools`).
- Sub-agents are not allowed to call `sessions_spawn` (no sub-agent → sub-agent spawning).
- Always non-blocking: returns `{ status: "accepted", runId, childSessionKey }` immediately.
- After completion, OpenClaw runs a sub-agent **announce step** and posts the result to the requester chat channel.
- Reply exactly `ANNOUNCE_SKIP` during the announce step to stay silent.
- Announce replies are normalized to `Status`/`Result`/`Notes`; `Status` comes from runtime outcome (not model text).
- Sub-agent sessions are auto-archived after `agents.defaults.subagents.archiveAfterMinutes` (default: 60).
- Announce replies include a stats line (runtime, tokens, sessionKey/sessionId, transcript path, and optional cost).File: tools/subagents.md
# Sub-agents Sub-agents are background agent runs spawned from an existing agent run. They run in their own session (`agent:<agentId>:subagent:<uuid>`) and, when finished, **announce** their result back to the requester chat channel. ## Slash command Use `/subagents` to inspect or control sub-agent runs for the **current session**: - `/subagents list` - `/subagents stop <id|#|all>` - `/subagents log <id|#> [limit] [tools]` - `/subagents info <id|#>` - `/subagents send <id|#> <message>` `/subagents info` shows run metadata (status, timestamps, session id, transcript path, cleanup). Primary goals: - Parallelize “research / long task / slow tool” work without blocking the main run. - Keep sub-agents isolated by default (session separation + optional sandboxing). - Keep the tool surface hard to misuse: sub-agents do **not** get session tools by default. - Avoid nested fan-out: sub-agents cannot spawn sub-agents. Cost note: each sub-agent has its **own** context and token usage. For heavy or repetitive tasks, set a cheaper model for sub-agents and keep your main agent on a higher-quality model. You can configure this via `agents.defaults.subagents.model` or per-agent overrides.
File: tools/subagents.md
## Tool Use `sessions_spawn`: - Starts a sub-agent run (`deliver: false`, global lane: `subagent`) - Then runs an announce step and posts the announce reply to the requester chat channel - Default model: inherits the caller unless you set `agents.defaults.subagents.model` (or per-agent `agents.list[].subagents.model`); an explicit `sessions_spawn.model` still wins. - Default thinking: inherits the caller unless you set `agents.defaults.subagents.thinking` (or per-agent `agents.list[].subagents.thinking`); an explicit `sessions_spawn.thinking` still wins. Tool params: - `task` (required) - `label?` (optional) - `agentId?` (optional; spawn under another agent id if allowed) - `model?` (optional; overrides the sub-agent model; invalid values are skipped and the sub-agent runs on the default model with a warning in the tool result) - `thinking?` (optional; overrides thinking level for the sub-agent run) - `runTimeoutSeconds?` (default `0`; when set, the sub-agent run is aborted after N seconds) - `cleanup?` (`delete|keep`, default `keep`)
File: tools/subagents.md
Allowlist: - `agents.list[].subagents.allowAgents`: list of agent ids that can be targeted via `agentId` (`["*"]` to allow any). Default: only the requester agent. Discovery: - Use `agents_list` to see which agent ids are currently allowed for `sessions_spawn`.
File: tools/subagents.md
Auto-archive: - Sub-agent sessions are automatically archived after `agents.defaults.subagents.archiveAfterMinutes` (default: 60). - Archive uses `sessions.delete` and renames the transcript to `*.deleted.<timestamp>` (same folder). - `cleanup: "delete"` archives immediately after announce (still keeps the transcript via rename). - Auto-archive is best-effort; pending timers are lost if the gateway restarts. - `runTimeoutSeconds` does **not** auto-archive; it only stops the run. The session remains until auto-archive.
File: tools/subagents.md
## Announce Sub-agents report back via an announce step: - The announce step runs inside the sub-agent session (not the requester session). - If the sub-agent replies exactly `ANNOUNCE_SKIP`, nothing is posted. - Otherwise the announce reply is posted to the requester chat channel via a follow-up `agent` call (`deliver=true`). - Announce replies preserve thread/topic routing when available (Slack threads, Telegram topics, Matrix threads). - Announce messages are normalized to a stable template: - `Status:` derived from the run outcome (`success`, `error`, `timeout`, or `unknown`). - `Result:` the summary content from the announce step (or `(not available)` if missing). - `Notes:` error details and other useful context. - `Status` is not inferred from model output; it comes from runtime outcome signals.
File: channels/broadcast-groups.md
## Overview Broadcast Groups enable multiple agents to process and respond to the same message simultaneously. This allows you to create specialized agent teams that work together in a single WhatsApp group or DM — all using one phone number. Current scope: **WhatsApp only** (web channel). Broadcast groups are evaluated after channel allowlists and group activation rules. In WhatsApp groups, this means broadcasts happen when OpenClaw would normally reply (for example: on mention, depending on your group settings). ## Use Cases ### 1. Specialized Agent Teams Deploy multiple agents with atomic, focused responsibilities: Group: "Development Team" Agents: - CodeReviewer (reviews code snippets) - DocumentationBot (generates docs) - SecurityAuditor (checks for vulnerabilities) - TestGenerator (suggests test cases)
File: channels/broadcast-groups.md
### Basic Setup
Add a top-level `broadcast` section (next to `bindings`). Keys are WhatsApp peer ids:
- group chats: group JID (e.g. `120363403215116621@g.us`)
- DMs: E.164 phone number (e.g. `+15551234567`)
```json
{
"broadcast": {
"120363403215116621@g.us": ["alfred", "baerbel", "assistant3"]
}
}
**Result:** When OpenClaw would reply in this chat, it will run all three agents.File: channels/broadcast-groups.md
### Session Isolation Each agent in a broadcast group maintains completely separate: - **Session keys** (`agent:alfred:whatsapp:group:120363...` vs `agent:baerbel:whatsapp:group:120363...`) - **Conversation history** (agent doesn't see other agents' messages) - **Workspace** (separate sandboxes if configured) - **Tool access** (different allow/deny lists) - **Memory/context** (separate IDENTITY.md, SOUL.md, etc.) - **Group context buffer** (recent group messages used for context) is shared per peer, so all broadcast agents see the same context when triggered This allows each agent to have: - Different personalities - Different tool access (e.g., read-only vs. read-write) - Different models (e.g., opus vs. sonnet) - Different skills installed ### Example: Isolated Sessions
File: agents/tools/sessions-send-tool.ts
const SessionsSendToolSchema = Type.Object({
sessionKey: Type.Optional(Type.String()),
label: Type.Optional(Type.String({ minLength: 1, maxLength: SESSION_LABEL_MAX_LENGTH })),
agentId: Type.Optional(Type.String({ minLength: 1, maxLength: 64 })),
message: Type.String(),
timeoutSeconds: Type.Optional(Type.Number({ minimum: 0 })),
});File: tools/lobster.md
# Lobster Lobster is a workflow shell that lets OpenClaw run multi-step tool sequences as a single, deterministic operation with explicit approval checkpoints. ## Hook Your assistant can build the tools that manage itself. Ask for a workflow, and 30 minutes later you have a CLI plus pipelines that run as one call. Lobster is the missing piece: deterministic pipelines, explicit approvals, and resumable state. ## Why Today, complex workflows require many back-and-forth tool calls. Each call costs tokens, and the LLM has to orchestrate every step. Lobster moves that orchestration into a typed runtime: - **One call instead of many**: OpenClaw runs one Lobster tool call and gets a structured result. - **Approvals built in**: Side effects (send email, post comment) halt the workflow until explicitly approved. - **Resumable**: Halted workflows return a token; approve and resume without re-running everything.
總結(jié)
到此這篇關(guān)于OpenClaw多代理協(xié)同工作模式配置完整指南的文章就介紹到這了,更多相關(guān)OpenClaw多代理協(xié)同工作模式內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持腳本之家!
相關(guān)文章

OpenClaw 國內(nèi)完美運行指南:自定義API 代理與飛書協(xié)同部署(CloudBot)
OpenClaw是一款強大的開源本地AI助理,適合在MacMini或Linux上“裸機部署”,本文介紹了如何通過三大核心進階模塊(無縫接入自定義聚合API、使用PM2實現(xiàn)7x24小時后臺常駐、接2026-03-02
飛書怎么接入OpenClaw OpenClaw接入飛書保姆級教程
本教程專為零基礎(chǔ)用戶量身打造,系統(tǒng)梳理OpenClaw部署全流程,細致拆解接入飛書的實操步驟,從環(huán)境搭建到功能適配,每一步都清晰易懂、可落地,助力新手快速掌握核心要領(lǐng),2026-03-04
OpenClaw安裝部署及應(yīng)用場景教程(2026最新完整版)
本文將從OpenClaw核心介紹、兩種主流安裝部署方案(新手友好型+深度定制型)、高頻避坑指南,到實際應(yīng)用場景全解析,全程實操落地,適合各類需求的使用者,收藏備用2026-03-02
上一篇文章為大家分享了max mini系統(tǒng)下OpenClaw的安裝與基本配置,這里接著為大家分享一下OpenClaw的進階知識,方便大家更好的掌握openclaw的核心功能,多多研究skill,找2026-03-01





