ReAct Pattern
Interleave reasoning traces with tool actions for transparent multi-step problem solving.
In plain words
The AI says what it's thinking, does one thing, looks at what came back, and then thinks again.
Think of it like…
A detective writing in a case notebook: "Thought: the alibi doesn't match the train times. Action: check the station logs. Observation: the train was cancelled. Thought: so the suspect couldn't have arrived by train…". Each note explains why the next step is taken and records what was learned.
Where you’ve seen it
Asked "Which is older, the company that makes the ZX-12 router or the one that makes the Pro-8?", a ReAct agent writes: Thought: I need each product's maker. Action: search("ZX-12 router manufacturer"). Observation: Zentel Networks. Thought: now the other. Action: search("Pro-8 router manufacturer"). Observation: Arvo Systems. Thought: now founding dates. Action: search("Zentel Networks founded") … It answers with both dates and the sources, and the trace lets engineers see where a wrong answer first went off course.
Words you’ll hear
- Thought
- A short reasoning step stating what's known and what to do next.
- Action
- A tool call chosen by the reasoning.
- Observation
- The tool result fed back into the context.
- Trace
- The recorded sequence of thoughts, actions and observations.
Visual diagram
Theory & deep dive
How ReAct works and why it helps
In the original formulation the prompt includes few-shot examples of the format Thought: … Action: tool[args] Observation: … and a stop token after each Action so the harness can run the tool and insert the Observation. With native tool calling, the same idea appears as interleaved text and tool calls: the model writes a short rationale, emits a tool call, receives the result and continues. Reasoning traces help in three ways: they decompose the problem, they let the model track what it has found and what's missing, and they make errors visible to humans.
On knowledge-intensive questions, ReAct beats reasoning without tools (which hallucinates) and acting without reasoning (which picks poor queries). It also lets the model recover: if a search returns nothing, the next thought can reformulate the query instead of repeating it.
"Answer using the tools. Use this format: Thought: (your reasoning about what to do next). Action: (a tool call). After the Observation, continue with a new Thought, and finish with Final Answer: (the answer and the evidence you used)."
Limits, safety and modern variants
ReAct's weaknesses: error propagation (a wrong early observation or thought misleads everything after it), repetition (looping on the same failing action), verbosity (every step costs tokens), and trusting observations, since tool results (web pages, documents) can contain injected instructions. Reasoning text isn't a guaranteed faithful account of why the model acted, so use traces for debugging, not as proof of correctness, and avoid showing raw reasoning to end users as an explanation.
Modern reasoning models do much of the "Thought" internally and interleave it with tool calls, so you often don't need to prompt for explicit thoughts; plan-and-execute architectures add upfront planning for long tasks; reflection adds self-checks. Keep the essentials: clear tools, bounded steps, loop detection, verification of final answers, and evaluation of whole trajectories (task success, steps, cost) rather than only final answers.
If the last three Actions are identical searches returning the same empty result, append: "This search returned nothing three times. Try a different query or tool, or say you can't find it." Without this, ReAct agents often repeat themselves until the step cap.
How it works, step by step
Step 1 of 41. Give tools and a format
Provide tool definitions and, if needed, a Thought/Action/Observation format with a stop sequence.
- Native
- tool calling does this
When to use it & trade-offs
What it is
ReAct (Reason + Act), introduced in a 2022 paper by Yao et al., has the model alternate between thinking and acting: a Thought (what do I know, what should I do next), an Action (a tool call), then an Observation (the tool's result), repeating until it can give a final answer. The reasoning guides which action to take, and the observations ground the next thought in real information. Today the pattern is built into most tool-calling agents: the model reasons, calls a tool, reads the result, and continues.
Why it matters: Pure chain-of-thought reasoning can hallucinate because it has no access to facts; pure action loops can flail because they have no explicit reasoning about what to do. ReAct combines both, giving better results on multi-step questions and more transparent traces for debugging. Knowing the pattern and its limits (error propagation, verbose traces, looping) helps you design prompts and decide when a reasoning model or a planner is the better fit.
When to reach for it
- Multi-hop question answering with search tools
- Debugging and research assistants
- Traceable agent behaviour for review
When to avoid or be careful
- Unbounded ReAct loops
- Treating thoughts as a faithful explanation of the model
- Trusting observations from untrusted sources as instructions
Reasoning and acting strategies
Strengths: Grounded, adaptive, transparent.
Watch out: Token-heavy; error propagation; loops.
Strengths: Single call; no tools.
Watch out: Can hallucinate facts.
Strengths: Fewer wasted steps; parallelisable.
Watch out: Plans can be wrong and need replanning.
Interview signals & numbers to know
When this topic comes up
- “What is ReAct?”
- “The agent repeats the same search”
- “ReAct vs chain of thought”
- Interleaved reasoning and tools
- Agent trace review
Benchmarks & rules of thumb
- 2022
- ReAct paper (Yao et al.)
- 3
- parts of a cycle: thought, action, observation
- 5 – 10
- typical cycle limits
Common mistakes & follow-ups
Common interview mistakes
- Allowing unlimited cycles and watching the agent repeat a failing search.
- Believing a confident thought without checking the observation it relied on.
- Following instructions that appear inside an observation.
Likely interviewer follow-ups
- How does ReAct differ from chain-of-thought?
- What are ReAct's failure modes?
- How do reasoning models change the pattern?
Knowledge check
Put it into practice
Practice related interview Q&A
Apply ReAct Pattern with generative AI interview Q&A and hands-on practice.