OpenProgram Docs

Agent collaboration compared

How does one agent delegate to another, and can it still control that work? Our design: Agent collaboration; our tool surface: architecture.

How this was checked

Seven repositories were read directly, with file paths and line numbers. Claude Code findings come only from its public documentation; a mechanism it does not describe reads “Undocumented”. For the other systems, an empty or “none” entry means the mechanism is absent, not unchecked.

Overview

SystemSpawningDirect messagesTrackingCascading cancel
OursIn-process; depth optionalAny to anyexecution_id, two toolsYes
Claude CodeWithin the session, depth 3Yes, across machinesagentId, ListAgents, TaskStopUndocumented
codex-cliIn-process; V1 depth 1, V2 unlimitedYes, siblingsThreadId, four toolsPartial
openclawIn-process or external, depth 1Yes, if enabledrunId, list onlyYes
opencodeIn-process, implicit depth 1NoChild session idYes
hermes-agentIn-process pool, depth 1Not in the tree; through the boardNone for the modelYes
pi-monoChild process, unlimitedNoNoneOne level
pi-aiNoneNoneNoneNot applicable
weclawNoneNoNoneNot applicable
SystemLoop controlsTool restrictionAddressingLines
Ours4 on, 3 optionalRemove by remaining allowanceBranch name or SID:HEAD9.3k
Claude Code7Withheld at the depth limit; a fork gets an error at callName or agent IDUndocumented
codex-cli2Remove; V1 also rejectsPath, /root/x7k
openclaw8Remove, recheck at spawnSession key17k
opencode3Remove or reject, by rule shapeAgent type name0.4k
hermes-agent5Remove whole toolsetsAnonymous, one-shot2.9k
pi-mono2Remove by allowlistName of an on-disk .md1.3k
pi-aiNoneNot applicableNone0
weclaw1Not applicable@name1.1k

Spawning children

SystemRuns asDepth limit and where it is enforced
Ours: agentIn-process pool, 8 workers by default; 6 running per conversation, the rest queuedagent.max_spawn_depth, 1 by default; past it, “do the work yourself”. agent.max_spawn_fanout per turn, off by default.
Claude Code: Agent, formerly TaskSubagents in the session, optionally isolation: worktree; teammates in-process or in tmux or iTerm2 panesDepth 3 by default, set by CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH; concurrency 20 by default, set by CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS.
codex-cli: spawn_agentTokio tasks on one thread managerV1 depth 1. V2 computes child depth and never checks it; disabled by default; only concurrency caps it.
openclaw: sessions_spawnsubagent in-process; acp external host process, off in sandboxesDepth 1, up to 5, counted from :subagent: segments of the session key
opencode: taskRe-enters the prompt loop in a child sessionNo number. A task: * deny rule removes the tool from the child, giving depth 1; an agent declaring permission.task=allow is unlimited.
hermes-agent: delegate_taskThread pool; external ACP CLI; one process per board cardMAX_DEPTH=1, clamped to 1–3
pi-mono: example extension; core omits itOne new pi --mode json -p --no-session per childNone. Children reload the extension, and worker declares no allowlist, so recursion is unbounded.
pi-aiRead-only snapshot of pi-mono's LLM transport; neither compiled nor importedNot applicable
weclawStarts user-configured agent CLIs as top-level agentsNo nesting

Subprocess paths give isolation, not depth control.

Code locations
SystemLocation
Oursprograms/tools/agents/agent/agent/agent.py; defaults in state/settings.py
Claude CodePublic documentation: Subagents
codex-clicore/src/config/mod.rs:284; V1 check handlers/multi_agents/spawn.rs:65-71; V2 calculation multi_agents_v2/spawn.rs:62
openclawconfig/agent-limits.ts:8; check agents/subagent-spawn.ts:784-791
opencodetool/task.ts:133-135; agent/subagent-permissions.ts:18,25
hermes-agenttools/delegate_tool.py:133,136-137; check :1958-1972
pi-monoREADME.md:476 "No sub-agents"; examples/extensions/subagent/index.ts:329-333; agents/worker.md:1-5
pi-aiREADME.md:1-19
weclawagent/cli_agent.go:140,159; four-method interface agent/agent.go:79-95

