Multi-Agent Orchestration Guide
Overview
Complex tasks benefit from orchestrating multiple subagents rather than handling everything in a single agent. This guide provides patterns for task decomposition, subagent coordination, and result synthesis.
When to Use Orchestration
Appropriate for Orchestration
- Tasks requiring multiple expertise domains
- Work decomposable into independent subtasks
- Large-scale codebase analysis
- Parallelizable operations
Single Agent Suffices
- Single file modifications
- Simple bug fixes
- Clear, singular objectives
Task Decomposition Strategy
Decomposition Principles
- Independence: Each subtask should not depend on results from other subtasks (when parallel)
- Clarity: Each task must have clear objectives and expected deliverables
- Right-sizing: Neither too granular nor too broad
Decomposition Process
- Define the final goal
- Identify required expertise domains
- Break down into subtasks
- Map dependencies (sequential vs parallel)
- Determine appropriate approach for each task (subagent type, required skills)
Orchestration Patterns
Pattern 1: Parallel Analysis
Use when analysis from multiple perspectives is needed simultaneously.
Subtasks (independent):
├── Structure/architecture analysis
├── Code quality review
├── Security assessment
└── Test coverage analysis
Execution: Launch all subtasks in parallel via multiple Task tool calls
Result: Synthesize findings after all tasks complete
Pattern 2: Sequential Pipeline
Use when each stage depends on previous results.
Task 1: Exploration/Analysis → Pass findings
↓
Task 2: Planning → Pass plan
↓
Task 3: Implementation → Pass result
↓
Task 4: Verification
Key: Use task_id to maintain context between stages
Pattern 3: Hybrid
Use for complex tasks with mixed parallel/sequential phases.
Phase 1: Parallel Exploration
├── Explore area A
├── Explore area B
└── Explore area C
↓
Phase 2: Sequential Implementation (based on Phase 1 findings)
├── Implement feature
└── Verify changes
Context Management
Parallel Execution
- Each Task runs independently
- Collect and synthesize results after completion
- No context sharing between parallel tasks
Sequential Execution
- Use task_id to resume previous work
- Pass essential context explicitly in prompt
- Minimize context to necessary information only
Skill Loading Strategy
When to Load Skills
- Specialized expertise is required
- Standardized process guidance is needed
- Domain-specific best practices apply
How to Load
Include skill loading instruction in the task prompt when domain expertise would benefit the task.
Synthesis Protocol
After all tasks complete:
- Collect Results: Gather key findings from each task
- Identify Patterns: Remove duplicates, find common themes
- Prioritize: Sort by importance/urgency
- Define Actions: Specify concrete follow-up work
- Consolidate: Produce unified report or output
Best Practices
- Plan Before Execution: Identify required tasks upfront
- Parallel First: Run independent tasks concurrently
- Avoid Over-decomposition: Too many small tasks creates overhead
- Always Synthesize: Don't end with scattered individual results
- Minimize Context: Pass only necessary information to each task
- Leverage Skills: Load relevant skills for specialized work