Prompt chaining means giving an AI model a task in small steps instead of one big request; each answer becomes the input for the next step. A webshop could have the model pull the specifications from a supplier's datasheet, write a product text from them, then check that text against the specifications. Each step is simpler, and you can check its result before the next one starts.
Where does the term come from?
Wu, Terry and Cai (University of Washington and Google Research) described the idea in 2021 as AI Chains: steps of a large language model linked so that the output of one step becomes the input for the next. In their user study, 20 participants wrote a constructive peer review and created flashcards, once with a chain and once in an ordinary interface with the same model. Two independent raters preferred the chained results 85% and 80% of the time, and participants found the chain more transparent and easier to control. A follow-up, PromptChainer (2022), let people build such chains visually. Chain-of-thought is a different technique: there the model reasons step by step within a single answer (see chain-of-thought).
How does it work?
Anthropic's Building effective agents (December 2024) lists prompt chaining as the first workflow pattern: each call to the model processes the output of the previous one, and your code can add checks between the steps, a "gate", to see whether the process is still on track. Its examples are writing marketing copy and then translating it, and writing an outline, checking it against criteria and then writing the document. The aim is to "trade off latency for higher accuracy, by making each LLM call an easier task".
Each step gets its own prompt, and a step that must hand over data can return it in a fixed format such as JSON (structured output), so the next step or your code can read it. According to Anthropic's prompting guide, the most common chain is self-correction: generate a draft, have the model review it against criteria, then have it refine the draft based on the review. Because each step is a separate API call, you can log, evaluate or branch at any point. Anthropic advises starting with the model's API directly, since many patterns take only a few lines of code; frameworks are covered under AI orchestration.
Where does it go wrong?
- It needs fixed steps. Anthropic recommends chaining when a task splits cleanly into fixed subtasks. When the number of steps cannot be predicted, an AI agent that chooses its own path fits better.
- It is slower. Every step is an extra call to the model, and you pay for each one.
- Errors carry over. A wrong value in step 1 ends up in every later step, unless a check between the steps catches it.
- Models now do more on their own. In September 2026, Anthropic's guide says that Claude handles most multi-step reasoning internally, with adaptive thinking and subagents, and that explicit chaining remains useful when you need to inspect intermediate results or enforce a fixed pipeline.
Example
Suppose a webshop receives datasheets from suppliers and wants a product page in Dutch and English for each item. Step 1 extracts the specifications into a fixed list, and a few lines of code check that every required field is filled. Step 2 writes the Dutch product text from that list. Step 3 has the model compare the text with the list and flag any claim the list does not support, and step 4 corrects the text. Step 5 translates the approved text into English. If a product page contains an error, the logged output of each step shows where it came in.
Sources
- Anthropic: Building effective agentsRSS
- Wu, Terry and Cai: AI Chains, Transparent and Controllable Human-AI Interaction by Chaining Large Language Model Prompts (2021)arXiv
- Anthropic: Prompting best practices, chain complex promptsWeb
- Wu et al.: PromptChainer, Chaining Large Language Model Prompts through Visual Programming (2022)arXiv