Direct communication

No channel Human A B weclaw, pi-ai Through the parent Parent A B opencode, pi-mono, hermes-agent Direct Parent A B Ours, Claude Code, codex-cli, openclaw
No channel
weclaw, pi-ai
Through the parent
opencode, pi-mono, hermes-agent
Direct
Ours, Claude Code, codex-cli, openclaw
SystemConnection and delivery
Ourssend_message(to=) from any agent to any unarchived branch, same path across sessions, no ownership check. Busy targets queue in the session inbox.
Claude CodeSendMessage. to: teammate or subagent name, main, an agent ID, or another session’s name; a local session’s inbox address starts with uds:. No broadcast: one message per recipient. Teammates use file mailboxes ~/.claude/teams/{team}/inboxes/{name}.json. Sending to a finished subagent resumes it.
codex-clisend_message, followup_task, straight to the target thread. Absolute paths let siblings address each other. Delivery queues, or wakes the recipient for one turn.
openclawsessions_send, off by default: a config switch and pairwise allowlist. A bounded back-and-forth loop. Children cannot use it and return through the parent's announcement queue.
opencodeParent to child only, which may append to a running child. No messaging tool in the registry.
hermes-agentChildren report to parents only; send_message is on the never-for-children list. Board workers, one process per card, exchange card comments in a shared database; the root card holds a conventional shared area.
pi-monoOne prompt at spawn, stdout on exit. Sequential mode substitutes the previous output into the next task, the only sibling channel.
pi-aiNo agents
weclaw@a @b message sends one message to several agents, each replying to the human with a prefix. Agents cannot see each other.

Beyond one process: Claude Code reaches other local sessions and machines, ours any session, openclaw by session key.

Code locations
SystemLocation
Oursprograms/tools/agents/send_message/send_message/send_message.py; addressing.py; runtime/conversation/peer_agents/inbox.py
Claude CodePublic documentation: Agent teams, Cross-session messaging
codex-clihandlers/multi_agents_v2/message_tool.rs:11-24,51-131; absolute paths protocol/src/agent_path.rs:59-71; delivery core/src/agent/control.rs:171
openclawagents/tools/sessions-send-tool.ts:193,249-256; back-and-forth sessions-send-tool.a2a.ts:94; child restriction agents/pi-tools.policy.ts:49-50
opencodetool/registry.ts:217-236 (whole built-in registry); parent-to-child tool/task.ts:242-257
hermes-agentdenylist tools/delegate_tool.py:50; board toolsets.py:252-269; shared area hermes_cli/kanban_swarm.py:11-14,26,226-268
pi-monoexamples/extensions/subagent/index.ts:530,569; parallel isolation :618-639
weclawmessaging/handler.go:456-486; command registry (7 entries) :686-698

Tracking and cancellation

SystemId to the modelStatusResult returnsModel cancelsCascade
Oursj_ prefixlist_agents, read_conversationCompletion notice in the dispatcher's conversation, one result shapeclose_agent; UI or API execution.cancelYes, breadth-first over parent_job_id, visited set
Claude CodeagentIdListAgents; /tasksReturned to the caller on completion; background tasks are read from their output fileTaskStopUndocumented
codex-cliThreadId and pathlist_agents, get_status, push subscriptionsMonitor synthesizes a parent message; wait_agent, default 30 s, at most 1 hinterrupt_agent; V1 close_agentclose_agent cascades, interrupt_agent stops one; V2 has only the latter
openclawrunIdsubagents, list onlyPushed: sessions_yield ends the turn, result arrives nextNo; /subagents kill, HTTP endpointYes, recursive; each child clears its queue and writes an abort marker
opencodeChild session id, reusable to resumeNo; the prompt forbids pollingTool result, or a synthetic parent messageNo; host-sideYes, abort signals and metadata traversal to a fixed point; deletion too
hermes-agentNo; index, status, summary, usageGateway RPCBlocking, all togetherGateway RPCYes, cooperative, no thread kill
pi-monoNo; id discardedNo; UI callbacksChild stdout, final text, 50KB per taskEnvironment abort onlyOne level: SIGTERM, SIGKILL after 5 s; children not in cleanup registry, so a forced kill orphans them
pi-aiNoneNoneNoneNoneOne flat abort per HTTP request
weclawNoneNoneSynchronous, by WeChat user idNoNo hierarchy; global cancel at shutdown

Cascading systems walk parent links with a visited set; they differ in walking memory or durable records.

Code locations
SystemLocation
Oursruntime/jobs/runner/cancellation.py; return runtime/jobs/notices.py; ownership programs/tools/agents/agent/_ownership.py
Claude CodeUndocumented
codex-clicascade core/src/agent/control/legacy.rs:86-101, descendants control.rs:732-756; non-cascade control.rs:247-257
openclawagents/subagent-control.ts:205,232,238,256; kill auto-reply/reply/commands-subagents/action-kill.ts:27
opencodesession/run-state.ts:116-148; tool/task.ts:296-306; tests test/tool/task.test.ts:870
hermes-agentresult fields tools/delegate_tool.py:1684-1720; recursion run_agent.py:1690-1730
pi-monodiscarded id examples/extensions/subagent/index.ts:466; termination :393-403; compare src/utils/shell.ts:172
weclawmessaging/handler.go:541-556; command registry :686-698

Loop prevention

SystemControls
OursOn: 4 concurrent, inbox 50 with oldest evicted, 60 s duplicate window, self-delivery rejected. Optional, off by default: depth, per-chain messages, per-turn fan-out. No tool-round cap on chat turns.
Claude CodeDepth 3 and concurrency 20 by default, no total spawn cap; a fork cannot fork; teammates cannot spawn teammates. Cross-session messages: rate-limited per sender, identical repeats dropped within a short window, at most 50 queued.
codex-cliDepth (V1 1, V2 none); concurrency 6 global, 4 per V2 session. No dedup, count, rate limit or cycle detection, so with sibling addressing nothing stops two agents delegating forever.
openclawDepth 1 (to 5); 5 children per agent (to 20); concurrency 8 and 4; conversations 5 rounds (to 20); 2 s steering limit; 3 announcement retries; child-key dedup; tool-loop detector, off by default.
opencodeDepth by injected permission. Same tool with identical arguments 3 times prompts for permission. Steps unlimited by default.
hermes-agentDepth 1 (to 3); 3 concurrent; 50 iterations per child; 600 s timeout plus heartbeat; a global spawn pause; delegation toolset removed from leaves. No dedup or count.
pi-monoFan-out 8, concurrency 4, 50KB output per task. No depth, dedup, rate or round cap; recursion is unbounded.
pi-aiNo tool loop
weclawDedup: WeChat ids for 5 minutes, names within a broadcast. No return channel, so no cycles.

Depth limits are nearly universal; only three systems count messages.

Code locations
SystemLocation
Oursprograms/tools/agents/send_message/send_message/depth.py; programs/tools/agents/agent/agent/agent.py; runtime/conversation/peer_agents/inbox.py; self-delivery guard send_message.py
Claude CodePublic documentation: Subagents, Agent teams, Cross-session messaging
codex-clicore/src/config/mod.rs:212-213,284; concurrency core/src/agent/control/execution.rs:68-76
openclawconfig/agent-limits.ts:3-8; rounds agents/tools/sessions-send-helpers.ts:15-16; rate limit agents/subagent-control.ts:45,507-516; retries agents/subagent-registry-helpers.ts:35
opencodeDOOM_LOOP_THRESHOLD=3 session/processor.ts:35, check :519-546; steps session/prompt.ts:1281
hermes-agenttools/delegate_tool.py:132-133,136-137,512-523; pause switch :149-172; toolset removal :672-680
pi-monoexamples/extensions/subagent/index.ts:27-30; main loop packages/agent/src/agent-loop.ts:170
weclawmessaging/handler.go:273,63-64; name deduplication :246-253

Restricting child tools

A: remove from the list
The model never sees it. Definitions differ by level, so prompt caches split.
B: keep, reject at call
Definitions stay byte-identical and caches hit. An attempted call wastes a turn.
SystemApproachWhat and when
OursA by remaining allowance, then refusalOnly agent, only when the message budget is out (delegation_budget_left), since every dispatch costs a message. Spent generations do not remove it: work can still go to existing agents. Everything else stays. Deliberately binary: a per-level set would shred the prompt cache.
Claude CodeA and BAgent is withheld at the depth limit; a fork keeps it and gets an error at call.
codex-cliV1 A+B, V2 ATool list omits collaboration tools at the limit; V1 handlers also reject. Roles overlay configuration files, not allowlists.
openclawA+BAll children lose gateway, agent listing, session status, scheduled tasks and cross-agent messaging. Leaves also lose subagent listing, session listing, history and spawning. Spawn rechecks depth.
opencodeA or BDeny with "*" removes from the schema; a specific pattern keeps it and throws at call, returning the matched rule.
hermes-agentA, per toolsetRequested ∩ parent-owned, minus delegation, user-question, memory and code execution. Gap: the never-for-children list only generates docs, so a child inheriting the messaging set still gets send_message.
pi-monoAAllowlist becomes child arguments; the child filters its registry and rebuilds its prompt.
pi-aiNot applicableNo tool executor
weclawNot applicableTools are opaque inside the wrapped CLI
Code locations
SystemLocation
Oursprograms/tools/agents/send_message/send_message/depth.py delegation_budget_left; can_use on programs/tools/agents/agent/agent/agent.py
Claude CodePublic documentation: Subagents
codex-clicore/src/tools/spec_plan.rs:561-572,1099; V1 rejection handlers/multi_agents/spawn.rs:67-71; roles core/src/agent/role.rs:37,249
openclawagents/pi-tools.policy.ts:42-51,57-62,170-175; recheck agents/subagent-spawn.ts:786
opencoderemoval permission/index.ts:215-225, session/llm/request.ts:198-204; rejection permission/index.ts:86-90, message packages/core/src/v1/permission.ts:84-90
hermes-agenttools/delegate_tool.py:945-961,672-680; list :45-53; gap compared with toolsets.py:190
pi-monocore/agent-session.ts:2253-2342; allowlist core/sdk.ts:280-286; arguments examples/extensions/subagent/index.ts:290
weclawthe only tool mention, for display: agent/acp_agent.go:139

Identity and addressing

SystemNamedFinding existing agentsAddress
OursYes: about 24-character placeholder, then LLM titles at turns 1, 6, 16, 40list_agents: session, all, archived; each with address, turns, size, previewSID:HEAD, name or unique prefix; resolves to the tip, so old heads stay valid
Claude CodeNames for subagents and teammates; main is the main conversationListAgents: subagents, teammates, local sessions; cloud and other-machine sessions while connected to Remote ControlName, main, agent ID; when local names collide, the identifier from the listing
codex-cliPath from /root; nicknames from 101 scientistslist_agents by path prefix; live children also in environment contextPath or ThreadId
openclawYes, in configuration filesagents_list, removed from childrenagent:<id>:…:subagent:…, or label plus agentId
opencodeTypes, not instancesNames in the task description; running agents undiscoverable; ids only reconnect one's own childBare name
hermes-agentAnonymous, one-shotNo tool; internal sa-index-random ids are operations-onlyNone; board cards use profile names
pi-monoOn-disk definitions, not processesRescans the directory; children leave nothingName by linear scan; learned from error messages
pi-aiNoneNoneNone
weclawConfig keys and aliasesNo tool; /info is a human command@name or /name
Code locations
SystemLocation
Oursprograms/tools/agents/send_message/list_agents/list_agents.py; programs/tools/agents/send_message/send_message/addressing.py; runtime/conversation/turn_runtime/titles.py
Claude CodePublic documentation: Cross-session messaging, Tools reference
codex-cliprotocol/src/agent_path.rs:15-19,54-71,129-146; names core/src/agent/agent_names.txt; listing core/src/agent/control.rs:383-395,361-381
openclawsessions/session-key-utils.ts:108-126; agents-list-tool.ts:37; child restriction pi-tools.policy.ts:45
opencodetool/task.ts:46,116; names tool/registry.ts:252-265; definitions agent/agent.ts:35-55
hermes-agentparameters tools/delegate_tool.py:2675-2751; internal id :920-922; board hermes_cli/kanban_db.py:5674-5679
pi-monoexamples/extensions/subagent/agents.ts:52-56,97-116; arguments index.ts:288; parsing index.ts:272-286
weclawconfig/config.go:16-33; parsing messaging/handler.go:206-265; aliases :169,187

