Skip to Content
DocsArchitecturesPlan-and-Execute

Plan-and-Execute

Plan-and-Execute commits to a plan upfront and executes step-by-step. Wang et al. 2023 (Plan-and-Solve Prompting); He et al. 2025 (Plan-then-Execute Pattern Implementation).

The 2026 production pattern for cost-sensitive multi-step tasks where ReAct-style “think before each action” wastes tokens.

prompt ───► planner ───► [step1, step2, step3] executor (per step) ───► [r1, r2, r3] synthesizer ───► output

Pattern

  1. Plan. A single planner call produces a JSON list of step descriptions. Steps are short, ordered, dependency-free.
  2. Execute. Each step is a text-only model call seeded with the original problem, the plan, and prior step outputs. Sequential.
  3. Synthesize. A final model call combines step outputs into the answer.

Usage

from loomflow import Agent from loomflow.architecture import PlanAndExecute agent = Agent( "...", model="claude-opus-4-7", architecture=PlanAndExecute(), )

Or by string:

agent = Agent("...", model="...", architecture="plan-and-execute")

Cost

  • LLM calls: 1 (planner) + N (steps) + 1 (synthesizer) for an N-step plan.
  • ReAct on the same task: roughly N + 1 calls. But each call carries the growing message history.
  • Plan-and-Execute is cheaper when the message history is the dominant token cost (many turns, long context).

What’s not in v1

  • Sub-architecture invocation per step. Each step is a single text-only call, not a fresh ReAct (or any other architecture) invocation. That’s planned for a later release; until then, steps can’t call tools.
  • Adaptive replanning. No re-plan after a failed step. The plan is committed at start.

When to use

  • Cost matters and you can predict the step structure (research → summarize → cite, or extract → transform → load).
  • Reproducibility matters. Explicit plan is auditable and can be cached.
  • Steps don’t need tool calls. For tool-heavy plans, use ReWOO instead. Same shape with parallel tool dispatch and 30–50% cheaper than ReAct.

Plan-and-Execute vs ReWOO. Both are plan-then-execute architectures. Plan-and-Execute steps are text-only model calls; ReWOO steps are tool calls with placeholder substitution. Use ReWOO when the plan is “search → fetch → summarize”; use Plan-and-Execute when each step is its own reasoning chunk.

Last updated on