When the ReAct loop wastes too many tokens re-planning every step, you need explicit planning patterns. This chapter covers Plan-and-Execute (plan once, execute many), ReWOO (decouple reasoning from observations to slash tool calls), Hierarchical Task Networks (compose plans from reusable pieces), evolutionary and Monte Carlo planning, and the rubric for when to plan vs. just react.
ReAct's strength is also its weakness: every iteration re-runs the planning process from scratch, paying for the full prompt + thought + action on every step. For tasks with many steps, this is expensive and slow. Planning patterns decouple the plan from the execution, so the model only does the hard reasoning once.
Three families dominate:
Plus two stochastic search techniques: evolutionary planning (mutate-and-select on candidate plans) and Monte Carlo Tree Search for plan exploration.
The big question this chapter answers: when should you plan up-front vs. plan-as-you-go? The answer depends on (a) how predictable the environment is, (b) how expensive failed steps are, and (c) how large your context budget is.
This chapter covers:
Click any topic to jump in
Plan once, execute many — slash token cost on long, predictable trajectories.
DAGs (ReWOO) and trees (HTN)
DAG of placeholders, batched tool calls, single solver — constant token cost in the number of steps.
Compound → primitive task decomposition — bounded depth, plan reuse, human-readable structure.
When greedy planning misses the right plan — search the plan space when stakes are high.
A 3-signal decision aid: predictability, cost of mistakes, latency budget.
Plan-and-Execute is the simplest planning pattern: one LLM call produces a complete sequential plan; a second loop executes the plan one step at a time. The planner does the expensive reasoning once; the executor is a thin wrapper that calls tools and feeds outputs back.
The planner sees the user's goal and emits an ordered list of steps in natural language: "1. Look up the user's recent orders. 2. For each order, check the refund eligibility. 3. Refund the eligible ones. 4. Email the user a summary."
The executor then processes each step in order. For each step, it produces a structured tool call (or LLM completion), captures the output, and moves on. The executor does not re-plan unless a step fails — at which point it can either retry, ask the planner to re-plan from the failure point, or escalate to a human.
The big win: the executor's prompt at step is small (just the current step + the most recent observations), not the full ReAct trace. Token usage often drops by 5–10× compared to ReAct on long trajectories.
Compare token usage on a 10-step task between ReAct and Plan-and-Execute.
The Achilles' heel of Plan-and-Execute is the stale plan problem. The planner makes assumptions about what each step will return; if reality diverges, downstream steps become wrong.
Three mitigation strategies: