AI Agents
Intermediate 12 min read AI Agents

Planner Agents

Plan first, then act

A planner breaks a goal into ordered, executable steps before acting. Planning reduces drift on long tasks: the plan is a checkpointable contract the loop and humans can inspect, approve, and correct.

plannerplanstep decompositioncheckpointapproval
Prerequisites: The Agent Loop
Before we start

What you will learn

  • Decompose goals into steps
  • Make plans inspectable and approvable
  • Correct plans mid-stream
Introduction

What is this?

A planner explicitly decomposes the goal into ordered steps before execution. The plan doubles as a contract: humans can approve, reorder or veto steps; the loop can checkpoint 'step X done' and re-plan when reality diverges. Planning costs a little time and saves a lot of drift.

Motivation

Why do you need it?

  • Plans give you a map to review BEFORE actions happen.
  • Reachable checkpoints make progress measurable.
  • Re-planning beats persistent improvisation on long tasks.
  • Approved plans are compliance-friendly artifacts.
Think about it

Mental model

Imagine

A trip itinerary before departure

Think of

A plan

You wouldn't drive cross-country deciding every turn live. You sketch legs (plan), review the route (approval), and when a road closes, re-plan that leg only. The itinerary is the contract you can check against, even as legs change.

Mechanics

How it works

  • Parse goal → step list (ordered, with exit criteria).
  • Show the plan for approval or auto-accept per policy.
  • Execute steps via the loop, marking progress.
  • Observe divergence → re-plan remaining steps.
  • Verify final completion against original criteria.

Plan→act→verify.

Goal
Plan
Approve
Execute
Verify
Deliver
Re-plan
Real world

In production

  • Migration and refactor agents surface plans before touching code.
  • Ops runbooks plan steps, then approve before destructive ops.
  • Research agents plan sources and questions before searching.
Guidelines

Best practices

  • Each step names its exit criterion.
  • Keep plans modest in size; collapse trivial steps.
  • Re-plan visibly: log what changed and why.
  • Verify deliverables against the plan, not vibes.
Watch out

Common mistakes

  • Plans that are prose with no checkable steps.
  • Auto-executing the whole plan without review when stakes are high.
  • Never re-planning when reality diverges mid-task.
Root cause analysis

Common issues

Error
Plan approved, execution wandered
Root cause

Loop ignored the plan

Fix

Feed current step + criteria into every model turn.

Error
Plan stale mid-run
Root cause

World changed

Fix

Observe divergence; re-plan remaining steps transparently.

When things break

Debugging tips

  • Steps skipped in execution → plan/action misalignment; enforce per-step exit criteria.
  • Plans too granular → merge; too fluffy → force explicit criteria.
  • Re-planning loops → divergence noisy; tighten observation.
Interviews

Interview checkpoint

Practice

Hands-on lab

Plan-Execute-Verify by Hand
30 min · intermediate
In progress
Objectives
  • Break a goal into ordered tasks
  • Revise the plan when a task fails
  • Verify that every task produced its artifact

Plan-Execute-Verify by Hand

30 min · intermediate

0/3 steps
0%
sandbox · Linux sandbox
$
Try these commands
Test yourself

Quick quiz

0/2
1

A useful plan step includes…

2

Plans must survive reality unchanged.

Go deeper

Official documentation