AI CompendiumA public chart of the language
Home / Patterns of Work / Prompt Chaining
Patterns of Work

Prompt Chaining

Break the job into steps and let each one be checked.

Definition

A workflow where the output of one model call becomes the input of the next, each step doing one thing. The trade-off is latency, bought back as accuracy and diagnosability at every stage.

The gain over one large prompt is that you can put a deterministic check between the steps, and that a failure localises to a stage. When users see the intermediate artifacts, it also becomes the difference between a pipeline they can correct and one they can only re-run.

The cost of chaining is latency multiplied by the number of steps and errors that compound through them. The benefit is that every step is inspectable and checkable — and where you can put a deterministic check between steps, a chained pipeline is far easier to trust than one large prompt.

How people use it
A document workflow.
"Extract, then verify the extraction, then draft, then check the draft against the source. Four prompts, four places to see what went wrong."
Worked example

Where the check goes

Extract structured data, then summarise it.

Validate the extraction against a schema before the summary exists. A bad extraction then fails immediately and cheaply, instead of becoming a fluent summary of nothing — which is the difference between a caught error and a confident one.

Sources
  • blogBuilding effective agents ↗Anthropic Engineering · 2024

    Draws the line between fixed workflows and agents that choose their own process, and names the core patterns: chaining, routing, parallelisation, orchestrator-workers, evaluator-optimizer.

  • blogBuilding agents with the Claude Agent SDK ↗Anthropic · 2025

    States the agent loop plainly — gather context, take action, verify work, repeat — and shows subagents and compaction as context-isolation tools.

Related terms