AgenTopology

Pipeline

Sequential agent execution where each phase processes the output of the previous one

Pipeline

The pipeline pattern chains agents into a fixed sequence. Each agent completes its work before the next one starts, passing structured output downstream. This is the simplest and most common coordination pattern.

When to Use Pipeline

  • Content creation — research, draft, review cycles
  • Data transformation — extract, transform, load sequences
  • Code generation — plan, implement, test workflows
  • Any workflow with clear phases where each step depends on the previous step's output

Pipeline is the right choice when your agents need to run in order and each agent's input is the previous agent's output. If agents can run independently, consider fan-out instead.

How It Works

Agents are assigned a phase number. Phase 1 runs first, then phase 2, and so on. The flow block defines the edges between agents, including conditional loops for revision cycles.

topology content-team : [pipeline] {
  meta {
    version: "1.0.0"
    description: "Research, write, and review content"
  }

  agent researcher {
    model: sonnet
    phase: 1
    tools: [Read, Grep, WebSearch]
    writes: ["workspace/research.md"]
  }

  agent writer {
    model: sonnet
    phase: 2
    tools: [Read, Write]
    reads: ["workspace/research.md"]
    writes: ["workspace/draft.md"]
    outputs: { confidence: high | medium | low }
  }

  agent reviewer {
    model: opus
    phase: 3
    tools: [Read, Grep]
    reads: ["workspace/draft.md", "workspace/research.md"]
    outputs: { verdict: approve | revise | reject }
  }

  flow {
    intake -> researcher
    researcher -> writer
    writer -> reviewer
    reviewer -> writer  [when reviewer.verdict == revise, max 2]
    reviewer -> done    [when reviewer.verdict == approve]
  }
}

Key Concepts

Phases

Each agent declares a phase number that determines execution order. Agents in the same phase run sequentially (for parallel same-phase execution, combine with the fan-out pattern).

Conditional Loops

The when clause on a flow edge creates conditional routing. The max modifier prevents infinite loops:

flow {
  reviewer -> writer [when reviewer.verdict == revise, max 2]
}

This sends work back to the writer up to 2 times. After 2 revision cycles, the flow continues to the next edge that matches.

File Handoffs

Agents communicate through files. The writes and reads properties make data dependencies explicit:

agent researcher {
  writes: ["workspace/research.md"]
}

agent writer {
  reads: ["workspace/research.md"]
  writes: ["workspace/draft.md"]
}

Flow Diagram

A pipeline flows linearly with optional feedback loops:

intake -> researcher -> writer -> reviewer -> done
                          ^          |
                          |__________|
                        (revise, max 2)

Combining with Other Patterns

Pipeline works well with:

  • human-gate — add approval checkpoints between phases
  • fan-out — run multiple agents in parallel within a single phase
  • supervisor — let an orchestrator manage the overall pipeline while agents handle phases

On this page