Plan-Execute-Verify

loop pattern · maturity: established · risk: low

The agent produces an explicit plan, executes one step at a time, and verifies each step's output against stated criteria before proceeding. The loop refuses to terminate until final verification passes or budget is exhausted.

When to use

Any multi-step task where false success is expensive: bug fixes, migrations, deployments, document generation.

Steps

StepWhat happensVerification
PlanDecompose the goal into ordered steps, each with an observable success criterion written before execution.Plan reviewed against the goal: does completing every step imply the goal is met?
ExecutePerform exactly one step using the tools it requires.Step output captured (command output, diff, file state), not summarized from memory.
VerifyCheck the captured output against the step's criterion. On failure, diagnose before retrying.Criterion evaluated on evidence; a step never passes on the agent's assertion alone.
Repeat or finishAdvance to the next step, or run final whole-task verification when steps are exhausted.Final check exercises the actual deliverable (tests run, app opened, file parsed).

Specification

Verification methodPer-step criteria defined at plan time, evaluated on captured tool output; final end-to-end check on the real deliverable.
Recovery behaviorretry-with-diagnosis
ObservabilityPlan, per-step evidence, and deviations logged; the transcript is the audit trail.
InputsTask goal, Success criteria, Tool access, Step budget
OutputsCompleted task, Verification evidence trail, Plan-vs-actual record
Risk level / maturitylow / established

Failure modes

  • Plan too coarse: steps unverifiable
  • Verification theater: criteria written to pass
  • Budget exhaustion without escalation path

Assessment

The reference loop. Scores highest on verification quality and boundedness; its cost is latency, which is why one-shot prompting persists despite worse completion rates.

Skills that implement this

Benchmarks that test this

Go deeper