What is prompt chaining?
Prompt chaining is a workflow pattern that splits a task into a fixed sequence of language model calls, where each call works on the previous call's output and code checks can sit between steps.
Prompt chaining is the first of the five workflow patterns in Anthropic's "Building effective agents" (December 2024). A task is broken into steps, each step is a separate model call, and programmatic checks, which Anthropic calls gates, can sit between them to catch a bad intermediate result before it travels further. The trade is a little more latency for higher accuracy, because each call has an easier job.
Anthropic's examples are writing marketing copy and then translating it, or writing an outline, checking it against criteria and only then writing the document. Google's ADK calls the same shape a sequential pipeline, in which each agent writes its result to shared session state for the next one to read.
How a prompt chain is built
Steps
Each step has one job and its own prompt, such as extract, classify, draft or translate.
Structured hand-offs
Steps pass data in a defined format, ideally a schema, so the next step does not have to guess what it received.
Gates
Code between steps checks the intermediate output: required fields present, values in range, length within limits.
Retries and exits
A failed gate retries the step, routes to a fallback or stops the chain with a clear error.
When chaining fits
Chaining fits when a task can be cleanly decomposed into fixed subtasks. If the steps change from input to input, routing or an agent loop is the better match. The broader choice between a fixed path and an agent is covered in the agentic workflow entry and the workflow versus agent comparison.
Google's post on ADK 2.0 (July 2026) makes the cost argument for fixed paths: moving routing out of the model cut tokens by about 50% and latency by about 20% in its refund example.
Where chains break
Errors that travel
A mistake in step one becomes the input to step two. Gates exist to stop this, but only if they check meaning as well as format.
Latency that adds up
Every step is a model call, so long chains get slow. Independent steps can often run in parallel instead.
Hidden coupling
Changing one step's prompt can change what the next step receives. Each step needs its own eval set, plus an end-to-end one.
How Motiontic's engineers apply it
Motiontic's engineers use chains for the predictable parts of a client process, such as extracting fields from a document and then validating them against a system of record, with a gate after every model step. Steps that need open-ended judgement are the ones handed to an agent.
A prompt chain compared with one large prompt
| One large prompt | Prompt chain | |
|---|---|---|
| Model calls | One | One per step |
| Latency | Lower | Higher, unless steps run in parallel |
| Accuracy on multi-part tasks | Drops as the prompt asks for more at once | Higher, since each call has one job |
| Where errors are caught | Only in the final output | At a gate after each step |
| Testing | End to end only | Per step and end to end |
Common questions
What is the difference between prompt chaining and chain of thought?
Chain of thought asks one model call to reason step by step before answering. Prompt chaining splits the work into separate calls, with code in between that can check, transform or reject each result.
Is prompt chaining an AI agent?
No. In a prompt chain, code fixes the order of steps. In an agent, the model decides its own next step. Chaining is a workflow pattern.
How does prompt chaining relate to an agentic workflow?
Prompt chaining is one of the patterns an agentic workflow can use, alongside routing, parallel steps, orchestrator and workers, and generator-critic loops.
Related
Agentic workflow
Model calls on a path set in code: predictable, cheaper and easier to test than a free-running agent.
Workflow vs Agent
A path fixed in code, compared with a model that chooses its own steps.
Routing (agent pattern)
Classify first, then send each input to the branch built for it.
Eval
Repeatable, scored tests that tell a team whether an AI change made things better or worse.
AI agent development
Agents that do real work for users, with the evals, traces and guardrails to keep them in production.
Running agents that have to hold up?
Describe the agent, the systems it touches and what it must never get wrong. The first call is with a lab engineer, who will say plainly whether it is ready for production, and whether Motiontic is the right team.