Back to the map

Module 10 · The agent loop · Lesson 4 of 5

Planning: ReAct, plan-and-execute, reflection

How an agent picks its next step: interleaved thinking and acting, plan-and-execute with replanning, reflection with a critic, and search as the dear extreme; what reasoning models absorbed, and the cost and failure mode of each.

DeepMust-knowMid 14 minPro Updated Nov 2026

Why it matters

The loop says the model picks the next action on every lap; it does not say how. A model that acts on its first idea wanders. A model that plans everything up front follows the plan after the world has changed. A model that keeps criticising its own draft never stops. The planning style is the largest lever on how many laps an agent takes, and so on cost and latency. Interviewers want to hear when each named style pays and how it fails.

The idea

Interleaved reasoning and acting

The oldest style alternates a short thought with one action. The model writes why it is about to do something, calls one tool, reads the observation, and thinks again. It has no plan beyond the next step, which is its strength: every decision uses the latest observation. It is the default shape of native tool use, where the thought is a sentence of text before the tool-use block. Cost is one model call per lap.

Plan and execute

The second style splits planning from doing. One call writes a numbered plan: the steps, the tool each needs, what done looks like. A cheaper loop then executes the steps, often on a smaller model, and a check after each step asks whether the plan still holds. On a surprise, a failed step or an observation that contradicts a premise, the planner is called again and rewrites the rest. The plan gives the run a shape you can show a user, approve before execution and log; the price is that it was written before any evidence arrived.

Reflection

The third style adds a critic. After a draft answer, or after a trajectory of several laps, a call examines the work against the task and lists what is wrong. The agent retries with the critique in context. Reflection catches errors the actor could not see while acting, and it is the backbone of evaluator-optimizer workflows. It costs at least two calls per attempt and usually three (draft, critique, revise), and it needs a reason to stop: a critique that says good enough, or a cap on rounds.

The expensive extreme explores several candidate next steps at once, scores them, keeps the best and expands again: a tree of partial trajectories rather than a single line. It wins on puzzles where early choices are hard to undo and a wrong branch is cheap to abandon. It multiplies cost by the branching factor at every depth, so it rarely fits a product and almost never a latency budget.

interleavedThinkActObserverepeatplan-and-executePlanStep 1Step 2Replanon surprisereflectionDraftCritiqueReviseretrycalls: 1 per lap; 1 plus n plus replans; 2 to 3 per draft
Three ways to pick the next step: think and act one lap at a time, write a plan and execute it with replanning on surprise, or draft, critique and revise until a critic is satisfied.

What reasoning models changed

Current frontier models think before they answer, in tokens you are billed for but do not have to prompt for, and adaptive thinking decides how much to deliberate per request, steered by an effort parameter. A single lap now contains the think-then-act of the first style and much of the plan of the second, without the prompt engineering that used to produce them. The practical effect: a plain loop on a reasoning model at a high effort setting often matches a hand-built plan-and-execute at far lower engineering cost. Explicit plans still earn their keep when a human must approve the plan, when steps run on different models, or when the plan itself is the artefact the user wants.

Cost arithmetic

Assume a task of five tool calls and a context that grows to 30,000 tokens. Interleaved: five laps, about 90,000 input tokens in total as the context grows. Plan-and-execute: one planner call, five cheaper executor laps, perhaps one replan; roughly the same tokens, but most of them on a smaller model. Reflection on the final draft: two more calls at full context, about 60,000 tokens, for one critique and one revision. Search with branching three to depth two: nine trajectories where one would do. Latency follows the call count, so reflection and search both land outside a tight interactive budget.

 InterleavedPlan-and-executeReflectionSearch
StepsOne thought, one act, one observation per lapPlan once, execute n steps, replan on surpriseDraft, critique, revise, repeatBranch, score, keep the best, expand
CostOne call per lapOne planner call plus n cheaper lapsTwo to three calls per attemptBranching factor to the power of depth
AdaptivityHighest; every step uses the latest resultLow between replansHigh on quality, not on directionHigh, at great expense
FitShort, observation-driven tasksLong tasks; plans a human must approveQuality-critical draftsCombinatorial puzzles; offline
Planning: ReAct, plan-and-execute, reflection · Backplane