How do they differ?
Both patterns break a complex task into multiple LLM calls. The difference is who decides what happens next: you or the model.
With Prompt Chaining, you design the pipeline. Step 1 always feeds into Step 2, which always feeds into Step 3. The sequence is predetermined. You know at design time exactly how many LLM calls will happen and in what order. Each step has a specific job, a specific prompt, and a specific output format that the next step expects.
With a ReAct Loop, the model decides what to do next. It reasons about the current state, picks an action (call a tool, search a database, ask a follow-up question), observes the result, and then reasons again about what to do next. The loop continues until the model decides it has enough information to produce a final answer. You do not know at design time how many iterations will happen or which tools will be used.
This is the difference between a recipe and a conversation. A recipe says "chop the onions, then saute them, then add the broth." A conversation says "what do we have in the fridge? Okay, let me check if that pairs well with what we made yesterday. Actually, let me look up a recipe for that ingredient."
| Dimension | Prompt Chaining | ReAct Loop |
|---|---|---|
| Control flow | Predetermined by developer | Determined by model at runtime |
| Number of steps | Fixed and known | Variable and unpredictable |
| Predictability | High (same input produces same pipeline) | Low (model may take different paths) |
| Debuggability | Easy (inspect each step's input/output) | Harder (must trace reasoning decisions) |
| Tool usage | Each step may use a specific tool | Model selects tools dynamically |
| Failure handling | Straightforward (retry step N) | Complex (model might loop or get stuck) |
| Latency predictability | Consistent (fixed number of calls) | Variable (depends on how many loops) |
| Best for | Known workflows, pipelines | Exploration, research, open-ended tasks |
A concrete example
Suppose you need to answer questions about a company's financial performance using their SEC filings.
Prompt Chaining approach:
- Extract the relevant filing date range from the question.
- Retrieve the matching SEC documents.
- Extract key financial metrics from the documents.
- Generate an answer using the extracted metrics.
Four steps, always in that order, always the same pipeline. If the question is "What was Apple's revenue in Q3 2024?" this works perfectly.
ReAct Loop approach: The model receives the question and thinks: "I need to find Apple's Q3 2024 revenue. Let me search the SEC filing database." It searches, gets results, and thinks: "These are the 10-Q filings. Let me read the income statement section." It reads, finds the number, and thinks: "I found revenue of $85.8B. But the question might also be asking about year-over-year comparison. Let me check the previous year's Q3 filing." It searches again, compares, and produces a comprehensive answer.
The ReAct approach might take 3 steps or 7 steps. It might check additional filings the developer did not anticipate. It adapts based on what it finds.
When to use Prompt Chaining
Prompt Chaining is the right choice when you understand the workflow well enough to define it in advance.
- ETL-style data processing. Extract data from a source, transform it through a series of well-defined steps, load it into an output format. Each step has clear input and output schemas.
- Content production pipelines. Generate an outline, then expand each section, then edit for style, then check for factual accuracy. The steps are always the same, though the content varies.
- Multi-stage classification. First classify the broad category, then within that category classify the subcategory, then based on the subcategory apply specific business rules. The tree is known in advance.
- Document processing workflows. Parse a document, extract entities, resolve references, generate a summary. Each step builds on the previous one in a known sequence.
- Guardrail chains. Input validation, then main processing, then output validation. The pipeline structure ensures safety checks always run.
Why predictability matters
The biggest advantage of Prompt Chaining is that you can reason about the system at design time. You know the maximum number of LLM calls, so you can estimate cost and latency. You know what each step does, so you can write targeted tests. You know the interfaces between steps, so you can swap out individual steps without affecting others.
This makes Prompt Chaining dramatically easier to operate in production. When something goes wrong, you look at the step that failed, examine its input and output, and fix the issue. You do not need to trace through an unpredictable reasoning chain to figure out why the model decided to call a tool it should not have.
Conditional branches are fine
Prompt Chaining does not mean strictly linear. You can have conditional branches: "If the document is a contract, go to the contract pipeline. If it is an invoice, go to the invoice pipeline." What matters is that the branches are defined at design time, not decided by the model at runtime.
Think of it as a directed acyclic graph (DAG) rather than a linear sequence. The graph is fixed, even if different inputs traverse different paths through it.
When to use ReAct Loop
ReAct Loop is the right choice when you cannot predict what steps will be needed because the task requires discovery.
- Research and information gathering. When the model needs to search for information, read results, decide what follow-up searches to make, and synthesize findings. The research path depends on what it finds at each step.
- Troubleshooting and debugging. The model examines an error, hypothesizes a cause, checks a log file, revises its hypothesis, checks a configuration file, and eventually identifies the root cause. The diagnostic path varies every time.
- Conversational agents with tool use. When a user asks a complex question that might require checking multiple systems, the model needs to decide which systems to query based on the question and the results it gets back.
- Multi-hop question answering. Questions where the answer requires combining information from multiple sources, and you do not know which sources until you start looking. "Which of our customers in the healthcare sector have contracts expiring in the next 90 days?" requires finding healthcare customers, then checking each one's contract dates.
- Exploratory data analysis. The model runs a query, looks at the results, decides what to investigate further, runs another query, and so on until it has a complete picture.
Managing the loop
The biggest operational challenge with ReAct is controlling the loop. Without guardrails, the model might loop indefinitely, repeating the same action, getting stuck in a cycle, or exploring irrelevant tangents.
Production ReAct implementations need:
- Maximum iteration count. Hard cap at 5-10 iterations. If the model has not found an answer by then, it should produce a best-effort response with what it has.
- Action budget. Limit the total number of tool calls or the total tokens spent. This prevents runaway costs.
- Loop detection. If the model takes the same action twice with the same parameters, interrupt the loop.
- Timeout. A wall-clock timeout that forces a final answer regardless of where the model is in its reasoning.
Can they work together?
Yes, and hybrid architectures are common in production systems.
Prompt Chain with ReAct steps. The overall pipeline is a fixed chain, but individual steps within the chain use ReAct. For example: Step 1 (fixed) classifies the query. Step 2 (ReAct) gathers information using whatever tools are needed. Step 3 (fixed) formats the output according to a template.
This gives you the predictability of a chain where it matters (classification, output formatting) and the flexibility of ReAct where it is needed (information gathering).
ReAct with Prompt Chain sub-routines. The model operates in a ReAct loop but some of its available "actions" are themselves Prompt Chains. When the model decides to "analyze a document," that triggers a fixed four-step analysis chain. When the model decides to "search the knowledge base," that triggers a fixed retrieval chain. The ReAct loop handles high-level strategy while the chains handle well-defined sub-tasks.
Escalation pattern. Start with a Prompt Chain. If the chain's output fails a quality check (confidence too low, missing information, inconsistent results), escalate to a ReAct Loop that has more freedom to explore and find the answer. This keeps costs and latency low for the easy cases and uses the more expensive pattern only when needed.
Common mistakes
Using ReAct when the workflow is well-defined. If you know the steps in advance, a Prompt Chain is simpler, cheaper, faster, and easier to debug. ReAct adds flexibility you do not need and unpredictability you do not want. Teams sometimes reach for ReAct because it feels more "agentic" when a chain would serve them better.
Using Prompt Chaining when the task is exploratory. Trying to predefine steps for an inherently open-ended task leads to brittle pipelines. If you find yourself adding more and more conditional branches to your chain to handle edge cases, you probably need a ReAct Loop.
Not validating between chain steps. Each step in a Prompt Chain should validate its input (the previous step's output). If Step 2 expects a JSON object with specific fields and Step 1 occasionally produces malformed output, Step 2 should catch that rather than silently producing garbage.
Giving ReAct too many tools. The more tools available to a ReAct agent, the more likely it is to use irrelevant ones or get confused about which tool to use. Curate the tool set carefully. Five well-chosen tools outperform twenty loosely related ones.
No observability for ReAct loops. Because ReAct paths vary, you need to log every reasoning step, action, and observation. Without this, debugging production issues becomes nearly impossible. Invest in structured logging that captures the full trace of each ReAct execution.
Ignoring the cost variance of ReAct. A Prompt Chain with four steps has predictable cost. A ReAct Loop might take 2 iterations or 10. If you are budgeting for average cost and some requests hit the maximum, your monthly bill might surprise you. Monitor the distribution of iteration counts, not just the average.
Not testing the degenerate cases. For Prompt Chaining, test what happens when an intermediate step returns empty or error results. For ReAct, test what happens when the model's first action returns no useful information. These edge cases are where production systems break.
References
- Prompt Chaining pattern on genaipatterns.dev
- ReAct Loop pattern on genaipatterns.dev
- Yao et al., "ReAct: Synergizing Reasoning and Acting in Language Models" (2022)
- Wu et al., "AutoGen: Enabling Next-Gen LLM Applications via Multi-Agent Conversation" (2023)
- LangChain documentation on sequential chains and agent architectures
- Anthropic's documentation on tool use and agentic workflows