Skip to content

// Orchestration · ~2 min read

Sequential Pipeline

Reach for it when: stages are fixed and each step’s output is the next step’s only input.

After this lesson you can: Chain fixed stages so each stage gets only the previous stage’s structured output.

// 60-second mental model

How to hold it in your head

Stage A finishes. Stage B gets only A’s output. Stage C gets only B’s. No sideways chat, no shared scratchpad across stages.

A sequential pipeline runs stages in a fixed order, each working on the previous stage’s output (Anthropic calls this prompt chaining). This lesson teaches the strict version, where each stage sees only a typed handoff from the one before. Some frameworks, such as Google ADK, let stages share state instead — easier, but it invites the drift described below.

How this differs

In Parallel Fan-Out the branches don’t depend on each other, so they can run at once. In a pipeline each stage needs the one before it, so they run in order.

// Mini architecture

Fixed stages · typed handoffs only

Three stages in a row: Stage A extracts, Stage B enriches, Stage C formats. A passes its output to B, and B passes its output to C. Each stage has its own schema: schema A, schema B and schema C.

If B needs something A did not emit, fix the contract — do not let B peek at the original user message unless that is explicit.

// Mini-project

Invoice → JSON → summary pipeline (stub)

Three staged stubs with schemas

Goal: Extract fields from a canned invoice, enrich with a stub rate card, format a one-paragraph summary — each stage sees only the prior JSON.

  1. Stage A: stub OCR text → `{ vendor, amount, date }` JSON.
  2. Stage B: enrich with stub `rate_card` → add `{ category }`.
  3. Stage C: format a summary string from Stage B JSON only.
  4. Validate each handoff against a tiny schema; stop if it does not match.
  5. Prove Stage C never receives the raw OCR text.
  6. Log each stage’s input hash for the demo.

Stubs keep the focus on contracts. Real OCR is optional later.

// Common failure

What goes wrong

Symptom

Hidden shared context — later stages quietly read earlier prompts and drift.

Fix

Pass only the typed handoff. If a field is missing, widen the schema upstream — do not reopen the full transcript.

// Self-reflection

Sit with this

Where are you faking a pipeline with one megaprompt that still sees everything?

Sources

Session only. Nothing is saved.