Agent Patterns: ReAct, Plan-and-Execute and Reflection
By the Katkat team · Updated · 10 min read
Quick overview
Learn how ReAct, Plan-and-Execute and Reflection agents work, what each costs in tokens and latency, how they fail, and how to choose one in an interview.
After this lesson you will be able to describe the three most common agent control patterns (ReAct, Plan-and-Execute and Reflection) and say when each one earns its cost. You will be able to estimate their token and latency overhead with real arithmetic, and name the characteristic failure of each. You will also be able to defend a choice for a given task instead of saying "use an agent".
The three patterns at a glance
All three wrap a language model in a loop. They differ in where the decision-making happens.
| Pattern | Core idea | Best for | Main cost driver | Signature failure |
|---|---|---|---|---|
| ReAct | Alternate reasoning and actions, one step at a time | Open-ended tasks where the next step depends on the last result | Growing context re-sent on every step | Looping or drifting |
| Plan-and-Execute | Write a plan up front, then carry out each step | Tasks with a predictable structure and independent sub-steps | Planner call plus extra calls per step | Stale or wrong plan |
| Reflection | Produce a draft, critique it, revise it | Output with a checkable quality bar (code, structured writing) | Extra critique and revision calls per round | Self-approval without improvement |
These patterns are not exclusive. Real systems often use Plan-and-Execute at the top, ReAct inside each step, and Reflection on the final output.
ReAct: reason, act, observe
ReAct (from the paper "ReAct: Synergizing Reasoning and Acting in Language Models") interleaves a short reasoning trace with a tool action. Each turn the model writes a thought, picks an action, receives an observation, and repeats until it decides to answer.
Mechanically it is the standard tool-calling loop described in Tool Calling and the Agent Loop. The model sees the full history (system prompt, task, every prior thought, action and observation) and emits the next step. Nothing is decided in advance.
Why it helps:
- The agent adapts. If a search returns nothing, the next thought can change the query.
- It needs no planning scaffold, just a prompt and tools.
- The trace is readable, which makes debugging easier.
Why it hurts:
- Every step is a sequential model call, so latency grows linearly with the number of steps.
- Context grows each turn, and the whole prefix is processed again on the next call unless it is cached.
- With no global view, the model can wander, repeat itself, or stop too early.
Use ReAct when you cannot know the steps ahead of time: debugging an unfamiliar error, researching a question, exploring a database schema.
Plan-and-Execute: decide first, then do
Here a planner call produces an explicit list of steps, and an executor works through them. The executor may be another LLM call per step, a plain function, or a ReAct loop scoped to a single step. A final call often synthesises the results.
Why it helps:
- Independent steps run in parallel. If steps 2, 3 and 4 do not depend on each other, they can run at the same time.
- Executor calls can be cheaper. Each one sees only its step and a small amount of context, so you can route them to a smaller model (see Model Routing and Fallbacks).
- The plan is inspectable. You can validate it, show it to a user for approval, or log it for evaluation.
Why it hurts:
- The plan is made with the least information. If step 2 reveals that step 3 is pointless, a rigid executor carries on anyway.
- A bad plan poisons everything downstream.
- For a task that needs two tool calls, a planner call is pure overhead.
The usual remedy is re-planning: after each step (or when a step fails) the planner sees the results so far and may revise the remaining steps. This recovers adaptivity at the price of more planner calls.
Use Plan-and-Execute when the task has a recognisable shape, such as "gather data from five sources, then write a report", or when you want a human to approve the plan before anything runs.
Reflection: critique and revise
Reflection adds a feedback step. The model produces an output, a critic (the same model with a different prompt, a different model, or an external checker) evaluates it, and the model revises. One round is draft, critique, revision. The Reflexion paper extends the idea to agents that write verbal lessons from failed attempts and carry them into later attempts.
The key variable is where the feedback comes from:
- Grounded feedback comes from outside the model: unit tests, a compiler, a schema validator, a retrieval check against source documents. This works reliably because the signal is real.
- Ungrounded feedback is the model judging its own prose. This helps less than people expect. A model that made an error often cannot see it on a second read, and it may "fix" correct content.
Use Reflection when you have a verifier (code with tests, JSON with a schema, SQL you can execute) or a clear rubric and the cost of a wrong first draft is high. Do not use it as a general quality boost on simple questions. For rubric-based critics, see LLM Evaluation and LLM-as-a-Judge for the biases to watch for.
Worked example: cost and latency
Take one task needing 5 tool calls. These numbers are illustrative assumptions, not benchmarks.
- System prompt plus tool definitions: 1,500 tokens. User task: 200 tokens, so the starting context is 1,700.
- Each ReAct step: the model writes 100 tokens (thought plus action) and the tool returns 400 tokens, so context grows by 500 per step.
- The final answer is 200 tokens.
- Decode speed is 50 tokens per second, each tool call takes 0.5 s, and we ignore prefill time.
ReAct. There are 6 model calls (5 tool steps plus the answer). Input sizes are 1,700, 2,200, 2,700, 3,200, 3,700 and 4,200. They sum to 17,700 input tokens. Output is 5 × 100 + 200 = 700 tokens. Latency is 700 / 50 = 14 s of decode plus 5 × 0.5 = 2.5 s of tools, about 16.5 s.
Plan-and-Execute. The planner reads 1,700 tokens and writes a 150-token plan. Each of 5 executor calls reads 2,000 tokens (system prompt, step description, a short summary of prior results) and writes 60 tokens of tool arguments. The final call reads 1,700 + 150 + 5 × 400 = 3,850 tokens and writes 200. Input is 1,700 + 5 × 2,000 + 3,850 = 15,550 tokens, about 12% less than ReAct (2,150 / 17,700). Output is 150 + 300 + 200 = 650 tokens. That is 7 calls instead of 6. If all steps run in sequence, latency is 3 s (planner) + 6 s (executors) + 4 s (final) + 2.5 s (tools) = 15.5 s, barely better than ReAct. If steps 2, 3 and 4 are independent and run in parallel, the executor phase is 3 stages of (60 / 50 + 0.5) = 1.7 s each, or 5.1 s. Total is 3 + 5.1 + 4 = 12.1 s, about 27% faster than ReAct.
Reflection, one round on top of either. The critic reads 2,000 tokens (system prompt, task, 200-token draft, 100-token rubric) and writes 150. The revision reads 2,000 + 150 = 2,150 tokens and writes 200. That adds 4,150 input tokens, 350 output tokens, and 350 / 50 = 7 s of latency. On the 16.5 s ReAct run, one round brings it to about 23.5 s.
Lessons from the numbers:
- Plan-and-Execute is not automatically cheaper. Its gains come from parallelism and cheaper models for steps, not from the pattern itself.
- ReAct's input cost grows roughly quadratically with step count, because each call re-sends everything before it. Prefix Caching reduces this when the history is an unchanged prefix.
- Reflection costs latency in strict sequence, with no way to parallelise a revision before its critique.
Failure modes
| Pattern | Failure | What it looks like | Mitigation |
|---|---|---|---|
| ReAct | Looping | Same tool call with the same arguments repeated | Step limit, repeated-call detection, error messages that say what to change |
| ReAct | Context bloat | Long tool outputs crowd out the task, quality drops | Truncate or summarise observations, return only needed fields |
| ReAct | Premature answer | Agent stops after the first plausible result | Require evidence in the answer, add a verification step |
| Plan-and-Execute | Stale plan | Step 4 runs on assumptions step 2 disproved | Re-plan on failure or unexpected results |
| Plan-and-Execute | Bad decomposition | Missing or mis-ordered steps | Validate the plan against tool availability, human approval for risky tasks |
| Plan-and-Execute | Lost context | Executor lacks information from earlier steps | Pass structured intermediate results, not free text |
| Reflection | Rubber-stamping | Critic says "looks good" every time | Use external verifiers, a specific rubric, or a different model as critic |
| Reflection | Regression | Revision breaks something that was right | Keep the original, compare, revert if checks get worse |
| Reflection | Endless rounds | Revising forever with no convergence | Cap rounds (usually 1 to 3), stop when the checker passes |
Any pattern also inherits general agent risks: a tool result containing hostile instructions, runaway cost, and side effects from actions that cannot be undone. Read An Agent Keeps Looping: How Do You Fix It? and Making Agents Reliable: Retries, Timeouts and Checkpoints for the engineering controls.
Choosing and combining
A practical decision sequence:
- Can a single call or a fixed workflow do it? If the steps are known and always the same, write a pipeline. This is cheaper and more predictable than any agent pattern.
- Do the next steps depend on previous results? Use ReAct, with a step cap.
- Is the structure predictable, with independent parts or a need for approval? Use Plan-and-Execute, with re-planning on failure.
- Is there a verifier or a clear rubric, and does correctness matter more than speed? Add Reflection, grounded in tests or validators where possible.
A common production shape: a planner breaks the request into steps, each step runs a small ReAct loop with a tight budget, and the final artefact goes through one verify-and-revise round. Evaluate each layer separately (see Evaluating Agents), because a good final answer can hide an inefficient or lucky path.
How does this come up in interviews?
1. "When would you choose Plan-and-Execute over ReAct?" Choose it when the task has a predictable structure, when sub-steps are independent and can run in parallel, or when you want the plan reviewed before execution. ReAct is better when each step depends on the last observation. Mention that Plan-and-Execute needs re-planning to cope with surprises.
2. "Your ReAct agent takes 12 steps and users complain about latency. What do you do?" First read traces to see why: repeated calls, needless exploration, or slow tools. Then cut steps (better tool design, tools that return exactly what is needed), parallelise independent calls, cache the stable prefix, use a smaller model for easy steps, and stream progress to the user. If the structure is predictable, move to a plan with parallel execution.
3. "Does adding a reflection step always improve quality?" No. It helps most when feedback is grounded, such as tests, a schema check or source verification. When the model judges its own output with no external signal, it often approves its own mistakes or changes correct text. Measure with an evaluation set, cap the rounds, and keep the original if the revision scores worse.
4. "How would you estimate the cost of a ReAct agent?" Count model calls and sum the input tokens for each, since every call re-reads the history. With a starting context S and growth g per step over n steps, input is roughly n × S + g × n(n−1)/2, plus the final call. Then apply prices for input and output tokens, and note that caching can lower the repeated-prefix cost.
5. "How do you stop a planner from producing a bad plan?" Give the planner the real tool list and constraints, ask for a structured plan, and validate it in code (known tools, valid arguments, no circular dependencies). Allow re-planning when a step fails. For high-impact actions, require human approval of the plan before execution.
Common mistakes
- Treating the patterns as competitors rather than layers that can be combined.
- Claiming Plan-and-Execute is always cheaper or faster, without separating the parallelism and smaller-model effects from the pattern itself.
- Using Reflection with no external check and assuming the model will catch its own errors.
- Forgetting that ReAct re-sends the growing history on every call, so cost grows faster than step count.
- Having no step limit, token budget or repeated-call detection.
- Dumping raw, long tool outputs into the context instead of trimming them.
- Using an agent at all when a fixed pipeline would do.
- Judging only the final answer and ignoring the path (wasted steps, unsafe actions, lucky guesses).