home / skills / doanchienthangdev / omgkit / dispatching-parallel-agents

dispatching-parallel-agents skill

/plugin/skills/methodology/dispatching-parallel-agents

This skill orchestrates parallel task execution with specialized agents to maximize efficiency and reduce overall completion time.

npx playbooks add skill doanchienthangdev/omgkit --skill dispatching-parallel-agents

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
3.8 KB
---
name: dispatching-parallel-agents
description: 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.
---

# Dispatching Parallel Agents

## Quick Start

1. **Analyze** - Identify independent vs dependent tasks
2. **Group** - Create parallel groups with no shared dependencies
3. **Specialize** - Assign agents by expertise (explorer, implementer, reviewer)
4. **Dispatch** - Fan-out tasks with timeouts and concurrency limits
5. **Aggregate** - Combine results using merge, consensus, or priority
6. **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)
```

```typescript
// 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

Overview

This skill orchestrates parallel task execution by dispatching specialized agents to run concurrently and then aggregating their results. It maximizes throughput for independent tasks, multi-concern reviews, and parallel exploration while enforcing timeouts and concurrency limits. Use it to split work safely and merge outcomes into a coherent final response.

How this skill works

The orchestrator analyzes tasks to separate independent work from dependent steps, groups tasks with no shared state, and assigns agent types by expertise (explorer, implementer, tester, reviewer, documenter). It fans out work to agents using concurrency controls and timeouts, monitors progress, and applies error strategies (retry, partial-continue, or fail-fast). Finally, it aggregates results using merge, consensus, or priority rules and returns an integrated outcome.

When to use it

  • Tasks can run independently with no shared mutable state
  • Parallel multi-concern reviews (security, performance, style)
  • Exploratory research across different topics or files
  • Running tests for separate modules concurrently
  • When you need faster throughput by dividing work across specialists

Best practices

  • Identify true independence before parallelizing to avoid race conditions
  • Assign specialized agent roles to match task needs (explorer, implementer, tester, reviewer)
  • Set per-agent timeouts and global concurrency limits to prevent resource exhaustion
  • Plan aggregation strategy up front (merge, consensus, priority) for predictable results
  • Handle partial failures explicitly: retry, degrade, or fail-fast depending on risk

Example use cases

  • Parallel code reviews: dispatch reviewer agents for security, performance, and style and then merge findings
  • Feature implementation: explorer finds files, implementer writes code, tester creates tests concurrently
  • Large refactor: split by independent modules and run implementers and testers in parallel
  • Research sprint: multiple explorers gather evidence on separate topics and a summarizer aggregates insights
  • CI pipeline: run module-specific test agents concurrently with a final aggregator for pass/fail and summary

FAQ

How do I decide which tasks can run in parallel?

Parallelize tasks that have no shared files, data dependencies, or required sequencing; if tasks touch the same state or file, keep them sequential.

What aggregation strategy should I use?

Choose merge when results are complementary, consensus for reconciled opinions, or priority when one agent’s output should override others based on trust or role.