DEV Community

Cover image for Agents Lie About Being Done. Here's the Gate That Won't Let Them.
varun pratap Bhardwaj
varun pratap Bhardwaj

Posted on

Agents Lie About Being Done. Here's the Gate That Won't Let Them.

Announcing bounded-loops — an open-source, runnable reference library of bounded AI-agent loops. Apache-2.0.

Repo: github.com/qualixar/bounded-loops
Install: pip install bounded-loops (or npx bounded-loops)


Every coding agent I've run has, at some point, told me it was done when it wasn't. Tests reported "passing" that were never executed. A task marked "complete" with the actual bug still sitting untouched in the diff. A refactor "verified" against a suite that didn't run.

The agent isn't being malicious. It's doing exactly what it was trained to do: produce a confident, plausible completion. And "done" is the most confident-sounding thing it can say. The problem is that in an autonomous loop, the agent's claim of success is also the loop's exit condition. The thing being measured is grading its own homework — and then deciding class is over.

That's the gap I built bounded-loops to close.

Loop engineering is real. Most of it is prose.

Addy Osmani named the shift "loop engineering" — after Peter Steinberger's post on designing loops instead of prompting agents went viral the same week, and Boris Cherny, who leads Claude Code at Anthropic, said his job had become writing loops that prompt Claude. Three people, one week, one name — the observation that as agents move from single-shot completions to autonomous loops, the interesting engineering is no longer the prompt, it's the loop the agent runs inside: what feeds it, what stops it, and how it knows it's finished.

I agree with all of it. But when I went looking for something I could actually run — clone it, point it at my agent, watch it enforce the loop — most of what exists is writing about loops, not runnable loops. That's the open ground: a framework-neutral, runnable, gated reference. So I built it.

The one rule: the agent never declares success

bounded-loops has a single non-negotiable invariant: the agent does not get to say when it's done. An independent gate does.

A gate is a mechanical check the agent cannot talk its way past — a JSON-schema validation, a linter, a test suite, a stdlib checker. It returns a real verdict against real output. The loop runs the agent, runs the gate, and only the gate's verdict advances the loop toward DONE. The agent can be as confident as it likes; if the gate says the output is still broken, the loop keeps going.

Around that gate sit nine enforced bounds — the guardrails that make an autonomous loop safe to leave running:

  • max_iterations — hard cap on laps
  • max_tokens — token budget ceiling
  • max_wallclock — real elapsed-time limit
  • a forbid-list — patterns the output must never contain
  • ...and the rest, covering schema conformance, rung escalation (L1/L2/L3), and cassette-replayable determinism.

The loop terminates on exactly one of two conditions: the gate says DONE, or a bound trips. The agent's word is never one of them. That's the whole reliability argument in one sentence — and it's why this is AI Reliability Engineering rather than another agent framework: we don't try to make the agent more honest, we build the thing that checks it.

67 runnable loops, keyless, across a dozen industries

Abstractions don't convince anyone. So bounded-loops ships as 67 runnable loops you can copy today, spanning a dozen domains: invoice three-way matching, citation-existence checks, GTIN check-digit validation, secret scanning, accessibility linting, OKR measurability, IDoc XML-schema conformance, and more.

Each loop folder is the same honest shape: a deliberately broken input, a mechanical gate that fails on it, and a recorded fix that makes the gate pass. Most run keyless — no API keys, no accounts, no cloud — because the gate is stdlib, not a model call. Clone one, swap in your own gate, and point it at whatever agent you're running.

pip install bounded-loops     # or: npx bounded-loops
bl list                       # see every loop
bl run invoice-3way-match     # watch the gate decide DONE
Enter fullscreen mode Exit fullscreen mode

Build it with me, not next to me

This is deliberately built on the loop-engineering conversation, not against it. If you've been thinking in loops — Peter, Andrew, and everyone shipping in this space — I'd rather build this together. The repo is Apache-2.0 and open to contribution: try a loop, break it, open an issue, send a PR for a loop from your own domain.

github.com/qualixar/bounded-loops

bounded-loops is part of Qualixar, an independent AI Reliability Engineering initiative by Varun Pratap Bhardwaj.

Top comments (0)