Three loops, one question: where does the plan live?
Every planning strategy anyone has shipped is an answer to a single question — at what point do you commit to a sequence of steps? ReAct never commits: it decides the next action after seeing the last observation, so its plan is one step long and replanning is free because there is nothing to revise. Plan-and-Execute commits up front: one expensive call produces the whole sequence, and the steps after it can run on a cheaper model, out of order, or in parallel. Reflexion commits to nothing within an attempt and instead wraps the whole attempt in an outer loop, keeping a written critique of the last failure in context for the next try.
They are not competitors so much as three different places to spend a token. ReAct spends on reasoning at every step. Plan-and-Execute spends once and then buys concurrency with the structure it bought. Reflexion spends an entire extra trajectory to buy one lesson. Pick by the shape of the task and by what you have available to tell you that an attempt went wrong — that second thing decides more than anyone expects, and it is where the Reflexion section below turns unpleasant.
The interview version of this question is never "what is ReAct". It is "your agent loops on the same two tool calls for nine turns, what do you change" — and all three strategies have a documented answer.
ReAct: the plan is one step long, and that is the feature
The original ReAct result is smaller than the pattern’s reputation suggests, and the shape of it matters. On HotpotQA with PaLM-540B the paper reports exact match of 27.4 for ReAct against 25.7 for an act-only agent and 29.4 for chain-of-thought — ReAct loses to plain CoT on a benchmark everyone cites it for. On Fever it wins: 60.9 against 58.9 act-only and 56.3 for CoT. The combinations beat both, with ReAct then CoT-SC at 35.1 on HotpotQA and CoT-SC then ReAct at 64.6 on Fever.
Where interleaved reasoning actually dominates is sequential decision-making. ALFWorld: 71% best-trial success for ReAct, 45% for act-only, 37% for the imitation-learned BUTLER baseline — and the paper notes ReAct’s *worst* trial, at 48%, still beats the best trial of either. WebShop: 40.0% success for ReAct against 30.1% act-only and 28.7% for imitation plus RL. The gap between ReAct and Act is the entire value of the Thought step, and it is worth 26 points on ALFWorld and 2 points on HotpotQA. Thinking helps most when the action space is large and the subgoal is easy to lose.
The failure-mode table is the part to memorise, because it explains the whole design. On 200 sampled HotpotQA examples, hallucination accounts for 56% of CoT failures and 0% of ReAct failures. In exchange, reasoning errors are 47% of ReAct failures against 16% for CoT, and 23% of ReAct failures are search results that simply came back unhelpful. Grounding each step against a real observation removes the model’s freedom to invent a fact and replaces it with the freedom to get stuck.
# ReAct, minus the framework. The plan is one step long, by construction.
def react(task, tools, max_steps=12):
scratchpad = [] # thought/action/observation triples
for step in range(max_steps):
msg = model(system=REACT_RULES,
user=task,
history=scratchpad) # the FULL trace, every turn
if msg.final:
return msg.text
obs = tools[msg.action.name](**msg.action.args)
scratchpad.append((msg.thought, msg.action, obs))
raise StepBudgetExceeded(scratchpad) # a budget, not a hope
# What the trade actually is, per the paper's 200-example error analysis:
# hallucination CoT 56% -> ReAct 0% grounding removes invention
# reasoning error CoT 16% -> ReAct 47% and introduces getting stuck
# search failure CoT n/a -> ReAct 23% your retriever is now in scope
# Cost note: every step re-sends the whole scratchpad, so token spend is
# quadratic in steps. A 12-step cap is a budget decision, not a safety net.The loop is the failure mode, and it is cheap to detect
The ReAct paper names the specific way these agents die: the model "repetitively generates the previous thoughts and actions", which the authors count under reasoning error and attribute to greedy decoding, suggesting beam search as a mitigation. The LLMCompiler authors measured the same thing from the outside — roughly 10% of ReAct runs on HotpotQA made more than four function calls, typically looping or diverging, and on Movie Recommendation about 85% of ReAct runs stopped before completing all eight searches they needed.
So do not wait for the step budget to catch it. A no-progress detector is twenty lines: fingerprint each action as its name plus canonicalised arguments, and when a fingerprint repeats with no new information in the observation, that turn was free for the provider and expensive for you. The correct response is not another identical turn with a sterner system prompt — it is to change the agent’s inputs: drop the repeated tool from the available set for one turn, inject the repetition as an observation the model can read, or escalate to a replan. A loop the model cannot see is a loop the model will repeat.
# A no-progress detector. Cheaper than the turns it prevents.
import json, hashlib
from collections import Counter
def fingerprint(action) -> str:
payload = json.dumps([action.name, action.args], sort_keys=True)
return hashlib.sha1(payload.encode()).hexdigest()[:12]
class ProgressGuard:
def __init__(self, repeat_limit=2):
self.seen, self.limit = Counter(), repeat_limit
def check(self, action, observation) -> str | None:
fp = fingerprint(action)
self.seen[fp] += 1
if self.seen[fp] <= self.limit:
return None
# Tell the MODEL about the loop. It cannot see its own repetition.
return (f"You have already called {action.name} with these arguments "
f"{self.seen[fp]} times and the result did not change. "
f"Either use a different tool or state what is missing.")
# In the loop: feed the warning back as an observation, and on the next
# repeat drop that tool from the tool list for one turn. Escalating the
# system prompt does nothing -- the model is not disobeying, it is blind.Plan-and-Execute: the plan buys parallelism, not foresight
The honest case for planning up front is not that the model thinks better with a plan. It is that a plan is a data structure, and data structures can be scheduled. LLMCompiler makes this explicit: a Planner emits a DAG of tasks with placeholder variables for the outputs of earlier tasks, a Task Fetching Unit dispatches each task the moment its dependencies resolve and needs no model of its own, and an Executor runs the ready tasks concurrently. Against ReAct the paper reports up to 3.7x lower latency, up to 6.7x lower cost, and up to roughly 9% better accuracy.
Read the per-benchmark split before you adopt the headline. Movie Recommendation, which is eight independent searches, gets 3.74x latency and 6.73x cost. ParallelQA gets 2.15x. HotpotQA — two sequential hops, one depending on the other — gets 1.80x latency and essentially no accuracy change, 62.00% against 61.52%. The speedup is parallelism, so a chain-shaped task collects none of it. If your plan is a straight line, planning up front has bought you one extra model call and a commitment.
The other real benefit is model mix. Once the sequence exists, the executor steps are narrow — call this tool with these arguments — and narrow steps run fine on a smaller, faster, cheaper model. The expensive reasoning model is called once for the plan and once more per replan, instead of once per step as in ReAct. On a ten-step task that is a different cost structure, not a discount.
# A plan is a DAG with placeholders, which is why it can be scheduled.
PLAN = [
{"id": 1, "tool": "search", "args": {"q": "Oppenheimer director"}},
{"id": 2, "tool": "search", "args": {"q": "Barbie director"}},
{"id": 3, "tool": "search", "args": {"q": "films by $1"}}, # dep on 1
{"id": 4, "tool": "compare", "args": {"a": "$3", "b": "$2"}}, # dep on 3,2
]
def deps(task) -> set[int]:
return {int(v[1:]) for v in task["args"].values()
if isinstance(v, str) and v.startswith("$")}
async def execute(plan, tools, width=8):
done, pending = {}, {t["id"]: t for t in plan}
while pending:
# Dispatch everything whose dependencies have resolved. Tasks 1 and 2
# go out together; this is where the 3.7x comes from.
ready = [t for t in pending.values() if deps(t) <= done.keys()]
if not ready:
raise CyclicPlan(pending) # a model-written DAG is not a DAG
results = await gather_bounded(
[call(tools, substitute(t, done)) for t in ready], width)
for t, r in zip(ready, results):
done[t["id"]] = r
pending.pop(t["id"])
return done
# The split nobody quotes: Movie Recommendation (8 independent searches)
# 3.74x latency / 6.73x cost. HotpotQA (two sequential hops) 1.80x and
# 62.00% vs 61.52% accuracy -- no gain. A straight-line plan buys nothing.A plan is a commitment, so budget for the replan
The failure mode of planning up front is the stale plan: step three returns something the plan did not anticipate, and steps four through nine are now instructions for a world that no longer exists. Every serious implementation therefore has an explicit replan edge, and it is worth looking at how the frameworks encode it. Google’s ADK ships a PlanReActPlanner that instructs the model to tag its output — PLANNING, REASONING, ACTION, OBSERVATION, REPLANNING, FINAL_ANSWER — so the plan and its revisions are parseable artifacts rather than prose. LangChain has gone further and absorbed the pattern into middleware: the plan-and-execute tutorial now redirects to TodoListMiddleware, which hands the agent a write_todos tool and a system prompt for maintaining the list, aimed at multi-step tasks that coordinate several tools.
That convergence is the design lesson. The plan is most useful when it is a mutable artifact the agent rewrites, visible in state, rather than a one-shot instruction consumed at the top. Which means the engineering question is a budget: how many replans before you stop? Unbounded replanning is ReAct with extra ceremony and a worse token profile. Two or three, with the reason for each revision recorded, is a planner.
Reflexion: the outer loop, and the oracle it depends on
Reflexion adds a third loop around the whole attempt. Three components: an Actor that produces the trajectory, an Evaluator that scores it, and a Self-Reflection model that converts the score into written advice stored in memory for the next attempt. That memory is a sliding window of capacity usually set to 1 to 3 — three reflections on ALFWorld and HotpotQA, one for code generation. The results are genuinely strong: ReAct plus Reflexion solves 130 of 134 ALFWorld tasks, a 22% absolute improvement over ReAct across 12 trials, and HumanEval pass@1 goes from a GPT-4 baseline of 80.1% to 91.0%.
Now the part that decides whether you can use it. Those gains ride on an Evaluator that is actually right. On code, the evaluator is a unit test; on HotpotQA it is exact match against a ground-truth answer. Huang et al. put Reflexion in the "use of oracle labels" column and then measured what happens without one: with the model judging its own work, GPT-3.5 on GSM8K goes 75.9 to 75.1 to 74.7 over two rounds, GPT-4 goes 95.5 to 91.5 to 89.0, and CommonSenseQA with GPT-3.5 collapses from 75.8 to 38.1. Their summary is the sentence to carry into design review: the improvements vanish when oracle labels are not available.
Even with a verifier, verify the verifier. The Reflexion paper itself reports a 16.3% false-positive rate from self-generated tests on MBPP Python against 1.4% on HumanEval, and the WebShop runs were stopped after four trials because the agent showed no sign of improving. So the production rule is narrow and it is not "add a reflection step": reflect when and only when something outside the model says the attempt failed — a failing test, a schema validation error, a 4xx from the API, a human rejection. Otherwise you are paying a full extra trajectory for a critique that is statistically likely to make the second attempt worse.
# Reflexion, gated on an EXTERNAL verdict. Ungated, it degrades accuracy.
from dataclasses import dataclass
@dataclass
class Verdict:
passed: bool
signal: str # "unit_test" | "schema" | "http_4xx" | "human"
detail: str
def external_verdict(task, output) -> Verdict | None:
"""Return None when nothing outside the model can judge this."""
if task.tests:
r = run_tests(task.tests, output)
return Verdict(r.ok, "unit_test", r.report)
if task.schema:
r = validate(task.schema, output)
return Verdict(r.ok, "schema", r.errors)
return None # <- do NOT fall back to self-grading
def solve(task, max_trials=3, window=3):
memory: list[str] = [] # Omega in the paper: capacity 1-3
for trial in range(max_trials):
output = actor(task, reflections=memory[-window:])
v = external_verdict(task, output)
if v is None or v.passed:
return output # no oracle -> ship trial 1, do not reflect
memory.append(reflect(task, output, v.detail))
return output
# Why the gate exists -- self-grading, two rounds (Huang et al.):
# GPT-3.5 GSM8K 75.9 -> 75.1 -> 74.7
# GPT-4 GSM8K 95.5 -> 91.5 -> 89.0
# GPT-3.5 CommonSenseQA 75.8 -> 38.1
# And trust the oracle only as far as it earns: self-generated tests had a
# 16.3% false-positive rate on MBPP vs 1.4% on HumanEval.What reasoning models changed, and what they did not
A fair amount of ReAct’s original machinery has moved into the model. Interleaved thinking lets Claude reason between tool calls and reflect on each tool result before acting on it, and in adaptive mode that interleaving happens automatically, so the hand-written "Thought:" line in a scratchpad is now reproducing something the model does natively and better. ADK draws the same distinction in its API: BuiltInPlanner just applies a ThinkingConfig and imposes no structure of its own, while PlanReActPlanner is the prompt-engineered version for models without native thinking.
Two practical consequences. First, the plumbing is strict — thinking blocks must be returned complete and unchanged alongside the tool_use block when you send back a tool_result, and rebuilding or filtering the assistant message gets you a 400. Keep one thinking configuration per assistant turn, and remember that a whole tool-use loop is a single turn. Second, forcing a tool is no longer free: in manual extended thinking a tool_choice that forces tool use returns an error, and several current models reject it outright.
What did not move into the model is everything structural. The model will not invent a step budget, keep a mutable plan artifact your UI can render, schedule two independent tool calls concurrently, or go find an external verifier. Native thinking replaced the Thought line. It did not replace the loop you wrap around it.
The default, and the interview answer
Default to ReAct with a step budget and a no-progress detector, because it is the cheapest thing that works and most tasks are shorter than people think. Add an explicit plan when the task has independent branches worth running concurrently, or when you want expensive reasoning once and cheap execution ten times — and keep the plan mutable with a bounded replan count, two or three. Add a Reflexion-style outer loop only where an external verifier already exists, which in practice means code with tests, structured output with a schema, or an API that returns real errors.
The interview answer is three sentences. The three strategies differ in where the plan lives, and that choice is a cost structure: ReAct re-reasons every step and pays quadratically in scratchpad tokens, Plan-and-Execute pays once for a DAG and gets parallelism and a cheap executor in return — 3.74x on eight independent searches, nothing at all on a two-hop chain — and Reflexion pays a whole extra trajectory per lesson. ReAct’s documented failure is the loop, not hallucination: grounding on observations drove hallucination to 0% of failures against CoT’s 56%, and bought reasoning errors at 47%, so the mitigation is a progress detector that shows the model its own repetition, not a sterner prompt. And reflection without an external verifier makes things worse — self-grading took GPT-4 from 95.5 to 89.0 on GSM8K and GPT-3.5 from 75.8 to 38.1 on CommonSenseQA — so gate it on a failing test, a schema error, or a human, and never on the model’s own opinion of its work.
The one-line version for a design doc: plan when the task has parallelism, reflect only when something outside the model can tell you that you were wrong.
Work the same ideas as a full interview case study, with pressure questions and model answers.