Code size

System and linesMeasured
openclaw, 17,24073 non-test TypeScript files, including UI commands and registries
Ours, about 9,300Agent tools 2,526; jobs package without resource governance 5,541; inbox 511; sub_agent_run 750
codex-cli, 7,059Multi-agent core; plus 3,676 supporting and 13,114 test lines
hermes-agent, 2,900Delegation; plus about 1,600 for the Kanban path
pi-mono, 1,310Whole example extension; the mechanism is about 190
weclaw, 1,050All agent code; routing core about 150
opencode, 415Delegation; plus about 365 of reused background-task code
pi-ai, 0No implementation

Boundaries differ; compare orders of magnitude only. Tests excluded.

What we took from this

DomainToolsHolds
Plantask_start, task_step, task_listA named task and its steps; editing runs nothing
Executionread_conversation, close_agentOne id, one status, guaranteed return, cascading cancel
Entityagent, list_agents, send_messageAn agent is a branch in the session graph
Communicationsend_message, read_conversationMessages without task records; any branch's transcript
ChoiceAgainstWhy
Tool names agent, list_agents, send_messageClaude CodeModels already know them
Planning is todo_*Differs from Claude CodeIts TaskList is a plan board; ours keeps running work and plans apart
Address a branch, not a processLike codex-cli paths, openclaw keys(session, head) identifies it without an agent table
Any agent may message any agentLooser than openclaw; like codex-cli V2, Claude CodeA message makes no task and cannot cascade; the worst outcome is silence
One message tool: send_message always makes a JobCodex send_input, Claude Code SendMessageReturn, cancel and cascade belong to Jobs; one tool removes the choice between three addressing forms
Per-chain message budget; 8 when set, counting return flowOnly openclaw also countsDepth alone cannot stop existing agents delegating to each other. 8 sits between openclaw's 5 and 20 because we also charge spawns and dispatches. A return rebinds the count, so one round trip costs 1; generations restore to the dispatcher's, so a coordinator can dispatch the next batch.
Depth 1 when set, not 3openclaw, codex-cli V1, hermes, opencodeDepth 3 suits nesting with a human watching. Our unattended path is run_in_background=True.
Per-turn fan-out; 8 when setOnly openclaw has a true fan-out capA spawn leaves the parent's counters alone, so neither chain counter sees siblings. openclaw's 5 live children (1–20) is the reusable unit; hermes's 3 and pi-mono's 8 are batch arguments and agent makes one child. 8 is two pool widths: fill it, queue a batch, then refuse the ninth and name the existing eight.
No steering rate limit or child hard timeoutopenclaw 2 s; hermes 600 sopenclaw's limit guards steer, which aborts the child's turn; ours queues and interrupts nothing. Hermes's timeout is a caller-side wait that abandons the thread. job_output(timeout=) is that wait, and execution.cancel also terminates the runtime and forces a terminal state after 30 s.
Remove tools by allowance, binaryOthers remove always or by depth tierTiers invalidate prompt caches
Extra tools close_agent, read_conversationCodex close_agent; Claude Code TaskStopStop and retire a helper in one call, read history without raw session files

Rationale for each number sits beside its constant. Limits ship off, so the job pool bounds concurrency and the owner chooses depth. Open gaps: implementation status.

Last updated · 2026-11-25