Skip to content

Lesson 4 of 9 · 26m

Planning Loops Without the Theater

Choose between reactive, plan-execute, and replanning loops based on task uncertainty, cost, reversibility, and feedback quality.

Planning is the most over-performed part of agent design. Teams love watching a model produce a twelve-step plan because it looks competent. Then step two fails, the plan is stale, and the agent either improvises anyway or keeps executing fiction. A planning loop earns its complexity only when the task has enough structure and uncertainty to benefit from decomposition.

Know the loop shapes

Three patterns cover most production systems:

reactive:       observe -> act -> observe
plan-execute:   plan once -> execute steps -> verify
replanning:     plan -> execute one step -> observe -> revise

Reactive loops are cheap and robust for tightly constrained tasks. Plan-execute works when the environment is predictable. Replanning is necessary when tool results materially change the next decision, but it costs more tokens and creates more opportunities for drift.

A plan is a hypothesis

Do not store a plan as sacred text. Store it as a hypothesis with completion criteria:

{
  "goal": "Restore customer access without resetting unrelated devices",
  "steps": [
    {"action": "inspect account lock state", "done_when": "lock source identified"},
    {"action": "clear only the active lock", "done_when": "login succeeds in test"},
    {"action": "notify customer", "done_when": "ticket updated"}
  ],
  "revision_policy": "replan after any failed write or contradictory state"
}

The point is not elegant prose. The point is knowing what evidence would cause the plan to change.

Cap recursive decomposition

A model can turn any task into a project plan. Decomposition should stop when the next step is directly executable by one tool or trivially verifiable by code. Otherwise you spend tokens producing project management theater and still have no useful work.

bad:  understand user -> deeply understand user -> formulate understanding
good: fetch account state -> identify lock reason -> clear matching lock

The difference is whether nodes in the plan correspond to observable state transitions.

Use deterministic planning where possible

If the workflow is known, encode it. A refund workflow does not need a fresh creative writing exercise every time; it needs a state machine. Reserve model planning for the uncertain parts: diagnosis, prioritization, summarization, and choosing among exceptions.

Verification closes the loop

Every meaningful step needs independent verification. "The tool returned success" is not always enough:

result = clear_login_lock(user_id)
assert result.ok
state = get_user_security_state(user_id)
assert state.login_lock is None

Verification should inspect the world, not merely trust the mutation response. This catches partial writes, stale reads, asynchronous processing, and tools that report success before downstream failure.

Field notes

  • Long plans create sunk-cost behavior. Force replanning after material surprises instead of letting the agent rationalize obsolete steps.
  • Include stop conditions in the plan, not just completion steps.
  • If the agent cannot explain why the next action is still valid, it is executing momentum rather than a plan.
  • Store plan revisions. They are gold for debugging why a run went sideways.

Was this lesson helpful?

Sign in to rate