Bounded Loops
5 stars
Licence: Apache-2.0
Loops · Bounded Loops
An AI coding agent can tell you it finished when it did not. Bounded Loops runs your agent until a check it can neither edit nor grade says the work actually passes, and stops at a limit you declared before the run started. Three words carry the whole idea. The gate is the check that decides pass or fail — a command, a test suite, a schema, never the agent; the agent's own "I'm done" is written to the record and ignored. The bound is a limit declared up front: attempts, tokens, wall-clock, laps without progress. The ledger is the append-only, hash-chained file of what happened, and `bl verify` re-checks it, so "it passed" is something you confirm rather than trust. The accompanying paper proves three guarantees — that a run finishes, does not drift, and does not overspend — and then measures the gates themselves against a held-out mutant corpus, because a proof about gates is worth what the gates are worth.

Figures as reported by the project. Check them against the code and paper linked above.
Recipes
69 shipped loops and 7 reference graphs. Browse independent acceptance gates for engineering, finance, content and operations. Default examples and live execution have different requirements.
Working proof
Require a separate acceptance check before completion, with declared limits and a persisted receipt you can verify.
python -m pip install bounded-loopsbl loops install bug-fix-red-green --dest ./loopsbl run loops/bug-fix-red-green --yes --run-id first-proof
The 1 October 2026 keyless demo used a stub worker and a real pytest gate. An ungated false GREEN claim failed its tests; the gated run passed six tests, and the persisted receipt passed chain, separately recorded head, and completeness checks. Not a hosted-agent accuracy or savings benchmark.
Install
Install
pip install bounded-loopsWhat it does
Iteration and stall limits, scratch sandbox with symlinks refused, input quarantine excluding key material, output schema gate, per-lap tracing, regression evaluation, token budget, human approval, wall-clock limit. BOUNDED_LOOPS_KILL is checked before every lap; gate commands are tokenized and run without a shell.
The domain rule lives in one file and holds regardless of runner, gate, or storage backend. A gate the worker cannot write to is the only thing that can end a loop — pytest, a JSON Schema, a command, a security scanner. The agent's claim is recorded and ignored.
Finance, legal, retail, operations, enterprise and ERP, security, testing, content, research, business, healthcare, and software. They ship inside the wheel, so `bl loops install` copies one into your project with nothing downloaded — it works offline.
Two defect classes let a sound-looking check pass anything: a check satisfied by the absence of the thing it checks, and a check whose subject supplied the value it is applied to. Turned on its own 69-loop catalogue, the instrument found 47 such gates in code that had shipped and passed review.
The receipt log is the sole durable state; the CLI, monitor, MCP server and Arena report are projections of it and hold none of their own. A third party holding only the run directory can check that no node reached DONE without a gate verdict — and the released verifier does exactly that.
Works with Claude Code, OpenAI Codex, Antigravity, or no agent at all. Ports-and-adapters throughout, with one composition module permitted to wire an adapter to a port — enforced by an import-graph walk that counts function-local and dynamic imports.
Use it for
Who it is for
A good fit
Probably not a fit
Quick start
No API key needed: the worker is a stub and the gate is real pytest. The commands are from the README. Run in a clean virtual environment on 24 Nov 2026 (bounded-loops 0.7.7 from PyPI, Python 3.13), the loop finished with the output below.
Run in a clean environment on 24 Nov 2026. The output is real.
Install, fetch a shipped loop, run it
python -m pip install bounded-loopsbl loops install bug-fix-red-green --dest ./loopsbl run loops/bug-fix-red-green --yes --run-id first-proof # stub worker, real pytest gate
Output (ledger path omitted)
[bounded-loops] About to run loop 'bug-fix-red-green':
runner : stub
gate : pytest -q
✓ [DONE] gate-passed (laps: 1)
Gate verified: the independent acceptance gate passed after 1 lap.See the failure it prevents
./loops/bug-fix-red-green/wreck.sh # the ungated version: exits claiming successbl run loops/bug-fix-red-green --yes # the same task, gated: pytest decides
The README says the wheel ships 69 loops, 65 of them keyless, and the repository adds seven digest-pinned graphs.
Bounded Loops README: Quickstart and Why you would want this
How it compares
Three ways to get an agent to keep working until it is done. Star counts are from the GitHub API on 24 Nov 2026; Bounded Loops has 5.
Choose Bounded Loops when "done" must be decided by something the worker cannot edit or grade, and you want limits declared before the run plus a hash-chained record to check later. It is young, with one maintainer and 5 stars.
Bounded Loops
5 stars
Licence: Apache-2.0
Alternative
22,337 stars
Licence: MIT
What it is. A shell-based loop that runs Amp or Claude Code repeatedly, with a fresh context each time, until all items in a PRD file are complete. Memory persists through git history, progress.txt and prd.json.
Choose it when. You want the simplest possible loop and trust the agent to report which items are complete. It is a pattern with a script, not an independent gate.
Alternative
45,352 stars
Licence: MIT
What it is. A low-level orchestration framework for stateful agents with durable execution and human-in-the-loop controls.
Choose it when. You are building the agent itself and want a mature graph runtime. The Bounded Loops paper notes that durable-execution platforms bound retries and time, but their checker usually lives in the same codebase as the work. Four shipped loops require a framework package: langgraph, crewai, agent-framework or google-adk.
Alternative
No GitHub repo of its own
Licence: Yours
What it is. Many teams already stop an agent when their own check passes. That works as long as the check really checks something.
Choose it when. You trust your own gates. The paper's finding is the reason to measure them: its instrument found 47 vacuous gates among 69 shipped loops, meaning checks that pass because the thing they check is absent.
The paper evaluates v0.6.6; the current software is newer, and later changes are not paper results. The zero false accepts over 209 destroying mutants (alpha at most 1.8%, Wilson 95%) is, in the paper's own words, saturation and not quality: a fresh operator family on frozen gates recovered a 23.3% false-accept rate.
Proof and links
arXiv preprints
Related posts
Guides
Changelog
The latest releases on GitHub.
Native Antigravity lifecycle-hook repair.
Hermes public-install compatibility repair. Users of 0.7.4 should upgrade before native Hermes installation.
Native Hermes plugin support, an additive bridge v2 producer, and release-pinned runtime support.
Fixes bl capabilities so loop and graph terminal states render separately.
0.7.2 — a forged evidence digest could reach the receipt
Two fixes from an audit for one specific defect shape: a check whose criterion is applied to a value the party under scrutiny controls. Both were confirmed by writing the exploit first.
0.7.1 — the MCP handshake reports its version
One fix. The MCP server did not report its own version.
Research
The instrument found 47 vacuous gates — checks satisfied by the absence of the thing they check — in shipped, reviewed code
Guides
The parts of an agent harness, what most guides leave out, and a gated loop you can run.