πŸ€– AI Tools
Β· 3 min read

Agent Orchestration Patterns β€” Sequential, Parallel, and Hierarchical


When you move beyond a single AI agent, you need orchestration β€” deciding which agent does what, when, and how they communicate. Three patterns cover 90% of use cases.

Pattern 1: Sequential pipeline

Agent A β†’ Agent B β†’ Agent C β†’ Output

Each agent processes the output of the previous one. The simplest pattern.

When to use

  • Content generation: research β†’ draft β†’ edit β†’ publish
  • Data processing: extract β†’ transform β†’ validate β†’ load
  • Code workflows: plan β†’ implement β†’ test β†’ review

Implementation

async def sequential_pipeline(task):
    # Step 1: Research (cheap model)
    research = await call_agent("deepseek-chat", f"Research: {task}")
    
    # Step 2: Draft (medium model)
    draft = await call_agent("claude-sonnet-4.6", f"Write based on: {research}")
    
    # Step 3: Review (best model)
    final = await call_agent("claude-opus-4.6", f"Review and improve: {draft}")
    
    return final

Cost optimization: Use cheap models for early stages, expensive models only for the final step. See our model routing guide.

Pros and cons

βœ… Simple to implement and debug βœ… Each step is independently testable βœ… Easy to add/remove steps ❌ Slow (each step waits for the previous) ❌ Errors cascade forward ❌ No parallelism

Pattern 2: Parallel fan-out

                β†’ Agent B1 ─┐
Task β†’ Agent A  β†’ Agent B2 ──→ Agent C (merge)
                β†’ Agent B3 β”€β”˜

A coordinator splits work across parallel agents, then merges results.

When to use

  • Batch operations: refactor 50 files simultaneously
  • Multi-source research: search 5 databases in parallel
  • Testing: run tests across multiple environments
  • Kimi’s Agent Swarm uses this pattern

Implementation

import asyncio

async def parallel_fanout(files, instruction):
    # Fan out: process files in parallel
    tasks = [
        call_agent("claude-sonnet-4.6", f"{instruction}\n\nFile: {f}")
        for f in files
    ]
    results = await asyncio.gather(*tasks)
    
    # Merge: combine results
    merged = await call_agent("claude-opus-4.6", 
        f"Merge these changes, resolve conflicts:\n{results}")
    
    return merged

Pros and cons

βœ… Fast (N agents work simultaneously) βœ… Scales linearly with parallelizable work ❌ Merge step can be complex ❌ Higher cost (N parallel API calls) ❌ Conflict resolution between agents

Pattern 3: Hierarchical delegation

Manager Agent
  β”œβ”€β”€ Specialist A (research tools)
  β”œβ”€β”€ Specialist B (coding tools)
  └── Specialist C (communication tools)

A manager agent decides which specialist to delegate to based on the task. Each specialist has its own MCP tools.

When to use

  • Complex workflows with different tool requirements
  • Customer support: route to billing, technical, or sales specialist
  • Development: route to frontend, backend, or DevOps agent

Implementation

async def hierarchical(task):
    # Manager decides who handles it
    routing = await call_agent("claude-sonnet-4.6", 
        f"Classify this task: {task}\nOptions: research, coding, communication")
    
    if "research" in routing:
        return await research_agent(task)  # Has web search MCP
    elif "coding" in routing:
        return await coding_agent(task)    # Has filesystem MCP
    else:
        return await comms_agent(task)     # Has email/Slack MCP

Pros and cons

βœ… Each specialist is optimized for its domain βœ… Manager can use a cheap model, specialists use appropriate models βœ… Maps well to MCP (each specialist has its own tools) ❌ Manager can misroute tasks ❌ More complex to set up ❌ Manager is a single point of failure

Connecting to protocols

PatternMCPA2A
SequentialEach agent has its own MCP toolsNot needed (internal pipeline)
ParallelShared MCP tools with conflict resolutionNot needed (same system)
HierarchicalEach specialist has dedicated MCP toolsUseful for cross-vendor specialists

Which pattern to start with

Start with sequential. It’s the simplest, easiest to debug, and handles most use cases. Only move to parallel when you have genuinely parallelizable work, and hierarchical when you need specialized tool access.

See our multi-agent guide for the full implementation guide and our tool calling patterns for how individual agents use tools.

Related: How to Build Multi-Agent Systems Β· Tool Calling Patterns Β· Kimi Agent Swarm Β· MCP Complete Guide