Dispatching Parallel Agents
Quick Start
- Analyze - Identify independent vs dependent tasks
- Group - Create parallel groups with no shared dependencies
- Specialize - Assign agents by expertise (explorer, implementer, reviewer)
- Dispatch - Fan-out tasks with timeouts and concurrency limits
- Aggregate - Combine results using merge, consensus, or priority
- Handle Errors - Retry failed, continue with partial, or fail-fast
Features
| Feature |
Description |
Guide |
| Task Analysis |
Identify parallelizable work |
No data deps, no shared files, no state |
| Agent Specialization |
Match agent type to task |
Explorer, implementer, tester, reviewer |
| Fan-Out/Fan-In |
Parallel dispatch and aggregation |
Promise.all for dispatch, merge results |
| Concurrency Limits |
Control parallel agent count |
Prevent resource exhaustion |
| Timeout Handling |
Bound execution time per agent |
Race with timeout, handle gracefully |
| Error Strategies |
Handle partial failures |
Retry, continue, or fail-fast |
Common Patterns
# Parallel Execution Model
[Main Agent (Orchestrator)]
|
[Task Analysis & Distribution]
|
+---------------+---------------+
| | |
[Agent A] [Agent B] [Agent C]
(Task 1) (Task 2) (Task 3)
| | |
+-------+-------+-------+-------+
|
[Aggregation & Integration]
|
[Final Response]
TIMING:
Sequential: ████████████████████████████
Parallel: ████████████ (max of tasks)
// Fan-out/Fan-in Pattern
const [security, performance, style] = await Promise.all([
spawnAgent({ type: 'reviewer', focus: 'security' }),
spawnAgent({ type: 'reviewer', focus: 'performance' }),
spawnAgent({ type: 'reviewer', focus: 'style' }),
]);
return combineReviews([security, performance, style]);
// Parallelization Criteria
CAN PARALLELIZE:
- Independent code changes (different files)
- Research on different topics
- Tests for different modules
- Multi-concern code reviews
CANNOT PARALLELIZE:
- Tasks with data dependencies
- Sequential workflow steps
- Tasks modifying same files
- Tasks sharing mutable state
# Agent Specialization
| Type | Strengths | Best For |
|------|-----------|----------|
| explorer | Finding files, patterns | Initial exploration |
| implementer | Writing production code | Features, bug fixes |
| tester | Test design, edge cases | Unit/integration tests |
| reviewer | Issue identification | Code review, security |
| documenter | Clear explanations | Docs, comments |
Best Practices
| Do |
Avoid |
| Identify truly independent tasks first |
Parallelizing tasks that share state |
| Use specialized agents for concerns |
One agent doing everything |
| Set appropriate timeouts per agent |
Unbounded execution time |
| Handle partial failures gracefully |
Ignoring failed agent results |
| Use concurrency limits |
Spawning unlimited agents |
| Aggregate results meaningfully |
Skipping result combination |
| Document dependencies between tasks |
Assuming order of completion |
| Clean up agent resources |
Resource leaks from agents |
Related Skills
optimizing-tokens - Efficient context per agent
thinking-sequentially - Order dependent tasks
writing-plans - Plan parallel execution phases
executing-plans - Execute with parallel steps
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: dispatching-parallel-agents-113description: AI agent orchestrates parallel task execution through concurrent specialized agents for maximum efficiency. Use when tasks can run independently, multi-concern reviews, or parallel exploration. Use when this capability is needed.4---56# Dispatching Parallel Agents78## Quick Start9101. **Analyze** - Identify independent vs dependent tasks112. **Group** - Create parallel groups with no shared dependencies123. **Specialize** - Assign agents by expertise (explorer, implementer, reviewer)134. **Dispatch** - Fan-out tasks with timeouts and concurrency limits145. **Aggregate** - Combine results using merge, consensus, or priority156. **Handle Errors** - Retry failed, continue with partial, or fail-fast1617## Features1819| Feature | Description | Guide |20|---------|-------------|-------|21| Task Analysis | Identify parallelizable work | No data deps, no shared files, no state |22| Agent Specialization | Match agent type to task | Explorer, implementer, tester, reviewer |23| Fan-Out/Fan-In | Parallel dispatch and aggregation | Promise.all for dispatch, merge results |24| Concurrency Limits | Control parallel agent count | Prevent resource exhaustion |25| Timeout Handling | Bound execution time per agent | Race with timeout, handle gracefully |26| Error Strategies | Handle partial failures | Retry, continue, or fail-fast |2728## Common Patterns2930```31# Parallel Execution Model32 [Main Agent (Orchestrator)]33 |34 [Task Analysis & Distribution]35 |36 +---------------+---------------+37 | | |38[Agent A] [Agent B] [Agent C]39(Task 1) (Task 2) (Task 3)40 | | |41 +-------+-------+-------+-------+42 |43 [Aggregation & Integration]44 |45 [Final Response]4647TIMING:48Sequential: ████████████████████████████49Parallel: ████████████ (max of tasks)50```5152```typescript53// Fan-out/Fan-in Pattern54const [security, performance, style] = await Promise.all([55 spawnAgent({ type: 'reviewer', focus: 'security' }),56 spawnAgent({ type: 'reviewer', focus: 'performance' }),57 spawnAgent({ type: 'reviewer', focus: 'style' }),58]);59return combineReviews([security, performance, style]);6061// Parallelization Criteria62CAN PARALLELIZE:63- Independent code changes (different files)64- Research on different topics65- Tests for different modules66- Multi-concern code reviews6768CANNOT PARALLELIZE:69- Tasks with data dependencies70- Sequential workflow steps71- Tasks modifying same files72- Tasks sharing mutable state73```7475```76# Agent Specialization77| Type | Strengths | Best For |78|------|-----------|----------|79| explorer | Finding files, patterns | Initial exploration |80| implementer | Writing production code | Features, bug fixes |81| tester | Test design, edge cases | Unit/integration tests |82| reviewer | Issue identification | Code review, security |83| documenter | Clear explanations | Docs, comments |84```8586## Best Practices8788| Do | Avoid |89|----|-------|90| Identify truly independent tasks first | Parallelizing tasks that share state |91| Use specialized agents for concerns | One agent doing everything |92| Set appropriate timeouts per agent | Unbounded execution time |93| Handle partial failures gracefully | Ignoring failed agent results |94| Use concurrency limits | Spawning unlimited agents |95| Aggregate results meaningfully | Skipping result combination |96| Document dependencies between tasks | Assuming order of completion |97| Clean up agent resources | Resource leaks from agents |9899## Related Skills100101- `optimizing-tokens` - Efficient context per agent102- `thinking-sequentially` - Order dependent tasks103- `writing-plans` - Plan parallel execution phases104- `executing-plans` - Execute with parallel steps105106---107> Converted and distributed by [TomeVault](https://tomevault.io/claim/doanchienthangdev) — claim your Tome and manage your conversions.108<!-- tomevault:4.0:skill_md:2026-04-13 -->