Plan-execute

A plan-execute agent thinks before it acts. Instead of reasoning and acting in alternation (which is ReAct), it generates the entire plan upfront, optionally gets you to approve it, then runs the plan step by step. You trade some adaptiveness for a lot of predictability. For certain task shapes - the ones that are mostly known ahead of time - plan-execute is cleaner, cheaper, and safer than ReAct.

The flow.

~ plan-execute, one pass through ~

The big difference vs ReAct: all the reasoning happens upfront, not interleaved with actions. After the plan is approved, execution can be mostly mechanical. A step says "edit file X to change Y"; the agent does it; moves on.

Why plan first at all?

~ what planning upfront buys you ~

Put simply: plans give you a handle. Without a plan, the agent's intent is implicit in its behavior, and you can only know what it wants by watching what it does. With a plan, intent is explicit, written down, inspectable, and (importantly) cancellable before any action has happened.

Where plan-execute shines vs. where it fails.

~ use plan-execute vs use ReAct ~

The hybrid pattern: plan with replan triggers.

In practice, pure plan-execute is rare. Most production setups use a hybrid: plan upfront, but every step checks "does this result violate an assumption the plan made?" If yes, replan that branch. If no, continue.

This gets you the predictability of plan-execute on the happy path and the adaptiveness of ReAct when reality surprises you. Claude Code's plan mode does exactly this: generate a plan, get user approval, start executing, but the model can re-enter plan mode if something unexpected happens mid-execution.

What makes a plan good.

A bad plan is worse than no plan - you've committed to something wrong. Markers of a good plan:

When to require human approval of the plan.

Always err on the side of approval when:

Once a class of task has been approved many times without needing corrections, you can graduate that class to auto-approval. But that's an earned promotion, not a default.

Implementing plan-execute in Claude Code.

Claude Code ships a plan mode that formalizes this pattern. When you start a session in plan mode, or invoke it explicitly, the model first produces a structured plan and stops. The user reviews and approves (or rejects with notes). Only after approval does execution begin.

For anything autonomous and non-trivial, invoke plan mode first. Scheduled agents that do the same thing every morning? Use plan mode weekly to confirm the plan still makes sense, then run in auto mode for the daily runs. Routine work stays fast; novel or risky work gets the seatbelt.

Combining plan-execute with ReAct inside each step.

Here's a powerful pattern you'll see in mature agents: plan-execute at the top level, ReAct inside each step. The plan says "step 3: research competitors." Inside that step, a sub-agent runs in ReAct mode to actually do the research (which is open-ended). The plan gives you the high-level structure; ReAct gives you the in-step flexibility.

This composition is how real production agents work. Pure plan-execute is too rigid; pure ReAct drifts on long tasks. Together, the plan keeps the agent on track at the top level while ReAct keeps it adaptable inside each step.