Planner-Executor Agents: Plans, Validation, and Replanning
Design planner-executor agents with versioned plans, validated steps, explicit acceptance conditions, and replanning that responds to changing evidence.
Abhishek Raj · · 8 min read
Prepared with AI research assistance. Sources are linked throughout; worked examples are illustrative unless stated otherwise. Editorial approach.
A planner-executor agent separates deciding what should happen from carrying out individual steps. That separation becomes useful when a task has dependencies, intermediate evidence, and a meaningful definition of completion. Its weakest implementation is also common: generate a numbered list, execute it unquestioningly, and let another model declare success.
A better design treats the plan as a proposal that application code can inspect. Every step needs inputs, authority, preconditions, and observable acceptance conditions. This guide develops a hypothetical invoice-investigation agent to make those contracts concrete. The schemas and control rules below are illustrative design recommendations, not a framework API or a tested implementation.
What the research establishes
The Plan-and-Solve paper decomposes reasoning into planning subtasks and then solving them. Its experiments concern specific reasoning datasets and models; they do not establish that adding a planner improves every production workflow. The useful starting hypothesis is narrower: explicit decomposition may reduce omitted steps, and that hypothesis needs evaluation on your tasks. Plan-and-Solve research paper.
ReAct explores interleaving reasoning and actions so observations can influence subsequent decisions. This matters because a planner-executor system still needs feedback: a plan formed before querying a database cannot anticipate every returned fact. A planning phase and an observation-driven executor can coexist. ReAct research paper.
LangChain's architecture overview describes a planner, executors, and a replanning decision. It also discusses designs that bind intermediate results to variables. Those are architectural examples, not evidence that a particular deployment will be cheaper or faster; extra planning calls and retries can erase potential savings. LangChain planning architectures.
Anthropic distinguishes predetermined workflows from systems in which models dynamically direct execution, and recommends starting with simpler solutions. That distinction is useful here: if every invoice follows the same known path, a deterministic workflow may be sufficient. Reserve model planning for decisions that actually depend on uncertain information. Building effective agents.
Define completion before asking for a plan
Suppose a finance analyst asks: “Investigate the duplicate charge on invoice INV-204 and prepare a correction.” The agent can read invoices and transactions, but it cannot issue refunds without approval.
Translate the request into a goal contract before planning. For this example, completion means locating the invoice, checking whether two distinct settled transactions correspond to the same obligation, recording relevant transaction identifiers, and producing a correction proposal or an evidence-backed explanation that no duplicate exists. Issuing the correction is a separate, authorized outcome.
This avoids a subtle failure: an executor may finish every listed step while the actual question remains unanswered. “Search transactions” is an activity. “Identify the settled transactions associated with this invoice, including settlement state and currency” is an acceptance condition.
Record constraints beside the goal: tenant identity, permitted accounts, allowed tools, a spending limit, a deadline, and whether writes are authorized. A planner cannot expand those permissions by adding a step. The distinction belongs in the application's execution checks, rather than only in a prompt.
Make each plan step an inspectable contract
For this hypothetical system, use a structured plan with stable step identifiers and explicit dependencies:
{
"planId": "invoice-investigation-204",
"version": 1,
"goalId": "investigate-inv-204",
"steps": [
{
"id": "load-invoice",
"tool": "read_invoice",
"arguments": {"invoiceId": "INV-204"},
"dependsOn": [],
"accept": "invoice_found_with_currency_and_version"
},
{
"id": "load-transactions",
"tool": "list_invoice_transactions",
"argumentsFrom": {"invoiceId": "load-invoice.invoice.id"},
"dependsOn": ["load-invoice"],
"accept": "complete_transaction_listing"
}
]
}
Here, accept names a validator registered in application code. It is not arbitrary model-generated code. The planner may choose approved validators, but cannot redefine what “complete” means.
Validate the plan structurally before running it: unique identifiers, known tools, valid argument shapes, resolvable references, acyclic dependencies, bounded step count, and permitted effects. Then validate semantics: does the proposed transaction query use the same tenant and invoice as the goal? Is the plan requesting a refund when only a proposal is authorized?
Structural correctness cannot answer those questions alone. The separate guide to structured output validation explains why valid JSON is only the first gate.
Bind results instead of rewriting observations
Keep an append-only result record for each attempt, with the step identifier, plan version, tool request identifier, observation time, source version, and validator result. Store the original tool response securely and pass a compact, relevant view to the model.
Downstream inputs should reference named result fields. Avoid asking the executor to remember a transaction identifier from prose and type it back into another tool. References reduce accidental substitutions and make dependencies auditable.
For example, the correction proposal can reference transaction-analysis.duplicateTransactionId. Before executing any mutation, the application resolves that reference, checks its type and ownership, and verifies the current transaction state. An apparent duplicate that is actually a pending authorization should not be treated like a settled duplicate payment.
This separation also helps with context limits. The planner can receive the relevant evidence summaries and identifiers without repeatedly receiving every raw database row. Preserve a way to retrieve original evidence when the summary is insufficient.
Replan when evidence invalidates assumptions
Replanning should have a reason, rather than happen automatically after every tool call. In the invoice example, useful triggers include a missing invoice, incomplete pagination, conflicting currencies, a transaction status change, an unavailable tool, or a correction proposal rejected by a policy validator.
Classify the problem before invoking the planner:
| Observation | Suggested response in this example |
|---|---|
| Temporary read timeout | Retry within the step's existing budget |
| Unsupported currency in correction tool | Replan or escalate to an analyst |
| Invoice version changed | Refresh evidence and invalidate dependent conclusions |
| Missing authorization for a refund | Request approval; preserve the investigation results |
| Required evidence cannot be obtained | Stop with an explicit unresolved outcome |
A network timeout does not necessarily make the plan wrong. Conversely, a successful HTTP response does not make its content sufficient. Treat transport state, evidence validity, and goal progress as separate signals.
Give the replanner the current goal, immutable constraints, completed results, failed assumptions, and remaining budget. Ask for a revised remaining plan, not a fresh narrative that silently discards work. The surrounding agent state machine should own legal transitions between planning, execution, approval, and completion.
Version plans and invalidate dependent steps
A revised plan should increment its version and retain a parent reference. Completed work may be reusable, but only when its inputs and assumptions remain valid.
Imagine the first query found two settled payments. Before approval, a settlement reconciliation changes one payment to reversed. The previous duplicate analysis is now stale. Mark that analysis and the resulting correction proposal invalid; do not merely append a new final paragraph to the old plan.
For a small system, a dependency graph plus input-version hashes can make invalidation manageable. A step result records the versions of upstream evidence it used. Reuse is allowed only if those dependencies still match and the evidence has not exceeded its allowed freshness window.
Approval should bind to the exact proposed action, amount, destination, and evidence snapshot. A replan that changes those fields needs a new approval. Otherwise, approval for one proposal can accidentally authorize another. Execution still needs a fresh authorization check, because a valid approval does not freeze the external world.
Bound the replanning loop and verify outcomes
Set independent limits for tool attempts, total planner calls, elapsed time, and total cost. A step budget is not a substitute for a run budget: ten individually reasonable steps can collectively exceed an acceptable deadline.
Track whether a revision adds new evidence, resolves an uncertainty, or changes an executable decision. If repeated revisions simply rename the same failed step, stop and escalate with a concise evidence package. A useful failure response states what was established, what remains unknown, and what would unblock progress.
Completion should be decided by application-visible evidence. In this example, proposal generation is complete only when the evidence ledger is populated and the proposal passes validators. If execution is later authorized, verify the resulting correction through a read-back or an authoritative operation record.
A timed-out write is an ambiguous outcome, not proof that nothing happened. Check the action's recorded status before retrying. Idempotent agent actions provide the missing link between planning intent and safe execution.
Evaluate the architecture against a simpler baseline
Build a small evaluation set with ordinary investigations, no-duplicate cases, reversed transactions, pagination, stale approvals, unavailable tools, and contradictory records. Compare the planner-executor design against a fixed workflow using the same tool contracts.
Measure task completion, unsupported conclusions, unauthorized action attempts, unresolved cases handled honestly, planner calls, and end-to-end cost. Also inspect avoidable replans and reuse of stale results. Report results by scenario rather than hiding critical failures inside one average.
The architecture earns its complexity when it handles meaningful variation better while meeting your operational constraints. A visually impressive plan is not the acceptance criterion.
Frequently asked questions
Does the planner need a different model from the executor?
No. They are different responsibilities, not necessarily different models or processes. Begin with the same model if that simplifies evaluation. Change models only when measured task quality, latency, or cost supports the change.
Should every tool result trigger replanning?
No. Continue when the result satisfies the step contract and preserves downstream assumptions. Replan when new evidence changes the remaining work. Use deterministic retry handling for transient failures where appropriate.
Can an executor change the plan itself?
It can propose a change, but the application should validate and version that change before executing it. Otherwise, the plan stops being an inspectable contract and becomes a misleading description of an unconstrained loop.
Sources and scope
The four linked primary sources establish the planning, execution, and observation patterns. The invoice contracts, validation rules, and evaluation scenarios are an original illustrative design synthesis. They require adaptation to the accounting system, authorization model, and operational guarantees of a real deployment.
Source reference list
Related reading
- Designing an AI Agent Loop as a State Machine
Design a reliable AI agent loop with explicit states, guarded transitions, bounded execution, and recovery illustrated through a support-ticket workflow.
- Structured LLM Outputs: JSON Schema and Semantic Validation
Validate structured LLM outputs beyond JSON syntax with evidence checks, domain rules, refusal handling, bounded retries, and explicit action boundaries.
- Idempotency for AI Agent Actions: Preventing Duplicate Side Effects
Prevent duplicate AI agent actions with stable intent identities, immutable request fingerprints, durable ledgers, and recovery for uncertain outcomes.