Esteban | ˈe-stə-vən - /collection/pass-or-block-before-it-ships/

Put a pass-or-block check in front of costly outputs

Oct. 27, 2026

Read time: 4 minutes and 55 seconds.

tags:

Check it at the door, not after it’s out

Picture a small online shop on a Tuesday morning. Overnight, an AI workflow wrote and sent a promotional email to the whole customer list.

The subject line is fine. The body says the winter jacket is on sale for a price that’s missing a zero.

By the time the owner wakes up, there are orders in the queue at that price and a handful of replies asking whether it’s a mistake. Now somebody has to decide whether to honour the orders or cancel them and apologise.

Either way, the cost was set the moment the email left, and nothing stood at the door to stop it.

Most teams handle bad AI output the way most drivers handle a warning light. They wait until the car stops, then they go looking for the cause.

A customer complains about a wrong price in an email or a refund that shouldn’t have been issued. Only then does anyone look at what the model produced. That’s the expensive order of operations.

Any output that costs you money when it’s wrong deserves a gate in front of it.

What a gate is

A gate is simple. Before your output goes anywhere that matters, an automatic check looks at it and returns one of two answers: pass or block.

On a pass, it goes out. On a block, it stops with a short reason, so a person or a retry can deal with it. You get no maybes and no long reports, just a clear yes or no at the point where the damage would happen.

Think of the bouncer at a club. He doesn’t need to know everyone’s life story. He checks a couple of specific things at the door, like age and the guest list, and makes a quick call.

He’s not perfect, but he catches the obvious problems before they’re inside. That’s far easier than finding them on the dance floor later.

Software teams have used gates like this for years, just not on AI output. GitHub’s docs on protected branches describe settings that block a merge until reviews are approved and status checks pass.

Nobody argues with that gate, because everyone has seen what happens without it. Your AI output that goes straight to customers deserves the same respect as code that goes straight to production.

Choose what the gate checks

The trick is choosing what your gate checks. Start with the failures that cost you the most and are easiest to detect.

For a price, check that it sits inside a sensible range. A message to a customer should never contain placeholder text, internal notes or someone else’s name.

Code has to run and pass its tests. And when you’re sending a document, make sure the required sections exist and the facts match the source.

Each rule is boring on its own. Together they catch most of what would have embarrassed you.

For structured output, you often don’t need to write the rules from scratch. JSON Schema is a standard vocabulary for describing what valid JSON data looks like: which fields are required, what type each one is, what range a number must sit in.

Ask your model to return structured data and validate it against a schema. A missing field or an absurd price then fails the gate before anyone sees it.

Keep the gate separate

Keep your gate separate from whatever produced the output. A model checking its own work tends to approve it, for the same reason a writer rarely spots their own typos.

Use a different check, ideally a plain rule or script where possible. Bring in a second model only where a rule can’t do the job.

When you do need a model in the gate, keep it in a separate role. Anthropic’s write-up on building effective agents describes an evaluator-optimizer pattern where one call generates a response and another evaluates it.

That separation is the point. I made the same case in running coding agents as a small team with checks: your reviewer should never be the one who wrote the work.

Strict, honest and tuned

Make your gate strict and honest. One that passes everything is just a delay.

One that blocks too much gets switched off by frustrated people soon after it goes live, so tune it. Watch what it blocks and adjust when the blocks were wrong. Over time it becomes a precise filter instead of a blunt one.

Google’s SRE book has a useful chapter on monitoring distributed systems that applies here even though it was written for servers.

A big theme is keeping alerts simple and low in noise, so that people trust them and act on them. Your gate works the same way. If half its blocks are false alarms, your team learns to ignore it, and then it’s worse than nothing.

Finally, log every decision. When something does slip through, your log tells you which check should have caught it, and you add that check.

When the gate blocks something good, the log points at the rule that’s too tight. It gets smarter because you keep feeding it real cases.

Where gates belong

Not every output needs one. An internal draft that a person will read anyway is already gated by that person.

You need a gate on the outputs that go somewhere on their own, like emails to customers, prices on a page or code merged without a human looking.

Ask yourself a simple question. If this output were wrong, who would find out first? If the answer is “a customer,” you need a gate.

That ranking is the same exercise I described in scoring your agent before you trust it. List what your system can do, rank how bad each mistake would be, and put the gates in front of the worst ones first.

None of this slows down good output in any way that matters. It only slows down the bad output, which is exactly the output you wanted to slow down.

One thing to try this week

Pick one AI output in your business that reaches a customer without a person reading it first. Write a few rules it must pass, covering its format and the things that must never appear in it.

Put those rules in a small script between the model and the send step, set to block and log. Run it for a week and read the log.

Gate it before it costs you.