Spawn isolated sessions to execute tasks in parallel with appropriate model routing.
Sub-agents do not see AGENTS.md, SKILL.md, SOUL.md, MEMORY.md, or any workspace context files. They only see:
task string you provideattachments you pass at spawn timeEverything the sub-agent needs must be in the task spec or explicitly referenced as a file path. This includes output instructions, announce behavior, constraints, and domain knowledge.
Spawn when:
Don't spawn when:
Task TypeModel (alias)Full pathNotesBrowser automationgpt54``openai-codex/gpt-5.4Default for all browser tasks. Native computer-use. thinking: high auto-applied.Code implementationcodex``openai-codex/gpt-5.3-codexOptimized for code genQuick code/bugscodex``openai-codex/gpt-5.3-codex-sparkFaster, simpler tasksResearch, writing, quick tasksgpt5``openai-codex/gpt-5.2Unlimited on Codex sub. Replaces sonnet/haiku for most work.Complex reasoningopus``anthropic/claude-opus-4-6Deep analysis (expensive)Huge context (>200K tokens)sonnet``anthropic/claude-sonnet-4-51M context window fallback
Use aliases when available. GPT-5.2 is unlimited on the Codex subscription — prefer it over Sonnet/Haiku for sub-agents unless you specifically need Sonnet's 1M context window.
ParameterRequiredDefaultDescriptiontask✅—The full task description (only context the sub-agent gets)model—parent modelModel alias or full provider/model paththinking——off | low | medium | high``label——Label for logs/UI trackingrunTimeoutSeconds—config default or 0Abort after N secondscleanup—keep``delete | keep — delete removes session after completionthread—falseThread-bound routing (Discord/Slack)mode—run``run | session — defaults to session when thread=true``sandbox—inherit``inherit | require — require rejects if child isn't sandboxedagentId—current agentSpawn under another agent (must be in allowlist)attachments——Inline files: [{ name, content, encoding?, mimeType? }]
{ status: "accepted", runId, childSessionKey } immediately.tools.subagents.tools.agents.defaults.subagents.archiveAfterMinutes (default: 60).After a sub-agent completes, OpenClaw runs an announce step that posts results to the requester's chat channel.
toolResult is used as ResultSub-agent replies with...EffectNormal textPosted to requester's channel as the announceANNOUNCE_SKIPAnnounce is suppressed — nothing postedEmpty replyLatest toolResult becomes the Result
⚠️ Use ANNOUNCE_SKIP, not NO_REPLY. ANNOUNCE_SKIP is the specific mechanism for sub-agent announce suppression. NO_REPLY is a general silent-reply convention that may not suppress the announce step.
Every spawn should follow this template. Remember: this is the only context the sub-agent receives.
projects/foo/CONTEXT.md).For silent sub-agents (results consolidated by parent):
text
Write your full analysis to [path].
Your final reply after writing the file should be ONLY: ANNOUNCE_SKIP
For sub-agents that should announce their own results:
text
Write results to [path].
Your final reply should summarize what you found — this will be posted to the chat.
text
OBJECTIVE: Analyze time-of-day patterns in Kalshi BTC spread bot single-fill losses.
CONTEXT:
- Bot code: projects/kalshi-arb/bot/spread_bot.py
- Trade log: projects/kalshi-arb/data/trades.csv (columns: timestamp, action, side, price, fill_type, pnl)
- Key finding: single-fills have 1.8% win rate vs ~83% for dual-fills
- Volume gate already exists at 150K trailing-1
INPUTS:
- Read trades.csv, filter to fill_type="single"
- Read spread_bot.py lines 180-220 (gating logic)
SUCCESS CRITERIA:
- Statistical breakdown of single-fill losses by hour (ET)
- Identify if specific time windows have >2x the loss rate
- Chi-squared or equivalent significance test
OUTPUT:
- Write analysis to projects/kalshi-arb/time-gating-analysis.md
- Include raw data table + recommendation
CONSTRAINTS:
- Don't modify bot code, analysis only
- Flag if sample size < 30 per bucket
Your final reply after writing the file should be ONLY: ANNOUNCE_SKIP
text
Look at the Kalshi bot trades and figure out if time of day matters
for single fills. The bot is in the projects folder somewhere.
Write up what you find.
The bad example forces the sub-agent to guess file locations, decide its own success criteria, and has no announce instructions.
subagents tool (primary orchestration)#text
subagents(action="list") // List active sub-agents
subagents(action="steer", target="<id>", message="...") // Send follow-up instructions
subagents(action="kill", target="<id>") // Kill a running sub-agent
text
sessions_list({ kinds: ["other"], activeMinutes: 60 }) // Sub-agents are kind "other"
sessions_history({ sessionKey: "...", limit: 5 }) // Check output
sessions_send({ sessionKey: "...", message: "..." }) // Send to any session
text
agents_list() // Discover which agentIds are allowed for sessions_spawn
Don't poll in loops. Check on-demand, when prompted, or for debugging.
If a model is rate-limited:
sonnet for code/research tasksgpt5 for research tasksopus directly (last resort, expensive)Rate limits typically reset in 30-90 minutes.
❌ Spawning for trivial tasks — Just do simple things yourself
❌ Vague task specs — "Look into X" without success criteria or output contract
❌ Over-parallelization — Too many concurrent spawns = memory pressure
❌ Forgetting announce instructions — Every task must specify ANNOUNCE_SKIP or what to say
❌ Assuming sub-agents have context — They don't see your workspace files
❌ Using kinds: ["isolated"] — The correct kind for sub-agents is "other"
❌ Using NO_REPLY for announce suppression — Use ANNOUNCE_SKIP
❌ Expecting sub-agents to spawn their own sub-agents — They can't