2026-01-06 08:41:45 +01:00
---
summary: "Sub-agents: spawning isolated agent runs that announce results back to the requester chat"
read_when:
- You want background/parallel work via the agent
- You are changing sessions_spawn or sub-agent tool policy
2026-02-21 19:59:50 +01:00
- You are implementing or troubleshooting thread-bound subagent sessions
2026-01-31 16:04:03 -05:00
title: "Sub-Agents"
2026-01-06 08:41:45 +01:00
---
2026-02-14 22:03:45 -08:00
# Sub-agents
2026-01-06 08:41:45 +01:00
2026-03-30 16:42:47 +09:00
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. Each sub-agent run is tracked as a [background task ](/automation/tasks ).
2026-01-06 08:41:45 +01:00
2026-02-14 22:03:45 -08:00
## Slash command
2026-01-18 04:44:52 +00:00
2026-02-14 22:03:45 -08:00
Use `/subagents` to inspect or control sub-agent runs for the **current session ** :
2026-01-31 21:13:13 +09:00
2026-02-14 22:03:45 -08:00
- `/subagents list`
- `/subagents kill <id|#|all>`
- `/subagents log <id|#> [limit] [tools]`
- `/subagents info <id|#>`
- `/subagents send <id|#> <message>`
2026-02-18 02:52:23 +01:00
- `/subagents steer <id|#> <message>`
- `/subagents spawn <agentId> <task> [--model <model>] [--thinking <level>]`
2026-01-18 04:44:52 +00:00
2026-02-22 14:31:16 +01:00
Thread binding controls:
2026-02-22 14:31:16 +01:00
These commands work on channels that support persistent thread bindings. See **Thread supporting channels ** below.
2026-02-21 19:59:50 +01:00
- `/focus <subagent-label|session-key|session-id|session-label>`
- `/unfocus`
- `/agents`
2026-02-27 10:02:39 +01:00
- `/session idle <duration|off>`
- `/session max-age <duration|off>`
2026-02-21 19:59:50 +01:00
2026-02-14 22:03:45 -08:00
`/subagents info` shows run metadata (status, timestamps, session id, transcript path, cleanup).
2026-04-04 19:20:34 +01:00
Use `sessions_history` for a bounded, safety-filtered recall view; inspect the
transcript path on disk when you need the raw full transcript.
2026-01-18 04:44:52 +00:00
2026-02-18 02:52:23 +01:00
### Spawn behavior
`/subagents spawn` starts a background sub-agent as a user command, not an internal relay, and it sends one final completion update back to the requester chat when the run finishes.
- The spawn command is non-blocking; it returns a run id immediately.
- On completion, the sub-agent announces a summary/result message back to the requester chat channel.
2026-04-04 19:22:39 +01:00
- Completion is push-based. Once spawned, do not poll `/subagents list` ,
`sessions_list` , or `sessions_history` in a loop just to wait for it to
finish; inspect status only on-demand for debugging or intervention.
2026-04-04 12:06:32 +01:00
- On completion, OpenClaw best-effort closes tracked browser tabs/processes opened by that sub-agent session before the announce cleanup flow continues.
2026-02-18 03:19:30 +01:00
- For manual spawns, delivery is resilient:
- OpenClaw tries direct `agent` delivery first with a stable idempotency key.
- If direct delivery fails, it falls back to queue routing.
- If queue routing is still not available, the announce is retried with a short exponential backoff before final give-up.
2026-04-04 15:32:36 +01:00
- Completion delivery keeps the resolved requester route:
- thread-bound or conversation-bound completion routes win when available
- if the completion origin only provides a channel, OpenClaw fills the missing target/account from the requester session's resolved route (`lastChannel` / `lastTo` / `lastAccountId` ) so direct delivery still works
2026-03-01 23:11:08 +00:00
- The completion handoff to the requester session is runtime-generated internal context (not user-authored text) and includes:
2026-04-04 19:29:58 +01:00
- `Result` (latest visible `assistant` reply text, otherwise sanitized latest tool/toolResult text)
2026-03-01 23:11:08 +00:00
- `Status` (`completed successfully` / `failed` / `timed out` / `unknown` )
2026-02-18 02:52:23 +01:00
- compact runtime/token stats
2026-03-01 23:11:08 +00:00
- a delivery instruction telling the requester agent to rewrite in normal assistant voice (not forward raw internal metadata)
2026-02-18 02:52:23 +01:00
- `--model` and `--thinking` override defaults for that specific run.
- Use `info` /`log` to inspect details and output after completion.
2026-02-21 19:59:50 +01:00
- `/subagents spawn` is one-shot mode (`mode: "run"` ). For persistent thread-bound sessions, use `sessions_spawn` with `thread: true` and `mode: "session"` .
2026-02-26 11:00:09 +01:00
- For ACP harness sessions (Codex, Claude Code, Gemini CLI), use `sessions_spawn` with `runtime: "acp"` and see [ACP Agents ](/tools/acp-agents ).
2026-02-18 02:52:23 +01:00
2026-02-14 22:03:45 -08:00
Primary goals:
2026-01-31 21:13:13 +09:00
2026-02-14 22:03:45 -08:00
- 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.
- Support configurable nesting depth for orchestrator patterns.
2026-01-06 08:41:45 +01:00
2026-02-14 22:03:45 -08:00
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.
2026-01-25 04:04:14 +00:00
2026-02-14 22:03:45 -08:00
## Tool
2026-01-06 08:41:45 +01:00
2026-02-14 22:03:45 -08:00
Use `sessions_spawn` :
2026-01-31 21:13:13 +09:00
2026-02-14 22:03:45 -08:00
- 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.
2026-02-24 04:22:25 +00:00
- Default run timeout: if `sessions_spawn.runTimeoutSeconds` is omitted, OpenClaw uses `agents.defaults.subagents.runTimeoutSeconds` when set; otherwise it falls back to `0` (no timeout).
2026-01-06 08:41:45 +01:00
2026-02-14 22:03:45 -08:00
Tool params:
2026-01-31 21:13:13 +09:00
2026-02-14 22:03:45 -08:00
- `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)
2026-02-24 04:22:25 +00:00
- `runTimeoutSeconds?` (defaults to `agents.defaults.subagents.runTimeoutSeconds` when set, otherwise `0` ; when set, the sub-agent run is aborted after N seconds)
2026-02-21 19:59:50 +01:00
- `thread?` (default `false` ; when `true` , requests channel thread binding for this sub-agent session)
- `mode?` (`run|session` )
- default is `run`
- if `thread: true` and `mode` omitted, default becomes `session`
- `mode: "session"` requires `thread: true`
2026-02-14 22:03:45 -08:00
- `cleanup?` (`delete|keep` , default `keep` )
2026-03-02 01:27:25 +00:00
- `sandbox?` (`inherit|require` , default `inherit` ; `require` rejects spawn unless target child runtime is sandboxed)
2026-03-02 02:35:26 +00:00
- `sessions_spawn` does **not ** accept channel-delivery params (`target` , `channel` , `to` , `threadId` , `replyTo` , `transport` ). For delivery, use `message` /`sessions_send` from the spawned run.
2026-01-07 06:53:01 +01:00
2026-02-22 14:31:16 +01:00
## Thread-bound sessions
When thread bindings are enabled for a channel, a sub-agent can stay bound to a thread so follow-up user messages in that thread keep routing to the same sub-agent session.
2026-02-22 14:31:16 +01:00
### Thread supporting channels
2026-02-21 19:59:50 +01:00
2026-02-27 10:02:39 +01:00
- Discord (currently the only supported channel): supports persistent thread-bound subagent sessions (`sessions_spawn` with `thread: true` ), manual thread controls (`/focus` , `/unfocus` , `/agents` , `/session idle` , `/session max-age` ), and adapter keys `channels.discord.threadBindings.enabled` , `channels.discord.threadBindings.idleHours` , `channels.discord.threadBindings.maxAgeHours` , and `channels.discord.threadBindings.spawnSubagentSessions` .
2026-02-21 19:59:50 +01:00
Quick flow:
1. Spawn with `sessions_spawn` using `thread: true` (and optionally `mode: "session"` ).
2026-02-22 14:31:16 +01:00
2. OpenClaw creates or binds a thread to that session target in the active channel.
2026-02-21 19:59:50 +01:00
3. Replies and follow-up messages in that thread route to the bound session.
2026-02-27 10:02:39 +01:00
4. Use `/session idle` to inspect/update inactivity auto-unfocus and `/session max-age` to control the hard cap.
2026-02-21 19:59:50 +01:00
5. Use `/unfocus` to detach manually.
Manual controls:
- `/focus <target>` binds the current thread (or creates one) to a sub-agent/session target.
2026-02-22 14:31:16 +01:00
- `/unfocus` removes the binding for the current bound thread.
2026-02-21 19:59:50 +01:00
- `/agents` lists active runs and binding state (`thread:<id>` or `unbound` ).
2026-02-27 10:02:39 +01:00
- `/session idle` and `/session max-age` only work for focused bound threads.
2026-02-21 19:59:50 +01:00
Config switches:
2026-02-27 10:02:39 +01:00
- Global default: `session.threadBindings.enabled` , `session.threadBindings.idleHours` , `session.threadBindings.maxAgeHours`
2026-02-22 14:31:16 +01:00
- Channel override and spawn auto-bind keys are adapter-specific. See **Thread supporting channels ** above.
2026-02-21 19:59:50 +01:00
2026-02-22 14:31:16 +01:00
See [Configuration Reference ](/gateway/configuration-reference ) and [Slash commands ](/tools/slash-commands ) for current adapter details.
2026-02-21 19:59:50 +01:00
2026-02-14 22:03:45 -08:00
Allowlist:
2026-01-31 21:13:13 +09:00
2026-02-14 22:03:45 -08:00
- `agents.list[].subagents.allowAgents` : list of agent ids that can be targeted via `agentId` (`["*"]` to allow any). Default: only the requester agent.
2026-04-03 19:39:30 +09:00
- `agents.defaults.subagents.allowAgents` : default target-agent allowlist used when the requester agent does not set its own `subagents.allowAgents` .
2026-03-02 01:10:39 +00:00
- Sandbox inheritance guard: if the requester session is sandboxed, `sessions_spawn` rejects targets that would run unsandboxed.
2026-03-31 11:06:59 +08:00
- `agents.defaults.subagents.requireAgentId` / `agents.list[].subagents.requireAgentId` : when true, block `sessions_spawn` calls that omit `agentId` (forces explicit profile selection). Default: false.
2026-01-08 06:55:28 +00:00
2026-02-14 22:03:45 -08:00
Discovery:
2026-01-31 21:13:13 +09:00
2026-02-14 22:03:45 -08:00
- Use `agents_list` to see which agent ids are currently allowed for `sessions_spawn` .
2026-01-08 07:06:36 +00:00
2026-02-14 22:03:45 -08:00
Auto-archive:
2026-01-31 21:13:13 +09:00
2026-02-14 22:03:45 -08:00
- 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.
- Auto-archive applies equally to depth-1 and depth-2 sessions.
2026-04-04 12:06:32 +01:00
- Browser cleanup is separate from archive cleanup: tracked browser tabs/processes are best-effort closed when the run finishes, even if the transcript/session record is kept.
2026-01-06 08:41:45 +01:00
2026-02-14 22:03:45 -08:00
## Nested Sub-Agents
2026-01-16 15:51:50 +01:00
2026-02-20 19:26:25 -06:00
By default, sub-agents cannot spawn their own sub-agents (`maxSpawnDepth: 1` ). You can enable one level of nesting by setting `maxSpawnDepth: 2` , which allows the **orchestrator pattern ** : main → orchestrator sub-agent → worker sub-sub-agents.
2026-01-31 21:13:13 +09:00
2026-02-14 22:03:45 -08:00
### How to enable
2026-02-09 11:50:53 -05:00
``` json5
{
agents: {
defaults: {
subagents: {
2026-02-20 19:26:25 -06:00
maxSpawnDepth: 2, // allow sub-agents to spawn children (default: 1)
2026-02-14 22:03:45 -08:00
maxChildrenPerAgent: 5, // max active children per agent session (default: 5)
maxConcurrent: 8, // global concurrency lane cap (default: 8)
2026-02-24 04:22:25 +00:00
runTimeoutSeconds: 900, // default timeout for sessions_spawn when omitted (0 = no timeout)
2026-02-09 11:50:53 -05:00
},
},
},
}
```
2026-02-14 22:03:45 -08:00
### Depth levels
2026-02-09 11:50:53 -05:00
2026-02-20 19:26:25 -06:00
| Depth | Session key shape | Role | Can spawn? |
| ----- | -------------------------------------------- | --------------------------------------------- | ---------------------------- |
| 0 | `agent:<id>:main` | Main agent | Always |
| 1 | `agent:<id>:subagent:<uuid>` | Sub-agent (orchestrator when depth 2 allowed) | Only if `maxSpawnDepth >= 2` |
| 2 | `agent:<id>:subagent:<uuid>:subagent:<uuid>` | Sub-sub-agent (leaf worker) | Never |
2026-01-07 06:53:01 +01:00
2026-02-14 22:03:45 -08:00
### Announce chain
2026-01-06 08:41:45 +01:00
2026-02-14 22:03:45 -08:00
Results flow back up the chain:
2026-01-31 21:13:13 +09:00
2026-02-14 22:03:45 -08:00
1. Depth-2 worker finishes → announces to its parent (depth-1 orchestrator)
2. Depth-1 orchestrator receives the announce, synthesizes results, finishes → announces to main
3. Main agent receives the announce and delivers to the user
2026-01-06 08:41:45 +01:00
2026-02-14 22:03:45 -08:00
Each level only sees announces from its direct children.
2026-02-09 11:50:53 -05:00
2026-04-04 19:22:39 +01:00
Operational guidance:
- Start child work once and wait for completion events instead of building poll
loops around `sessions_list` , `sessions_history` , `/subagents list` , or
`exec` sleep commands.
- If a child completion event arrives after you already sent the final answer,
2026-04-04 21:58:05 +01:00
the correct follow-up is the exact silent token `NO_REPLY` / `no_reply` .
2026-04-04 19:22:39 +01:00
2026-02-14 22:03:45 -08:00
### Tool policy by depth
2026-02-09 11:50:53 -05:00
2026-03-11 01:44:25 +00:00
- Role and control scope are written into session metadata at spawn time. That keeps flat or restored session keys from accidentally regaining orchestrator privileges.
2026-02-20 19:26:25 -06:00
- **Depth 1 (orchestrator, when `maxSpawnDepth >= 2` )**: Gets `sessions_spawn` , `subagents` , `sessions_list` , `sessions_history` so it can manage its children. Other session/system tools remain denied.
- **Depth 1 (leaf, when `maxSpawnDepth == 1` )**: No session tools (current default behavior).
- **Depth 2 (leaf worker)**: No session tools — `sessions_spawn` is always denied at depth 2. Cannot spawn further children.
2026-02-09 11:50:53 -05:00
2026-02-14 22:03:45 -08:00
### Per-agent spawn limit
2026-02-09 11:50:53 -05:00
2026-02-14 22:03:45 -08:00
Each agent session (at any depth) can have at most `maxChildrenPerAgent` (default: 5) active children at a time. This prevents runaway fan-out from a single orchestrator.
2026-02-09 11:50:53 -05:00
2026-02-14 22:03:45 -08:00
### Cascade stop
2026-02-09 11:50:53 -05:00
2026-02-14 22:03:45 -08:00
Stopping a depth-1 orchestrator automatically stops all its depth-2 children:
2026-02-09 11:50:53 -05:00
2026-02-14 22:03:45 -08:00
- `/stop` in the main chat stops all depth-1 agents and cascades to their depth-2 children.
- `/subagents kill <id>` stops a specific sub-agent and cascades to its children.
- `/subagents kill all` stops all sub-agents for the requester and cascades.
2026-02-09 11:50:53 -05:00
2026-02-14 22:03:45 -08:00
## Authentication
2026-02-09 11:50:53 -05:00
2026-02-14 22:03:45 -08:00
Sub-agent auth is resolved by **agent id ** , not by session type:
2026-02-09 11:50:53 -05:00
2026-02-14 22:03:45 -08:00
- The sub-agent session key is `agent:<agentId>:subagent:<uuid>` .
- The auth store is loaded from that agent's `agentDir` .
- The main agent's auth profiles are merged in as a **fallback ** ; agent profiles override main profiles on conflicts.
2026-02-09 11:50:53 -05:00
2026-02-14 22:03:45 -08:00
Note: the merge is additive, so main profiles are always available as fallbacks. Fully isolated auth per agent is not supported yet.
2026-02-09 11:50:53 -05:00
2026-02-14 22:03:45 -08:00
## Announce
2026-02-09 11:50:53 -05:00
2026-02-20 19:26:25 -06:00
Sub-agents report back via an announce step:
2026-02-09 11:50:53 -05:00
2026-02-20 19:26:25 -06:00
- The announce step runs inside the sub-agent session (not the requester session).
- If the sub-agent replies exactly `ANNOUNCE_SKIP` , nothing is posted.
2026-04-04 21:56:30 +01:00
- If the latest assistant text is the exact silent token `NO_REPLY` / `no_reply` ,
announce output is suppressed even if earlier visible progress existed.
2026-03-05 19:20:24 -08:00
- Otherwise delivery depends on requester depth:
- top-level requester sessions use a follow-up `agent` call with external delivery (`deliver=true` )
- nested requester subagent sessions receive an internal follow-up injection (`deliver=false` ) so the orchestrator can synthesize child results in-session
- if a nested requester subagent session is gone, OpenClaw falls back to that session's requester when available
2026-04-04 15:32:36 +01:00
- For top-level requester sessions, completion-mode direct delivery first resolves any bound conversation/thread route and hook override, then fills missing channel-target fields from the requester session's stored route. That keeps completions on the right chat/topic even when the completion origin only identifies the channel.
2026-03-05 19:20:24 -08:00
- Child completion aggregation is scoped to the current requester run when building nested completion findings, preventing stale prior-run child outputs from leaking into the current announce.
2026-02-22 14:31:16 +01:00
- Announce replies preserve thread/topic routing when available on channel adapters.
2026-03-01 23:11:08 +00:00
- Announce context is normalized to a stable internal event block:
- source (`subagent` or `cron` )
- child session key/id
- announce type + task label
- status line derived from runtime outcome (`success` , `error` , `timeout` , or `unknown` )
2026-04-04 19:29:58 +01:00
- result content selected from the latest visible assistant text, otherwise sanitized latest tool/toolResult text
2026-03-01 23:11:08 +00:00
- a follow-up instruction describing when to reply vs. stay silent
2026-02-20 19:26:25 -06:00
- `Status` is not inferred from model output; it comes from runtime outcome signals.
2026-04-04 19:29:58 +01:00
- On timeout, if the child only got through tool calls, announce can collapse that history into a short partial-progress summary instead of replaying raw tool output.
2026-02-09 11:50:53 -05:00
2026-02-14 22:03:45 -08:00
Announce payloads include a stats line at the end (even when wrapped):
2026-02-09 11:50:53 -05:00
2026-02-14 22:03:45 -08:00
- Runtime (e.g., `runtime 5m12s` )
2026-02-09 11:50:53 -05:00
- Token usage (input/output/total)
2026-02-14 22:03:45 -08:00
- Estimated cost when model pricing is configured (`models.providers.*.models[].cost` )
- `sessionKey` , `sessionId` , and transcript path (so the main agent can fetch history via `sessions_history` or inspect the file on disk)
2026-03-01 23:11:08 +00:00
- Internal metadata is meant for orchestration only; user-facing replies should be rewritten in normal assistant voice.
2026-02-09 11:50:53 -05:00
2026-04-04 19:20:34 +01:00
`sessions_history` is the safer orchestration path:
2026-04-04 19:26:37 +01:00
- assistant recall is normalized first:
- thinking tags are stripped
2026-04-04 19:33:13 +01:00
- `<relevant-memories>` / `<relevant_memories>` scaffolding blocks are stripped
2026-04-04 21:52:10 +01:00
- plain-text tool-call XML payload blocks such as `<tool_call>...</tool_call>` ,
2026-04-04 22:21:26 +01:00
`<function_call>...</function_call>` , `<tool_calls>...</tool_calls>` , and
`<function_calls>...</function_calls>` are stripped, including truncated
payloads that never close cleanly
2026-04-04 19:26:37 +01:00
- downgraded tool-call/result scaffolding and historical-context markers are stripped
2026-04-04 21:52:10 +01:00
- leaked model control tokens such as `<|assistant|>` , other ASCII
`<|...|>` tokens, and full-width `<| ...| >` variants are stripped
2026-04-04 19:26:37 +01:00
- malformed MiniMax tool-call XML is stripped
2026-04-04 19:20:34 +01:00
- credential/token-like text is redacted
- long blocks can be truncated
- very large histories can drop older rows or replace an oversized row with
`[sessions_history omitted: message too large]`
- raw on-disk transcript inspection is the fallback when you need the full byte-for-byte transcript
2026-02-14 22:03:45 -08:00
## Tool Policy (sub-agent tools)
2026-02-09 11:50:53 -05:00
2026-02-14 22:03:45 -08:00
By default, sub-agents get **all tools except session tools ** and system tools:
2026-02-09 11:50:53 -05:00
2026-02-14 22:03:45 -08:00
- `sessions_list`
- `sessions_history`
- `sessions_send`
- `sessions_spawn`
2026-02-09 11:50:53 -05:00
2026-04-04 19:26:37 +01:00
`sessions_history` remains a bounded, sanitized recall view here too; it is not
2026-04-04 19:20:34 +01:00
a raw transcript dump.
2026-02-20 19:26:25 -06:00
When `maxSpawnDepth >= 2` , depth-1 orchestrator sub-agents additionally receive `sessions_spawn` , `subagents` , `sessions_list` , and `sessions_history` so they can manage their children.
2026-02-09 11:50:53 -05:00
2026-02-14 22:03:45 -08:00
Override via config:
2026-02-09 11:50:53 -05:00
``` json5
{
2026-02-14 22:03:45 -08:00
agents: {
defaults: {
subagents: {
maxConcurrent: 1,
2026-01-31 21:13:13 +09:00
},
},
2026-01-09 12:44:23 +00:00
},
tools: {
2026-01-06 08:41:45 +01:00
subagents: {
tools: {
2026-02-14 22:03:45 -08:00
// deny wins
deny: ["gateway", "cron"],
// if allow is set, it becomes allow-only (deny still wins)
// allow: ["read", "exec", "process"]
2026-01-31 21:13:13 +09:00
},
},
},
2026-01-06 08:41:45 +01:00
}
```
2026-02-14 22:03:45 -08:00
## Concurrency
2026-01-31 21:13:13 +09:00
2026-02-14 22:03:45 -08:00
Sub-agents use a dedicated in-process queue lane:
2026-01-06 08:41:45 +01:00
2026-02-14 22:03:45 -08:00
- Lane name: `subagent`
- Concurrency: `agents.defaults.subagents.maxConcurrent` (default `8` )
2026-01-16 21:37:11 +00:00
2026-02-14 22:03:45 -08:00
## Stopping
2026-02-09 11:50:53 -05:00
2026-02-14 22:03:45 -08:00
- Sending `/stop` in the requester chat aborts the requester session and stops any active sub-agent runs spawned from it, cascading to nested children.
- `/subagents kill <id>` stops a specific sub-agent and cascades to its children.
2026-01-16 21:37:11 +00:00
2026-01-06 08:41:45 +01:00
## Limitations
2026-02-14 22:03:45 -08:00
- Sub-agent announce is **best-effort ** . If the gateway restarts, pending "announce back" work is lost.
- Sub-agents still share the same gateway process resources; treat `maxConcurrent` as a safety valve.
- `sessions_spawn` is always non-blocking: it returns `{ status: "accepted", runId, childSessionKey }` immediately.
- Sub-agent context only injects `AGENTS.md` + `TOOLS.md` (no `SOUL.md` , `IDENTITY.md` , `USER.md` , `HEARTBEAT.md` , or `BOOTSTRAP.md` ).
- Maximum nesting depth is 5 (`maxSpawnDepth` range: 1– 5). Depth 2 is recommended for most use cases.
- `maxChildrenPerAgent` caps active children per session (default: 5, range: 1– 20).