Prompt chaining means splitting a complicated task into a sequence of smaller prompts, where each model call works on the output of the previous one. Instead of asking for a researched, formatted, fact-checked report in one go, you ask for an outline, then a draft, then a review, then a final version. Anthropic’s engineering team describes the pattern as trading a little speed for accuracy by making each call an easier task, and it is one of the simplest ways to make an AI workflow more dependable.
What prompt chaining is
In its post on building effective agents, Anthropic defines prompt chaining as decomposing a task “into a sequence of steps, where each LLM call processes the output of the previous one.” You can add programmatic checks, which it calls gates, on any intermediate step to make sure the process is still on track. The approach is best when the task splits cleanly into fixed subtasks, and its main goal, in the post’s words, is to trade latency for higher accuracy.
Think of it as an assembly line. Each station has one job, a short instruction and a clear input. If something goes wrong, you can see which station caused it, which is far harder with a single sprawling prompt.
When a chain beats a single prompt
A single prompt is fine for short, self-contained requests. A chain starts to pay off when:
- The task has distinct phases that need different instructions, such as extract, analyze, write and format.
- You need to inspect intermediate results. Anthropic’s documentation says explicit chaining is still useful when you need to inspect intermediate outputs or enforce a specific pipeline structure, even though newer models handle much multistep reasoning internally.
- One step needs a different format. For example, step one returns structured data and step two turns it into prose.
- Quality control matters. You can insert a check between steps, by code or by another model call, before anything reaches the user.
If the task is simple, adding steps just adds cost and delay. Start with one prompt, test it, and split only where you see a specific failure.
The self-correction chain
Anthropic’s documentation calls the most common pattern 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 call, you can log, evaluate or branch at any point. This is a good first chain to try because it needs no special tooling.
A worked example
Suppose you want a short, accurate summary of a long customer-feedback document for your leadership team. Here is a three-step chain.
Step 1: extract. Prompt: “Read the feedback below. List every distinct complaint and request as bullet points, one per line. Quote the shortest supporting phrase for each. Do not summarize or judge.” Output: a raw list.
Step 2: group. Prompt: “Here is a list of feedback points. Group them into at most five themes. For each theme give a name, a count of how many points belong to it, and the two most representative quotes. Output as a table.”
Step 3: write. Prompt: “Using only the table below, write a 150-word summary for executives. Lead with the biggest theme. Do not add facts that are not in the table.”
Each step has a narrow job. If the summary overstates something, you can open the table from step 2 and see whether the error came from grouping or writing. A single prompt asking for all three would hide that.
Add gates between steps
A gate is a check that decides whether the chain continues. Simple gates need no model at all:
- Format checks. Is the output valid JSON? Does the table have the expected columns?
- Length and content checks. Is the summary within 150 words? Does it mention each theme?
- Citation checks. Does every quoted phrase actually appear in the source text? A string search can verify this.
- Model-based review. Ask a second call to grade the draft against a short rubric and return “pass” or a list of fixes.
When a gate fails, you can retry the step, send the problem back with the error message, or stop and flag it for a person. Our guide to structured outputs and function calling explains how to make steps return machine-readable data so gates are easier to write.
Tips for writing good links in the chain
- Give each step one job. If a prompt contains “and then,” consider splitting it.
- Pass only what the next step needs. Long, noisy inputs invite mistakes and cost more.
- Separate content from instructions. Anthropic’s guidance recommends wrapping different kinds of content, such as instructions, context and input, in their own tags, such as
<document>, to reduce misinterpretation. Clear delimiters help in any model. - Specify the output format of every step, because the next prompt depends on it.
- Keep the system prompt stable and put step-specific instructions in the user message. See our guide to writing a system prompt.
- Test each step alone with a handful of real inputs before connecting them.
Common mistakes
- Chaining everything. Every call adds latency and cost. Use a chain where it fixes a measured problem.
- Letting errors cascade. If step one invents a fact, every later step will treat it as true. Verify early outputs against the source.
- Hidden state. Do not rely on the model “remembering” earlier steps in a fresh call; pass what is needed explicitly.
- Skipping evaluation. Compare the chain’s results with the single-prompt baseline on the same examples. If the chain is not clearly better, simplify.
- Confusing chaining with agents. A chain follows a fixed path you designed. An agent decides its own steps. Anthropic treats chaining as a workflow for predictable tasks. For a comparison of approaches, see what AI agents are.
What to watch next
- How much newer models with built-in step-by-step reasoning reduce the need for explicit chains.
- Frameworks that automate gates and retries, and whether they hide too much.
- Evaluation tools that score each step of a chain separately.
- Provider guidance updates as models change; always recheck documentation.
Key takeaways
- Prompt chaining feeds each model call the output of the previous one.
- It suits tasks that split cleanly into fixed subtasks and trades speed for accuracy.
- The draft, review, refine pattern is the easiest chain to start with.
- Gates, whether code checks or model reviews, keep errors from cascading.
- Add steps only where a single prompt demonstrably fails.
Frequently asked questions
What is prompt chaining?
It is a technique in which a task is broken into a sequence of prompts, with each model call using the previous call’s output as its input.
Is prompt chaining the same as chain-of-thought prompting?
No. Chain-of-thought asks a model to reason step by step within one response. Chaining uses separate calls, which lets you inspect and check each stage. See our chain-of-thought explainer.
Do I still need chains with modern reasoning models?
Often less, since newer models handle much multistep reasoning internally. Chains remain useful when you need to inspect intermediate outputs or enforce a fixed pipeline.




