Designing Multistep Reasoning Pipelines
This lesson explains how to design pipelines for complex questions that need several reasoning steps, and when reasoning models make explicit pipelines unnecessary.
Learning outcomes
After completing this lesson, you will be able to:
- Distinguish question decomposition from plan-and-execute.
- Explain when a reasoning model replaces an explicit pipeline.
- Identify the checks that keep a multistep pipeline reliable.
Decomposition patterns
A single model call handles a focused question well, but it struggles when a question has several parts, needs evidence from different sources, or involves more content than fits in the context window. Decomposition addresses this by breaking the work into smaller steps, each handled by its own model call, retrieval or tool call, and then combining the results. A multistep reasoning pipeline is the sequence of those steps. Three decomposition patterns are common.
Question decomposition asks a model to split a complex question into sub-questions, answers each with retrieval or tools, and then runs a synthesis step that combines the answers.
Plan-and-execute has a planner produce an explicit plan, an executor carry out each step, and the planner revise the plan as results arrive.
Map-reduce applies the same prompt to many chunks, for example summarizing each chapter (the map step), and then combines the partial results (the reduce step). It handles content larger than the context window.
The patterns suit different shapes of problem. Decomposition fits a question whose parts are known from the start and can be answered independently: "compare the leave policies in France and Germany" becomes two retrievals and a comparison. Plan-and-execute fits a task whose later steps depend on what earlier steps find: investigating why an order was delayed may require checking the warehouse system only if the carrier system shows no problem, so the plan must be revised as results arrive. Map-reduce fits a task that is the same operation repeated over a large body of content, such as extracting risks from every section of a 300-page report and then ranking them.
Independent sub-tasks can run in parallel, which reduces latency: the two leave-policy retrievals, or the map step over each report section, do not have to wait for one another. Sequential dependencies cannot be parallelized, which is one reason plan-and-execute designs are slower and need run limits.
Choose the pipeline pattern
Reasoning models
Reasoning models perform much of this decomposition internally: they generate reasoning tokens before answering and can call tools between reasoning steps. For many complex tasks, a reasoning model with the right tools replaces an explicit pipeline. The reasoning effort setting trades depth against latency and cost, and a reasoning summary can be requested to show the steps for review. Explicit pipelines remain useful when each step must be audited, when steps use different models or tools, or when parts of the work must run in parallel.
Keeping pipelines reliable
Multistep pipelines compound errors, so each step needs validation: structured outputs for intermediate results, checks that required evidence was found, and limits on the number of steps and tool calls. Every step is traced so that a wrong final answer can be traced back to the step that failed, and the pipeline is evaluated end to end and per step.
Choosing a pattern
The right design depends on how the work divides and how much control is needed over each step. A reasoning model with tools is the simplest option and should be tried first, because it needs no orchestration code. An explicit pipeline is chosen when the steps must be inspected, use different models or tools, or must run in parallel. The following table compares the patterns.
| Pattern | Suits | Main cost |
|---|---|---|
| Reasoning model with tools | Complex questions where the model can plan its own steps | Less control over individual steps; reasoning tokens add cost |
| Question decomposition | Questions with independent parts, each needing its own retrieval | An extra call to split and another to synthesize |
| Plan-and-execute | Long tasks whose plan must adapt to intermediate results | More calls and state to manage |
| Map-reduce | Content larger than the context window, such as long reports | One call per chunk plus a combining step |
Patterns can be combined. For example, a plan-and-execute agent can use map-reduce for one step that summarizes a large set of documents, while a reasoning model performs the final synthesis.
Comparing suppliers
Procurement analysts ask questions such as "Which of our three cable suppliers had the lowest defect rate last quarter, and do their contracts allow price increases?" Data is in a SQL database and contracts are in an Azure AI Search index.
The question has independent parts: defect rates per supplier (a SQL tool) and price clauses per contract (retrieval). A reasoning model with both tools can plan and execute the steps; if the analysts must audit each step, an explicit pipeline that decomposes the question, runs the parts in parallel and synthesizes the answer with citations is preferable. A single RAG query over contracts alone could not answer the defect-rate part.
When should an explicit pipeline be kept instead of a reasoning model with tools?
Show answer
When each step must be audited. A reasoning model with tools can otherwise handle the steps itself.
Exam Tips
Remember for the exam
- Decompose complex questions; answer each part with the right tool; synthesize with citations.
- Reasoning models with tools can replace explicit pipelines unless each step must be audited.
- Validate intermediate outputs and cap steps to keep pipelines predictable.