PRACTITIONERCHAPTER 10

Working with AI coding agents

An agent can draft a change in minutes and write the tests that pass it. What you add is the evidence that the change is right, and a clear line between what you checked and what you only read

40 MINSOFTWARE ENGINEERUPDATED 2026-11-21
PREDICT

An agent has changed a parser for you. All 38 old tests and the 12 new ones it wrote pass. What should you do before you ask a teammate to review?

You work with an agent when it drafts a change and you read it, run it and merge it. This chapter covers the part that belongs to you alone: what you verify before you ask anyone else to look. The technique of briefing and steering an agent belongs to the Building Software with AI Agents course, whose chapters on briefing, reading generated code and reviewing AI-written code are not written yet, so they are named here and not linked. What your team agrees about change size, disclosure and second reviewers belongs to your manager, and managing a team that works with AI coding agents covers it. What the whole company standardises, such as permissions and the verification bar, belongs to principal engineers, and AI in technical strategy covers that. Those two chapters name each other, and this one names them back.

The model: green tests are where checking starts

An agent makes two kinds of change look finished. One looks finished because it is large and tidy, with a description, new tests and a green build. The other looks finished because you asked a question and it answered with confidence. Neither tells you that the change is right.

The rule is the one the manager’s chapter states for a team: whoever merges a change owns it, however it was written. For you the rule becomes a working definition. A change is ready for review when you can say what it does, what you ran to see it do that, and which check would fail if it did something else. Simon Willison’s post “Your job is to deliver code you have proven to work” argues for the same standard: a pull request should arrive with evidence that the code works, from your own manual testing and from automated tests, because generating a large patch with an agent is no longer the valuable part.

Verifying is not the same as distrusting. You do not recheck what a compiler guarantees, and you do not read a generated changelog with the care you give a billing rule. How hard you check follows the cost of being wrong: what a customer sees, how hard the change is to undo and how soon anyone would notice. A wrong label on an internal log line is cheap. A wrong delivery status goes to a customer’s system in a webhook, and the customer may act on it. Spend your checking where the cost is.

What feeling fast does and does not tell you

You will hear that agents make engineers faster, and you will feel it. Both are weak evidence. In early 2025 METR ran a randomised trial with sixteen experienced open-source developers working on their own repositories. After the work they estimated that the tools had sped them up by about 20%, and the measured times showed tasks taking about 19% longer when AI was allowed (METR, July 2025). Sixteen people, one kind of work and the tools of early 2025 is a narrow base. METR itself says the result is no evidence that AI fails to speed up most developers, and its later experiment, begun in August 2025, gave data it calls unreliable because of selection effects (METR, February 2026). Nobody should conclude from the trial that the tools are slow in general, or fast. The useful finding is smaller. The people doing the work were wrong about the direction of the effect, so how fast a session felt is not a reason to skip a check.

DORA’s 2025 report on AI-assisted software development describes AI as an amplifier of what an organisation already does well or badly (DORA, 2025). It rests on surveys, which show associations and not causes. For one engineer the practical reading is modest: the tools do not remove the need for tests, small changes and review, and they raise the price of lacking them. This chapter gives no figure for how much faster an agent makes you. The ones you meet need a design, a sample and a caveat before you repeat them.

What to check, in order

Run the checks below in this order, because the early ones are cheap and tell you where to spend the later ones.

Question How you check it What it catches
Did it change only what I asked? Read the list of files and the diff size before the code. Open every file you did not expect. Edits to configuration, deleted or loosened tests, changes outside the task
Can I explain every line? Say it aloud, or write it in the description. Mark each line you cannot. Code that works for reasons nobody knows
Does it do the right thing on real input? Run it by hand on real or captured data, the ordinary case first and then the awkward ones. Wrong assumptions the agent made about the data
Would a test fail if it were wrong? Revert the change, or break it on purpose, and run the tests. Tests that repeat the code or assert almost nothing
What happens on bad input? Try empty, huge, malformed, duplicated and out-of-order input. Crashes, hangs and quietly wrong answers
What did it bring in? Look for new dependencies, permissions and network calls. Check that each package exists and is the one you meant. Invented names and dependencies you did not choose
Who else must see this? For money, access control, customer sends and deletion, ask for a second pair of eyes whoever wrote it. Cost of a mistake that one reviewer cannot absorb

The first two rows cost minutes and you should do them before you run anything. The third and fourth are the ones engineers skip, because the build is already green. Rows five and seven share ground with secure code review and AppSec. The deliveries that arrive twice, late or out of order, which webhook delivery walks through, are the standard awkward input for anything that handles reports from other systems.

When the agent’s own tests agree with it

Ask an agent for a change and tests, and it builds both from one reading of your request. If that reading is wrong, the code is wrong and the tests agree with it. They pass by construction. Common signs are one test per branch of the code, inputs that mirror the code’s own constants, and expected values that match what the function returns today.

Google’s public review guidance asks whether the tests will fail when the code is broken (Google, What to look for in a code review). Make that question concrete with two moves, which build on testing your own work.

Use an independent source. Write at least some tests from something the agent did not write: the specification, the carrier’s or provider’s documentation, a table a colleague keeps, or captured real inputs. Boundaries are the best place to start, because an off-by-one error hides in the cases at the edges and a generated test rarely stands on an edge. If the only source you have is the agent’s own summary, say so in the description.

Break it. Revert the change and run the tests. At least one should fail. Then try the opposite: change one operator in the new code and see whether anything notices. A test suite that cannot tell, which the QA chapter on testing AI features and testing with AI covers under mutation testing, is a suite that cannot protect you from the next generated change either. That chapter is mainly about testing features that call a model; the part that applies here is its advice on checking tests an AI wrote.

Code you cannot explain

Sooner or later a change contains something you cannot follow: a dense regular expression, a clever bit of arithmetic, a dozen lines of generic code for a one-line need. Do not merge on the grounds that it passes. Work through five steps.

  1. Mark exactly what you cannot explain. A whole function is too vague. Find the line, the branch or the group in the pattern. A precise gap gets a precise answer.
  2. Ask the agent to explain that part, and treat the answer as a claim. An agent writes a fluent explanation of correct and incorrect code alike, so fluency is no evidence. Compare the explanation with a source the agent did not write.
  3. Ask for a version you can read. A table of known codes and an explicit default is often easier to read, test and change than one pattern that handles them all. Readability is part of whether you own the change.
  4. Probe with inputs. For a pattern, write strings it should match and strings it should not. Add long strings that almost match. OWASP describes regular expression denial of service, where certain patterns take exponentially longer as the input grows (OWASP, ReDoS). Nested repetition is the usual sign. If the pattern reads input that comes from another organisation, this check is not optional.
  5. Decide. If you can now explain each part and tests from an independent source pass, keep it. If you cannot, you have three choices: rewrite it by hand, pair with someone who knows the area, or ask for a simpler design. A rule of thumb, not a measured figure: when checking a piece of code is costing more than writing it would, write it yourself. Keeping a function you do not understand makes you the owner of something nobody can safely change.

Asking a teammate is a fair step, but ask a specific question: “does this carrier ever send code X, and what does it mean?” is better than “does this look right?”. Their answer is another claim. Check it against the same independent source.

The quiet edits

The part of a diff you asked for is rarely where the surprises are. Read the file list first. Agents do things nobody asked for: they loosen an assertion so a failing test passes, delete a test that was in the way, widen an exception handler so an error disappears, bump a version, reformat a file so a real change hides in the noise, or add a dependency. Each of these can be reasonable. Each needs your decision, not the agent’s. Ask for unrelated changes to be reverted and do them in their own pull request if they matter.

Watch what goes into the conversation as well as what comes out. Your company’s policy says what may enter a prompt. At Wrenpost, whose AI policy was signed on 1 October 2026, message bodies, phone numbers and one-time passwords do not, and the security lead is the person to ask when you are unsure. That shapes how you verify. When you test against real data, you give the agent the shape of the data, such as the set of status codes and the counts for each, and keep the records themselves out of the prompt.

The instruction file your team keeps beside the code, commonly named AGENTS.md, is where you teach an agent your conventions. Add to it when an agent makes the same mistake twice, and ask your manager who maintains it. What a file cannot enforce is the standard’s business, not yours.

What goes in the description

Your pull request description is where verification becomes visible to a reviewer. Pull requests that get merged covers description craft. For an agent-written change, add four things.

  • That an agent wrote most of it. This is not a confession. It tells the reviewer to read slowly, and your team’s agreement may require it.
  • What you ran and what came out. Inputs by hand and the result, in a sentence or a small table.
  • What you checked against. The document, the real inputs or the table the tests came from.
  • What you did not verify. One honest line about each gap, with who or what would close it.

Google’s guidance on change descriptions asks for a first line that says what the change does and a body that gives context, the reasoning and any shortcomings (Google, Writing good CL descriptions). The last item on the list above is a shortcoming statement. Reviewers trust a description that names its own gaps more than one that claims none.

What you decide and what you hand up

Decision Who decides Your part
How hard to verify this change, and when to stop and write it by hand You Match the checking to the cost of being wrong, and say what you did
Change size, second reviewers, disclosure Your team, with your manager Follow the agreement; tell your manager when it does not cover a case
Which tools, which models, what may enter a prompt The company, through AI and the engineering organisation and its policy Know the policy; ask the security lead when unsure
Permissions and the standard every agent meets Principal engineers Raise gaps you hit; do not work around a control

If you find that your team’s agreement does not cover your case, say so early and propose a line for it. If you find that a tool can do something the policy forbids, tell the person who owns the policy and do not decide it yourself.

Where practitioners disagree

Read every line, or trust the checks. Willison’s post “Vibe engineering” proposes a name for the careful, professional use of agents, set against vibe coding’s prototype-and-accept habit. Other teams treat generated code more like a build artefact and put the effort into specifications and tests, reading the code only where something fails. A fair position for one engineer is to read every line that you could be paged for, and to let strong, independent tests carry more of the weight elsewhere.

Who writes the tests. One view is that the agent should write them because it is quick and thorough. Another is that you write the tests first and let the agent satisfy them, so the tests come from your reading and not its reading. A middle course is to let the agent write tests and to add your own from an independent source for anything that matters.

Hard problems or easy ones. Some engineers give agents only mechanical work, where checking is cheap. Others give them hard problems and spend the saved time on verification. The first costs some speed. The second costs more checking. Neither is wrong, but both need a plan for the checking.

Skill. Engineers worry that leaning on an agent weakens their own skill, particularly early in a career. The evidence is thin and anyone quoting a confident figure should be asked for the source. A cheap precaution is to write some work by hand, chosen for what you most need to learn.

Day to day

At the start of a task. Write down what done means in two sentences. Decide what you will check, and what evidence you will accept, before you see the output. A short task, which you can read in one sitting, is easier to verify than a large one.

While the agent works. Read the diff as it grows and stop it when it wanders. Commit often so you can undo a step. Keep real data out of the prompt.

Before you open the pull request. Run the verification pass from the table above. For most changes it takes minutes. Revert and re-run the tests once. Write the description with the four items for agent-written changes.

In review. Answer questions about the change as its owner. “The agent wrote it” is not an answer. If a reviewer finds something you missed, add the check that would have caught it.

After the merge. Watch the first deploy and the dashboards for your area, as you would for any change. Your team’s review window and retrospective are where you raise patterns, such as an agent that keeps loosening assertions.

Weekly. Note the mistakes the agent made this week. When one repeats, put a line in the shared instruction file, or a check in the pipeline if it must hold every time.

Monthly or quarterly. Re-read your team’s working agreement and tell your manager what it misses. Choose a piece of work to do by hand.

In a normal week the extra work is the verification pass on each change, and it should be shorter than the time the agent saved. If it is not, give the agent smaller tasks.

BY ORG SIZE
STARTUPunder 30 people

There is rarely a policy, a security lead or a reviewer who knows the code, so you may be the only check. Keep the habit small and strict: the description says what you ran, and every change that touches money, access or customer sends has a test you wrote from a source outside the agent. Do not give the agent code you could not have written yourself. Reviews are quick and informal, so the record you leave for the person who maintains this in a year is the one you write now.

SCALE-UP30 to 300

A company policy probably exists and teams read it differently. Your team’s working agreement is where it becomes concrete, and reviewers are busy enough that a description with evidence changes how closely they read. Say when an agent wrote most of it, name what you checked and ask the reviewer who knows the area for a second look at the risky part. Reviewers know different parts of the system, so choosing the right one is part of your job.

ENTERPRISE300 and up

Approved tools, retention terms and audit trails limit what you may use and what may enter a prompt. A change board may see only your description, so the verification record is the evidence it relies on, and it should be complete without you in the room. Different business units may use different agents, so check which are approved for your work. Expect the policy to change more slowly than the tools and keep a note of cases the policy does not yet cover, to hand to whoever owns it.

ARTEFACT Record what you verified in an agent-written change ~40 MIN
YOU PRODUCEA verification record to attach to the pull request

Template

# Agent-assisted change: <title>
Author · Date · Pull request: <link> · An agent wrote most of it: yes / no

## What I asked for
<The task in two sentences, and what done means.>

## What the agent changed
<Files and size. Anything I did not ask for, and what I did about it.>

## What I could not explain at first
| Part | What the agent said | Checked against | Result |
|---|---|---|---|
| | | | |

## What I ran
<Inputs, by hand, and what came out. Real data as counts only.>

## Tests
- Added or changed:
- Written from: <a source other than the agent's own reading>
- Fails without the change: yes / no, and how I showed it

## What I did not verify
<Item, why, next step, owner.>

## Where a reviewer should read slowly
<Two or three places.>
WORKED EXAMPLE

Owoleaf at 200 people. A payments engineer asked an agent to rewrite the function that charges the fee on a transfer to a bank account, to follow the help centre’s Fees and limits page: ₦10 up to ₦5,000, ₦25 from ₦5,001 to ₦50,000, ₦50 above. Amounts are integer kobo, so ₦5,000 is 500,000. All figures are illustrative.

What the agent changed. Three files: the fee function, its test file and an existing rounding test. The third was not asked for. An exact-match assertion in it had been loosened to a tolerance. I reverted that file.

What I could not explain. Nothing; the function is two comparisons. I read each one against the page and found that the agent used less-than, so exactly 500,000 returns 2,500 kobo (₦25) and not 1,000 (₦10).

What I ran. Twelve amounts from last month’s transfer export, by amount only with no account details. Ten matched the fee the ledger charged. The two that did not were exactly ₦5,000 and ₦50,000.

Tests. The agent’s three tests used ₦1,000, ₦20,000 and ₦100,000 and passed. I wrote four from the page’s boundaries: 500,000 expects 1,000; 500,100 expects 2,500; 5,000,000 expects 2,500; 5,000,100 expects 5,000. Two failed on the agent’s code. With less-than-or-equal all four pass, and reverting the fix fails two again.

Not verified. Zero and negative amounts return ₦10; I read the caller, which rejects them first. Fees on transfers abroad are outside this function and untested. The payments lead should confirm that “up to ₦5,000” includes ₦5,000.

Read slowly: the two comparison operators.

Now you

You are Adeyinka, an engineer on Wrenpost’s Delivery Reports team. An agent changed the classifier that turns one carrier’s status text into Wrenpost’s delivery statuses: delivered, failed, expired or unknown (a fifth, sent, is not produced by this function). The carrier changes its format on 1 December. The diff is three files, +142 −19. The 38 old tests and 12 new ones pass; the agent wrote the new ones, one string per code. You cannot explain the pattern below. The agent’s note says: “ACCEPTD is final for this carrier, so it counts as delivered.” The carrier’s guide defines ACCEPTD only as “accepted by the carrier network”. Customers get your state in a webhook, and some stop retrying on delivered. The release cut-off is Thursday. Your team’s page says: read the whole diff, make one test fail without the change, and say when an agent wrote most of it. Write the record for the pull request.

^(?:(DELIV(?:RD|ERED)|ACCEPT(?:D|ED))|(UNDELIV\w*|REJECT\w*|DELETED)|(EXPIRED))$   (case-insensitive;
group 1 = delivered, group 2 = failed, group 3 = expired, no match = unknown)

Last week, one carrier, 1,000 reports (counts only, from a query):
DELIVRD 812 · UNDELIV 61 · EXPIRED 47 · ACCEPTD 58 · REJECTD 9 · UNKNOWN 13
Of the 58 ACCEPTD: 41 later got a final report (38 DELIVRD, 3 UNDELIV); 17 never did.

Self-check

DECIDE

Adeyinka, an engineer on Wrenpost's Delivery Reports team, asked an agent to map one carrier's status codes to Wrenpost's delivery statuses. All 38 old tests and the 12 the agent added pass. One function is a dense regular expression she cannot explain; the agent says it handles known variants. Customers receive the state by webhook. Minh, in Routing, knows that carrier. The release cut-off is Thursday, and her team's page says the author must be able to say what the change does. She has two hours today. What does she do?

READING
  1. POST
    Measuring the Impact of Early-2025 AI on Experienced Open-Source Developer Productivity Joel Becker, Nate Rush, Beth Barnes and David Rein (METR), 2025

    The randomised trial behind the gap between how fast the tools feel and how fast work finishes. Read what the authors say the study does not show before you quote it in either direction.

  2. POST
    We are Changing our Developer Productivity Experiment Design METR, 2026

    METR's own account of why its later data is an unreliable signal. Read it before you repeat any single figure about how much the tools help.

  3. POST
    Your job is to deliver code you have proven to work Simon Willison, 2025

    A short argument for sending evidence with every change: your own manual testing and automated tests. The standard this chapter asks of you.

  4. POST
    Vibe engineering Simon Willison, 2025

    The proposal of a name for careful, professional use of agents, as against careless prompt-and-accept coding. Read it for one practitioner's framing of the contrast.

  5. HANDBOOK
    What to look for in a code review Google Engineering Practices

    Google's public guidance on what a reviewer checks, including whether the tests will fail when the code is broken. Use it as the checklist you run on your own change before anyone else sees it.

  6. HANDBOOK
    Writing good CL descriptions Google Engineering Practices

    How to write the first line and the body of a change description, including the shortcomings. A base for the four extra items an agent-written change needs.

  7. DOC
    Regular expression Denial of Service - ReDoS OWASP

    What makes a pattern take far longer as input grows, with the examples to look for. Read it before you accept an agent's pattern for input that arrives from another organisation.

  8. DOC
    State of AI-assisted Software Development 2025 DORA, 2025

    The survey evidence that AI amplifies what an organisation already does well or badly. Read it with the reminder that survey data shows associations, not causes.

All companies and people in these examples are fictional. Any resemblance to a real business or person is unintended.

RECALL CARDS Tap to flip. They join your review deck when you mark the lesson complete.
NEXT: On call for what you built →