MLGuerrillaStart M1 →
Free · in beta·intermediate·M17·48 min read·Prereq: Harness & Reliability (M9), whose stop conditions this module builds on. Verification (M15) supplies the checks a plan finishes on, and Memory (M16) supplies the coding agent, its repo and the note that starts the running example.

Planning

The capability

What a planner is

A planner is basically the part of an agent that works out, before anything runs, what has to be true when the task is finished and which steps should get there. It writes that down in a form your code can read, and it changes it when a step shows that the world is different from what it assumed.

Let's take the pieces of that definition one at a time, because each one of them turns into code you'll end up writing.

  • What has to be true when it's finished. This is the goal, written as checks your code can run at the end, like "the checkout test passes and the test file wasn't edited".
  • Which steps should get there. This is a list of steps, where each one is a single tool call with an expected result, plus a note of which steps need another step's output before they can start.
  • A form your code can read. In practice that means JSON with a fixed schema, so the harness can run the steps in order, see which ones are done and count what they cost.
  • Changes it when a step shows otherwise. This is a replanning rule, and when a step fails it decides whether to retry the step, change the rest of the plan or stop and ask a person.
A diagram of one planning loop in two rows, with a strip underneath. The top row runs left to right. A card holds the request, the checkout test is failing on CI, fix it, and the starting state, which is the repo and git status, a memory note dated 2026-09-02, permissions to edit src and no push, and a budget of 16 tool calls. An arrow leads to the planner, one model call that writes the goal as checks, lists its assumptions and orders the steps. An arrow leads to the plan, JSON your code reads, holding the goal that the checkout test passes, done-when checks that pnpm test:checkout exits 0 and the test file is unchanged, the assumption that the fixtures are out of sync, and a small graph of steps, s1 reset, then s2 rerun, then more. The bottom row runs right to left. The executor and state card fills in one ready step's arguments, calls the tool, checks the result against expect and records what each step returned and what changed. An arrow leads to the done-when checks, run by the harness in code, where the model's own done doesn't count. An arrow leads to a terracotta card, finished, with status finish, reached only when every check passes. A dashed terracotta strip labelled replanner says that when a step or a check fails, the loop retries a transient error, keeps a lookup miss, or names the broken assumption and writes new remaining steps from the current state, or stops and asks, capped at 3 replans.
The replanner is the only way back into the plan, and it reads the whole state, including what has already changed in the repo.

A planner can't know what's in a file until something reads it, so any plan you write before the first read is partly a guess, and the steps that depend on what that read finds have to either stay vague or get rewritten later. It also doesn't make a model any better at the task it's planning. When Valmeekam and colleagues asked models to write out complete plans for problems like the ones in the International Planning Competition, the best model, which was GPT-4, had "an average success rate of ~12% across the domains" (Valmeekam et al., NeurIPS 2023). The same paper found that plans did a lot better when an external verifier checked them and sent the errors back, and later on Kambhampati's group argued that models "cannot, by themselves, do planning or self-verification" and should be paired with checkers that sit outside the model (Kambhampati et al., 2024). Those were 2023 models working on puzzle domains, and newer ones do better, but the design that follows from it still holds for an agent in a repo, where the model proposes a plan and your code checks each step and the finish.

Why this is a capability of its own

M9 already gave the agent a loop with limits in code, like a cap on model calls and a stop when the same tool call repeats, and M15 built checks that decide whether an output can be used, so what that leaves for a planner is the order the work happens in and the definition of finished. M9's loop decides when to give up and M15's checks judge one output at a time, but neither of them says which step should come next or which steps can run at the same time. Neither one says what the agent should do when step three proves that step one was built on a wrong guess, either.

Those also turn out to be where agents fail most. When Cemri and colleagues labelled 1,642 traces from seven multi-agent frameworks, they found step repetition in 15.7% of them, agents not recognising that the task was finished in 12.4%, and agents failing to follow the task's requirements in 11.8% (Cemri et al., 2025). The paper also says that failing to recognise termination conditions shows up "almost exclusively in failed runs". Each of those is a planning failure, because each one is about which steps to take or about when the task counts as finished.

Where it shows up

  • A coding agent's task list, which is the checklist it writes at the start of a bigger change and then ticks off as it goes.
  • A research agent that decides which searches to run, which ones can run at the same time, and when it has enough to write the report.
  • A data backfill where an agent works out which tables to rebuild and in what order, because some of them depend on others.
  • The planning step M10 added to the flower company's support agent, which read only the customer's messages and decided up front which tools the turn was allowed to use.

They all look different, and every one of them keeps a plan somewhere your code can read it and check each step against it.

Keep reading

The rest of this lesson is free with an account

Create a free account to read the remaining 17 sections. It takes about twenty seconds and there's nothing to pay. The same account opens the slide decks and CV reviews.

  1. 02The checkout test the fixtures didn't fix
  2. 03A plan is worth writing only when the path isn't known in advance
  3. 04Turn the request into a goal your code can check
  4. 05What the planner knows before step one
  5. 06A step your executor can run
  6. and 12 more

That's the last one written so far

Pick your next module from the board.

All modules →