Inigo AnguloContact
Work01How I think02Lab03Writing04
Writing

Human in the loop for coding agents: the two gates that matter

Inigo AnguloNovember 4, 20267 min readAI agent teams

"Human in the loop" usually means a person watching a stream of output and clicking approve until they stop reading. That is not a gate, it is a ritual. After seven weeks of running an AI engineering team to production, I ended up with exactly two places where a human must act, and a rule for keeping both cheap enough that they are actually used.

ticket GATE 1decision build checkspen test GATE 2release prod automated, read by scripts, never declared one id, one letterone approval, one report
Two gates. Both answered in seconds, both logged, neither skippable.

Gate 1: the decision

Agents stop when they hit a question that changes the product: a boundary, a trade off, a scope. They do not guess. The lead writes the question in a fixed format: a one line question, lettered options, a recommendation with the reason, and what happens if nobody answers. I reply with the id and the letter. "014-3 B". Nothing else.

Three things make this a real gate. The format is fixed, so I can answer twenty in ten minutes. The answer is recorded in the repository with the reasoning, so it is never re-asked. And the list of what gets escalated is closed: architecture, data model, security, destructive migrations, new infrastructure, scope, irreversible operations, large behaviour changes. Names, configuration, test structure and git conflicts never reach me. If they did, I would stop reading, and the gate would become the ritual I described above.

Gate 2: the release

Code reaches main through automated checks and an agent review. It reaches production through one human command, and only when three things are true for the exact commit being promoted: all required checks are green on that commit (not an earlier one), the security agent's penetration test says PASS for that commit, and the pre-promotion queries about data compatibility have been run. The approval is logged with who and when. The person approving cannot be the agent that built it, by construction: no agent holds the credentials the workflow uses.

On October 15 the pen test came back FAIL on a rule unrelated to the feature being promoted. The gate held. The feature shipped behind a flag and the rule was fixed first. That is what the gate is for: not to review every line, but to make "no" cheap at the one moment where "yes" is irreversible.

What is not a human gate

Why two and not five

Every gate you add has a cost that compounds: the agents wait, the human skims, and skimming is worse than absence because it looks like review. Two gates, both with a fixed format and a closed list of triggers, survived seven weeks and 15 releases without being skipped once. Five would have been skipped by week two.

This is part of a series on running AI agent teams. The hub: AI agent teams for software development. The numbers: 445 PRs in seven weeks. The product: Acervo. If you want the gates set up in your team: AI build and deployment.

Kit

Copy the format: Escalation and decision format, with a prompt to use it and its changelog.

Working on something like this?

This is the method behind how I build: AI native development with human gates. Discuss a product idea → Or email me.