systemdesign.academyAI EngineeringFree lessonsSign inGet the course
  1. Home
  2. AI Engineering: Data, RAG and Agents
  3. Agents in Production
  4. Agent Planning: ReAct vs Plan-and-Execute

AI Engineering · Agents In Production

Agent Planning: ReAct vs Plan-and-Execute

Free preview: the first 2 parts of this 14-part lesson.

Already bought the course? Sign in to read the whole lesson.

this lesson is part of

AI Engineering

Unlock this lesson and the 199 other paid lessons

  • 210 lessons in 16 chapters
  • 118 lessons built on a lab that really ran
  • An AI tutor beside every lesson that answers and draws
  • Lifetime access, every new lesson included

$49 once, by PayPal

See the AI Engineering course

The rest of this lesson

  1. What ReAct Costs: A Model Call on Every Step
  2. Why ReAct Drifts on Long Tasks
  3. Plan-and-Execute: Think Once, Then Run the Plan
  4. Where the Upfront Plan Breaks
  5. Which Shape Wins, by Task Shape
  6. The Production Default: Replan on Failure
  7. Plan Length Sets the Ceiling: The pass^k Math
  8. A Cost Model, and the Crossover Point
  9. The Crossover, Worked by Hand
  10. Common Mistakes When Choosing a Shape
  11. How Teams Actually Build This

read the rest of this lesson in

AI Engineering

Unlock this lesson and the 199 other paid lessons

  • 210 lessons in 16 chapters
  • 118 lessons built on a lab that really ran
  • An AI tutor beside every lesson that answers and draws
  • Lifetime access, every new lesson included

$49 once, by PayPal

See the AI Engineering course

Continue this lesson

in Agents In Production

This lesson is part of the AI Engineering course. Unlock the full course, a separate one-time payment, for lifetime access.

One-time payment. Lifetime access. No subscription.
Global
$49/lifetime

One-time payment by card or PayPal

Get Lifetime Access
Previous lessonContext Rot: Measuring How Long Context Degrades Your AgentNext lessonReflection and Decomposition: Making Agents Check Their Own Work

System Design

  • Foundation
  • Intermediate
  • Advanced
  • Capstone

AI Engineering

  • Foundation
  • Data, RAG and Agents
  • Evaluation, LLM Ops and Security

systemdesign.academy

  • Home
  • Glossary
  • Interview prep
  • Reviews
  • About
  • Pricing
  • Privacy
  • Terms
  • Refunds
  • Delivery
  • Contact
Knowledge Check
Foundation lessons free, try before you buy
India Special
India
₹999/lifetime

One-time payment: UPI, card or netbanking

Get Lifetime Access
Foundation lessons free, try before you buy
Every ML Platform lesson, Foundation to Advanced
Real architecture diagrams with real tool logos
MLOps, LLMOps, and data engineering in depth
Quizzes with instant feedback
Built and reviewed by senior engineers
Lifetime access, all future content included

Foundation lessons of this course are free, no payment needed. Try them now

One 12-Step Task, 12 Model Calls or 2

Two agents finish the same 12-step task correctly. One made 12 reasoning calls to a frontier model to do it. The other made 2. At any real volume that gap is most of your inference bill and most of your tail , and it is decided before the agent runs a single step, by one architectural choice: does the agent think before every action, or think once and then act.

That choice has a name on each side. Thinking before every action is ReAct. Thinking once and then acting is plan-and-execute. Neither is correct in general. They are two shapes with opposite cost curves and opposite failure modes, and picking the wrong one for your task shape is how you end up either broke or brittle.

Two-column comparison of the same 12-step task: on the left ReAct makes 12 frontier reasoning calls, one per step, strictly sequential and replaying the whole transcript each time; on the right plan-and-execute makes one planning call plus 12 cheap executor calls that can run in parallel, so the call-count gap between the two shapes is decided before the agent runs a single step

This lesson is about the trade. The agent loop lesson earlier in this chapter treated the loop as a given and asked how to make it reliable. Here the loop itself is the variable: its shape is what you are choosing, and the shape determines the bill, the latency, and how the agent behaves the moment reality stops matching the plan.

ReAct: Think, Act, Observe, Repeat

ReAct interleaves reasoning and acting. The model produces a short thought, then one action, the orchestrator runs the action and returns an observation, and the model reasons again with that observation in hand. The pattern comes from Yao et al., ReAct: Synergizing Reasoning and Acting in Language Models, and the point of the paper is that the thought and the action help each other. Reasoning about what to do next produces better actions, and observing the result of an action corrects the reasoning.

The ReAct loop as a cyclic state machine: the model writes a Thought and proposes one action, the orchestrator runs it as an Action, the result returns as an Observation, and the observation feeds straight back into the next thought, cycling until the goal is met or a budget cuts it off

The strength is adaptivity. Because the model reasons again after every observation, it can change course at any step. It planned to call the search tool, the search returned nothing useful, so on the next turn it reasons about that emptiness and tries a different query or a different tool. Nothing was committed in advance. The plan, such as it is, exists only one step ahead, and it is rebuilt from the latest evidence every time. For a task where you cannot know the right sequence until you start pulling on threads, that is exactly the behavior you want.