The gates I put around an agent

An agent's output looks finished long before it is. What helped wasn't a better prompt. It was deciding where each kind of failure should go.

I built an engine around v0, Vercel’s AI builder. You describe a shop, v0 writes the store, and a real browser checks it before anyone can publish it.

The first version had one idea: if a check fails, send it back. It didn’t take long to see why that isn’t enough. Not everything that goes wrong is something the agent can fix, and some of what it can’t fix, it will happily claim to.

Pass or fail isn’t enough

A check can end four ways, and I had to work out where each one goes. Pick one and follow it.

CheckEvidence keptBack to v0To a person, at the gateStays here, never sent
The checker couldn't click Add to cart. That's something v0 can fix, so it goes back with what the browser saw.

The warn path matters most to me. If you ask an agent whether “4.9 stars” is true, it will give you an answer. So the engine doesn’t ask.

In the Halden run all five flagged figures were monthly amounts v0 had worked out from the prices.

Send evidence, not a verdict

“The cart is broken, please fix it” invites a confident rewrite of the wrong thing. So the message contains the check, what the browser saw, and at which size.

Then everything gets checked again, not just what failed. A fix for the cart drawer can break the header, and nobody would look there if the engine didn’t.

Real result: two files, 14 lines added, 2 removed.

Decide in advance when to stop

An agent will try forever if you let it. A repair loop needs an ending that’s written down before it starts.

Round 1The failure goes back with the evidence.
Round 2Same failure? The message adds what v0 changed last time, and how the browser actually drew the element.
StuckStill the same? The check is no longer sent. The gate stays locked and a person gets all of it to read.

Three of my 15 runs ended this way. I count those as the engine working. A locked gate with the evidence attached is the result I built it for.

The person comes last, on purpose

By the time someone reaches the gate, the machine has settled everything a machine can settle. What’s left is short: a couple of warnings and a yes or no. That’s a better use of a person than reading through generated code.

Next time I’d start here. I now work out where each failure should go before I write a prompt. Better prompts changed less than deciding what happens when the output is wrong.