Prompt chaining
One task, several steps
Prompt chaining means splitting a task into a fixed sequence of model calls. Each step receives the previous step’s output and does a specific job.
Instead of asking for everything in one prompt, you build the answer in stages.
1. Start with a question and source notes
Our research assistant receives a question and some source material. Its task is to produce a short answer supported by those sources.
Finding the sources is outside this example. We are looking at what happens once they are available.
2. Give each step one job
First, extract the relevant facts. Then turn those facts into an answer. Finally, compare the draft with the sources and identify unsupported claims.
- Extract factsOutput: relevant facts
- Draft answerOutput: a short draft
- Check against sourcesOutput: checked draft or issues
3. Check before continuing
If the first step finds no useful facts, do not ask the next step to invent an answer. Stop and ask for better sources or clarify the question.
Checks can be simple rules or another model call. A model checking another model can still miss errors, so this is a checkpoint, not a guarantee.
4. Keep the route fixed
The developer decides the steps and what happens when a check fails. The model is not choosing a new plan or a tool at each stage. This is still a workflow.
When is it useful?
Use a chain when the task naturally separates into steps you can inspect. It can make failures easier to locate, but adds latency and cost. If one prompt already works well, keep it simple.