Prompting & context

Prompt Chaining

Splitting a task into a fixed sequence of prompts, where the output of each step becomes the input of the next.

Prompt 1summarise the meeting notesPrompt 2extract actions from the summaryPrompt 3write an email for the actionsoutput: summaryoutput: action listOne giant promptasks for everything at once, hard to debugA chaineach step small and tested separately

swipe to see the whole diagram →

MEmehmeterkek.com/glossary/prompt-chaining

In plain terms

A single prompt that says “read this report, find the risks, rank them, and write a board memo” asks for four jobs at once, and the model does each of them a little worse. Prompt chaining gives each job its own prompt: one extracts the risks, the next ranks them, the last writes the memo. Each step is simple and gets the model's full attention.

Why it matters

Chaining is the workhorse pattern of production AI. Small steps are more accurate, each can be tested and improved separately, and when something fails you know which step failed. It also allows a cheap model for the easy steps and a stronger one where it matters. The price is more calls and more latency.

Example

A legal team's contract-review tool runs four prompts in order: extract the clauses, classify each by type, compare each against the company's standard positions, and draft a summary of deviations. When reviewers complain that indemnity clauses are misjudged, the team fixes the comparison prompt alone and reruns its tests.

Most often confused with

Prompt Chaining vs. Agent

Prompt ChainingA fixed sequence written by the developer
AgentA loop in which the model chooses the next step

In a chain the steps and their order are decided in advance and never vary. An agent decides at run time what to do next and when to stop. Chains are predictable and easy to audit; agents handle tasks whose steps cannot be known beforehand. Many systems start as a chain and add agentic steps only where needed.

Under the hood

Design points: give each step one job and a clear output format, preferably structured, so the next step can parse it; pass forward only what the next step needs; insert programmatic checks (gates) between steps to stop or retry on bad output; run independent steps in parallel. A common extension is a review step in which a second prompt critiques the first one's output. Because control flow lives in code, chains fit standard software practice: unit tests per step, logging, retries. Prompt chaining is the simplest of the agentic workflow patterns.

Written by Mehmet Erkek · Last updated: