Building with Agents: How I Check That It Actually Works

2026-10-16

By Paul DeSalvo

10 min read

reliable systemsai agentstestingverification

You buy a freshly renovated house. The listing photos show a new kitchen, fresh paint, a new light over the dining table and clean rows of dark shingles. Then the first hard rain leaves a brown stain on the bedroom ceiling. When you take the dining room light down to hang a different one, there's a new cable coiled in the ceiling, capped off. The light has been running on the old wiring all along.

Neither problem shows on a walk-through. Each waits for something to happen to the house.

I found the software equivalent in a journal app I was building with a coding agent. I expected a model to guide the chat. Much of the conversation was being decided by rules in Swift instead.

The screen looked convincing. Finding out whether we'd built what I intended took a different kind of inspection.

A freshly renovated house

A coding agent builds the feature.

What I ask for

Find out what actually ran

The coding agent was building the app; the model inside it was meant to read what I'd written, ask a useful question and follow up on my answer. I expected to shape that conversation by improving the prompts.

When the conversation wasn't doing what I wanted, I kept asking the coding agent to improve it. Then I asked what was actually running.

There were thousands of lines of Swift, the app's ordinary code, deciding how the chat behaved: which question to ask, which branch to take and which answer to assemble.

An app needs code around a model. What I hadn't chosen was for that code to decide the conversation itself.

The guided chat made the difference easy to see. I could pick a moment from my day and get a reasonable opening question: "How was the meeting? What happened during it?" It looked as though the model had read about the meeting and decided what to ask. The question had actually come from a fixed list. Only after I answered did a follow-up reach the model.

The code for asking the model to write an opener already existed. The feature wasn't calling it. I could keep rewriting that prompt and leave the first question unchanged.

That was the dining room light. The new cable was already in the ceiling, and nothing was connected to it. A nicer fixture would change how the light looked and leave it on the old wiring.

That changed the inspection. An electrician traces a circuit from the switch to the fixture. I wanted the agent to follow a question from the screen to the answer and explain what did the work. Where was the model called? What did it receive? Which decisions had already been made in Swift before the prompt was sent?

The tests had been passing the whole time.

An inspector can walk a roof on a sunny afternoon and find nothing wrong. The leak needs rain.

The journal was one of three apps I was building this way, alongside a trip planner and a workout app. Some of their automated checks ran in setups where the real model wasn't being used. The app returned its fallback answers instead: fixed questions, templates and rules for keeping a feature usable when the model was unavailable.

Those checks had a useful job. They could establish that the fallback behaved as expected. They hadn't established that the model could hold the conversation I wanted on my phone.

Another journal bug showed how a test could miss the route altogether. The code for answering questions such as "When was the last time I saw this person?" had become unreachable from the chat. The route that ran instead could choose a years-old entry despite newer matches. Tests of the bypassed function kept passing because they called it directly. The function worked; the feature no longer reached it.

A green result needs that context. Did the check open the feature, or call a helper? Did the answer come from the model, or the fallback? I started asking for evidence of the path, alongside evidence that the pieces worked.

Test the behavior

Knowing which path ran gave me a better question for the next inspection: could that path do the work I wanted?

You don't have to wait for a storm to find a leak. Roofers soak one section at a time with a garden hose while someone watches the ceiling inside.

My trip planner's assistant had arrived with passing tests. Then I had the coding agent hold a conversation with it. Asked which nights still needed a hotel, it named nights that were already booked. Asked about tickets and weather, it invented a price and a forecast despite instructions against doing either.

The conversation itself hadn't been run. The tests had checked other things.

So the agent built a small harness that used the app's own prompt and trip information to hold a conversation. Some questions had answers in the plan. Others deliberately asked for information the plan didn't contain. A useful assistant had to answer the first kind correctly and decline the second, including after several ordinary turns had carried the conversation away from its opening instructions.

The important output was the conversation I could read: what had been asked, what information was available and what the assistant actually said. A score helped find regressions, but I still wanted to see the answer that earned it.

The journal made the same point in a different way. Running its writing prompts against a realistic day produced an entry about me in the third person. The prompts hadn't told the model to write as me. A test that only checked whether an entry came back couldn't tell me whether it sounded like mine.

Check the diagnosis before the repair

Running the interaction exposed failures. Deciding what to repair still depended on getting the cause right.

A ceiling stain can sit a long way from the hole. Water gets in higher up and runs along a rafter before it drips, so a patch above the stain leaves the leak where it was.

The journal could give useful answers and still fail when I asked about a particular person or conversation. Sometimes it combined details from unrelated entries into an account of something that hadn't happened. A correction could also be treated as a new topic, dropping the question I was trying to clarify. When answers came back thin, the agent's conclusion was that the model was too small to do the job. The proposed answer was more plain code around it.

Then I looked at what the model had been given.

The journal's recaps were using the opening of each entry, even when the important part came later. Search results reached the chat as short fragments, sometimes joined to an unrelated opening passage. Instructions kept accumulating while the journal excerpts stayed small. The model was being asked to reason about writing it hadn't received.

What I wanted was ordinary diligence. To answer a question about a person, find the entries that mention them, pull the relevant passages with enough surrounding context to understand them, and show me what reaches the model. Then judge its answer against that evidence.

Measuring the assembled prompts revealed unused space while fixed limits upstream kept discarding source text. A larger allowance at the final step wouldn't help if an earlier step had already thrown the passages away. More instructions wouldn't bring them back either.

The repairs for the missing context changed how passages were selected and carried through. A recap could use a representative part of the whole entry instead of whatever happened to appear first. A search result could preserve one coherent passage rather than splicing fragments together.

Adding more rules around the model could have made the app more complicated while leaving the missing evidence untouched. The agent had diagnosed a model limitation before checking what the model received.

Choosing what the model should do

Those failures exposed decisions about what the model should do in the first place. I wanted it to understand a conversation, but an exact date order was something the application could enforce.

The journal's last-seen question needed both the right search and the right ordering. One route had let the model choose an older excerpt over newer matches. In another failure, a search for the person's name found many entries, while the full question found almost nothing. The index required every word in the question to appear in an entry. "Last time" had become text to match instead of an instruction about which result I wanted.

That repair separated the person to search for from the ordering of the results. Asking the same question again in the journal's Mac version returned the correct recent entry, with its sources. That settled this lookup. It said nothing about the journal's other conversation and context problems.

The trip app had another clear boundary. Asking the model to reconstruct a plan had dropped travel legs. The plan was in a format the application itself defined, so reading it back was a job code could do completely.

It also went the other way. Separate parsers for boarding passes and itineraries were becoming a maintenance burden. I wanted the model to read varied pasted text, with the traveler confirming what it found before it became part of a trip. That was a deliberate choice about what the model should do and where a person should review it.

The journal chat needed the same deliberate boundary. I wanted the model to read my words and decide what to ask next. Swift still had to retrieve the information, send the request and display the result. Replacing the conversation with a growing collection of scripted decisions was a different design, and one I hadn't asked for.

I wanted the agent to explain that boundary and test the behavior it produced.

Make inspection part of the agent's work

Repeated conversations, workout notes and imported documents produce more output than I want to carry back and forth by hand. Every change to a prompt or an input means another round. If the agent has to wait for me to run each attempt and paste back the result, fewer attempts happen.

Before those runs, I decide what counts as useful behavior: the chat must decline an unsupported question, the imported values must match the source, the journal entry must sound like me. The agent can run the cases, read the failures, make a correction and try again.

The original failed inputs and expected results stay in the test set through those repairs. If an expectation was wrong, I want to review the reason for changing it. A new collection of passing tests can leave the original problem untested.

The same arrangement let me check work in technology I hadn't built before. Sharing a trip between two iCloud accounts ran on a custom path alongside the app's normal storage, and one trip's places multiplied until there were 545 of them. I wrote about that repair separately.

Apple's sharing sample gave the agent a documented reference. Comparing our implementation with it helped remove a parallel mechanism we hadn't needed. To check the replacement storage, the agent first ran it in a separate test app with a synthetic trip and two physical devices on different accounts.

Edits made on the iPad reached the iPhone, and the iPhone's edits came back. After reconnecting and relaunching, the iPad matched the updated trip, down to the links between its records. That was one round trip, between two accounts, for a test trip. The production migration, interrupted changes and simultaneous edits each needed their own check.

I could define the outcome and review evidence of the round trip without becoming an expert in the storage system. The agent could do much of the inspection.

Afterward, I read examples of the actual output and the account of what was checked. I want failed cases and untested conditions alongside the passes. That's the inspection report: which sections leaked, which held and which never got tested.

In the workout app's parser, the agent could run notes with changing weights, repeated sets and warm-ups, inspect mistakes and check repairs against the inputs that had failed. Those were synthetic English notes chosen by someone who already knew the parser's weaknesses. Passing them didn't establish that it could read a photograph or handle another language. Those gaps belonged in the report.

What I ask for before I accept "done"

The listing photos are useful. I still want them. I just stopped treating them as the inspection.

Before I accept a feature, I want to know what actually did the work. Did the chat reach the model, or was code choosing the answer? Did the model receive the source material it needed? Was the result read and checked in the conditions that matter?

I also want the choices the agent made on my behalf, what it handed to code and what it left to the model, alongside the conditions nobody tried.

A feature that arrives with only a convincing demonstration gets its first rain in front of the people who depend on it.

Ask for the photos. Then trace the wires and run the hose.