Quick Start
1
Simple Spawn with Callback
Fire-and-forget pattern with immediate feedback.
2
Parallel Fan-out Pattern
Spawn multiple sub-agents, do other work, then collect results.
How It Works
The spawn-announce pattern uses an event-driven architecture to coordinate between parent and sub-agents.Choosing Your Pattern
Different use cases require different coordination patterns.Common Patterns
Fire-and-Forget with Callback
Best for immediate processing of sub-agent results.Parallel Fan-out with Join
Scale work across multiple sub-agents, then combine results.Event-Driven Coordination
React to sub-agent events without callbacks.Configuration
spawn_sub_agent Parameters
announce_completion Parameters
wait_for_completions Parameters
Async Usage
For async code, use the async variants with proper event-driven waiting.Best Practices
Always Set Timeouts
Always Set Timeouts
Prevent indefinite waiting by setting reasonable timeout values.
Use Async Variants for Async Code
Use Async Variants for Async Code
Inside
async def functions, use aspawn_sub_agent and await_for_completions.Keep Callbacks Fast
Keep Callbacks Fast
Completion callbacks should be lightweight to avoid blocking the event loop.
Use Metadata for Correlation
Use Metadata for Correlation
Attach metadata to track spawned sub-agents back to your domain context.
Related
Subagent Delegation
Core multi-agent coordination
Event Bus
Event-driven architecture

