agent-patterns

sequential-pipeline

flowchart TD
    Issue([Issue input]) --> Analyst[ticket-analyst]
    Analyst --> A_Check{Status?}
    A_Check -- BLOCKED --> Halt1([Halt])
    A_Check -- READY --> Builder[code-builder]
    Builder --> B_Check{Status?}
    B_Check -- BLOCKED --> Halt2([Halt])
    B_Check -- READY --> Reviewer[code-reviewer]
    Reviewer --> R_Check{Status?}
    R_Check -- CHANGES_REQUESTED --> Halt3([Halt / escalate])
    R_Check -- APPROVED --> Done([Output ready])

Agents run in a fixed order with structured handoff contracts. Each agent produces a ### Status / ### Handoff block consumed by the next.

How it works

  1. The ticket-analyst parses the issue and produces a structured plan.
  2. The code-builder implements the plan.
  3. The code-reviewer reviews the output and returns a verdict.

A model refusal at any stage is mapped onto the same contract: the stage returns ### Status BLOCKED with the reason in ### Handoff, and the pipeline halts at that stage instead of crashing.

Each stage reads only the ### Handoff block from the previous stage — not the full output. If any stage emits ### Status: BLOCKED, the pipeline halts.

Where it came from

When to use

When not to use

Trade-offs

   
Pro Clear separation of concerns — each agent is focused and auditable
Pro A blocked stage surfaces the failure at the right layer
Con Handoff contracts must be stable — changing the schema breaks downstream agents
Con No backtracking — a flaw introduced in stage 1 propagates through stage 2 before being caught in stage 3

Failure modes