Agent planning patterns: ReAct, plan-and-execute and reflection

GuideLast reviewed Oct 16, 2026By Himanshu Ramchandani
Short answer

Planning is how an agent decides its next step. ReAct interleaves reasoning and tool calls one step at a time, and it is the default for most agents. Plan-and-execute writes a plan first and then carries out the steps, which is more efficient and easier to follow for longer tasks. Reflection adds a step where the agent (or a second model) critiques its own output and tries again. Whatever the pattern, put limits on it: a maximum number of steps, a budget, and a clear definition of done.

Why agents need a planning pattern

A model asked to do a multi-step task in one go tends to skip steps, guess intermediate results and lose track. People don't solve complex problems that way either. We reason about what to do, do a step, look at the result, and decide the next step. Planning patterns are ways to give an agent that same structure.

ReAct: reason, act, observe

ReAct (reasoning and acting) is the most common pattern. The agent repeats a loop:

  1. Thought: reason about the current situation and what to do next.
  2. Action: call a tool with arguments.
  3. Observation: read the tool's result.

It continues until it decides it has the answer.

Take the question: "If a pizza costs $18.75 and I buy three, plus a 15% tip, what is the total?"

Thought: I need the cost of three pizzas first.
Action: calculator("18.75 * 3")
Observation: 56.25
Thought: Now add a 15% tip to 56.25.
Action: calculator("56.25 * 1.15")
Observation: 64.6875
Thought: The total is $64.69.
Final answer: $64.69

This is exactly how you would solve it with a friend: reason about why you multiply, do it, look at the number, and continue. ReAct is flexible and adapts to what it finds, and for long tasks it can wander, repeat steps and use many model calls.

Most modern models do this natively through tool calling, without needing the Thought and Action text format: the model reasons, emits tool calls, and your loop feeds results back.

Chain of thought and tree of thoughts

These are reasoning patterns that also shape how agents plan.

Chain of thought means working through intermediate steps in sequence before acting or answering, the step-by-step reasoning that improves accuracy on multi-step problems.

Tree of thoughts means exploring several possible approaches, evaluating them, and continuing with the most promising one, backtracking when a path doesn't work. It suits decisions with more than one reasonable path, like choosing a strategy, at the cost of many more model calls.

Reasoning models build much of this into the model itself.

Plan-and-execute

Instead of deciding one step at a time, the agent first writes a full plan, then executes it step by step, often with a cheaper model or plain code for the steps, and revises the plan only when something unexpected happens.

Goal: Prepare a summary of last quarter's top 5 support issues with suggested fixes.
Plan:
1. Query tickets from last quarter grouped by category.
2. Pick the 5 largest categories.
3. For each, read 10 sample tickets.
4. Summarise the root cause and propose a fix for each.
5. Write the report.

Plan-and-execute uses fewer expensive reasoning calls, is easier for a person to review before execution starts, and makes progress easy to track. It is less adaptive when early steps change what later steps should be, which is why it usually includes a re-planning step.

Reflection

In reflection, the agent reviews its own output, or a second model does, against the goal or specific criteria, and improves it.

  • After writing code, run the tests, read the failures and fix them.
  • After drafting an answer, check every claim against the sources.
  • After a failed attempt, write down what went wrong before trying again, so the next attempt doesn't repeat it.

Reflection works best when there is real feedback from the environment, like test results, validation errors or a tool response. Self-critique without external feedback helps less, because the model tends to approve its own work.

Choosing a pattern

Task Pattern
Short tasks with a few tool calls ReAct
Longer tasks with predictable structure Plan-and-execute with re-planning
Tasks with a clear check (tests, validation) ReAct or plan-and-execute with reflection on the check
Open-ended decisions with several possible strategies Tree of thoughts style exploration, or a reasoning model
Steps that are always the same Not an agent, a workflow

Stopping and limits

Every agent loop needs clear ways to stop:

  • A definition of done: what the final output must contain.
  • A maximum number of steps.
  • A token or cost budget per task.
  • A time limit.
  • Loop detection: the same tool called with the same arguments repeatedly, or no progress for several steps.
  • An escalation path: when the agent is stuck, it stops and asks a person or explains what it couldn't do.

See agent cost control.

From the floor

The pizza example on this page is the one we used when we first gave an agent a tool in the bootcamp, building a ReAct calculator agent with LangChain and Gemini, and I explained the loop the way you would solve it with an intern or a friend: you have a reason to multiply, you multiply, you look at the number, and you continue.

In the DevFix agent, the loop is plan, write code, run it, check the errors, fix and run the tests again until they pass, with sandboxing so the code runs safely, and reflection on the errors as the feedback that drives each retry.

Next step

Read agent memory.

Sources