← Lessons

quiz vs the machine

Gold1430

Machine Learning

The Prompt Chaining Patterns

Wiring several prompts in sequence so each output becomes the next input.

5 min read · core · beat Gold to climb

One call is not always enough

Prompt chaining links several model calls so the output of one becomes the input of the next. Instead of one giant prompt, you build a pipeline where each link has a narrow job.

Common patterns

  • Sequential where extract feeds summarize feeds translate, each step refining the last.
  • Router where a first call classifies the request and dispatches to the right specialized prompt.
  • Map then reduce where a prompt runs over many chunks and a final prompt merges the partial results.

Why chain

Each link is short, focused, and testable, which lifts reliability over one overloaded prompt. You can cache stable links, retry only the failing one, and inspect the intermediate outputs to see where a chain went wrong.

Watch the joints

The weak point is the seam between links. A malformed output from one link breaks the next, so validate each handoff, keep a consistent format between steps, and handle failures at each joint rather than only at the end.

Key idea

Prompt chaining wires focused calls into a pipeline where each output feeds the next, raising reliability and debuggability, as long as you validate the handoffs between links.

Check yourself

Answer to earn rating on the learn ladder.

1. What defines prompt chaining?

2. In a router pattern, what does the first call do?

3. Where is a chain most fragile?