Lesson 2 of 6 in Agentic development foundations · 12m
Plan, act, verify
After this lesson you can recognise the three phases of a good agent run, ask for each one on purpose, and follow a run in the Agent sidebar closely enough to catch it going wrong before it costs you anything.
The loop
Every agent run that ends well goes through the same three phases, whether you ask for them or not.
-
Plan. Read enough of the code to understand the change, then decide what to do: which files, in what order, and how to check the result.
-
Act. Make the change, in small steps, using tools: edit a file, run a command, read the output.
-
Verify. Check the result against the goal. Run the tests, build the project, load the page. If the check fails, go back to plan or act.
A run that goes badly almost always skipped a phase. The agent that edits six files before reading any of them skipped planning. The agent that announces "done" without running anything skipped verifying. The agent that tries the same failing fix four times is stuck in act and has stopped planning.
You can't make a model think harder, but you can make each phase visible and deliberate. That is most of what "managing an agent" means in practice.
Ask for the plan first
For anything beyond a one-line fix, ask for a plan before any edits:
Read src/billing/ and the tests under tests/billing/. Then give me a numbered plan for adding a refundPartial(orderId, amountCents) function: which files change, what each change is, and which test proves it works. Don't edit anything yet.
A plan is cheap to read and cheap to correct. If step 3 says it will change the public Invoice type and you know three services depend on it, you say so now, before it's written into twelve files. Once the plan looks right, reply "Go ahead with the plan" and the same conversation carries it into act.
Two things make plans better:
-
Ask for the smallest first step. A plan that ends with a step you can check in a minute gives you an early signal that the approach works.
-
Ask what it's unsure about. "List anything you'd want to confirm before starting" surfaces the guesses an agent otherwise makes silently.
Act in small, readable steps
During act, your job is to watch, not to type. Each step is a tool call. Read the ones that change things. A command you don't recognise, a write to a file the plan didn't mention, or a sudden rm is your cue to deny the call and ask why.
Keep steps small enough to approve with confidence. If a single approval would rewrite most of a file, stop and ask the agent to make the change in parts.
Make verification part of the task
The cheapest verification is the one the agent runs itself, before telling you it's finished. Put it in the request:
When the change is made, run npm test -- billing. If anything fails, fix it and run it again. Stop after three attempts and show me the failure.
That last sentence matters. An agent that can't make a test pass will sometimes start changing the test. A limit and an instruction to show you the failure turns a spiral into a question you can answer.
Then do your own verification. The agent's check tells you the code does what the agent understood. Your review tells you it does what you meant. The Close the loop course goes deeper on both.
When to step in
Stop the turn and re-brief when you see:
-
The same tool call, or the same failing command, more than twice.
-
Edits to files that have nothing to do with the task.
-
A plan that has quietly changed without the agent saying so.
-
The agent asking to weaken a check, such as skipping a test or adding --force.
Stopping is not a failure. A short correction ("the bug is in the parser, not the formatter; start from parse.ts") usually gets a stuck run moving again.
Go further
- Your first task — tool cards, approvals and the queue in detail
- Choose a posture — how much the agent may do unasked
- Tests are the contract — a failing test as the definition of done
- Agent — personas, the queue and the Context Inspector