Loops · Bounded Loops

Loop Engineering You Can Actually Run

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.

LiveLicence Apache-2.0Version 0.7.7Loops hub

Verify it yourself

LicenceApache-2.0
Bounded Loops — Loop Engineering You Can Actually Run
69Loop Packages
65Keyless
9 + kill switchEnforced Bounds
Apache-2.0Software license

Figures as reported by the project. Check them against the code and paper linked above.

Recipes

Find a workflow for your task

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

Try one observable result

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.

Research, scope and assumptions:arXiv:2609.27871

Install

Run it locally.

Install

pip install bounded-loops

What it does

How it works.

Nine Bounds + Kill Switch

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 Gate Decides, Not the Agent

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.

69 Loop Packages, 65 Keyless

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.

Vacuity and Self-Attestation, Measured

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.

A Ledger You Can Re-Verify

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.

Bring Your Own Agent

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

Where it fits.

  • Verify every case citation in a legal brief is real
  • Reconcile ledgers and 3-way-match invoices in finance
  • Gate insecure config (secrets, CORS, JWT alg, Dockerfile) in security review
  • Keyless CI loops that stop only when a real gate passes
  • Human-gated (L2/L3) agent loops for regulated industries
  • Run the same bounded loop across Claude Code, Codex, and agent frameworks

Who it is for

Who should use it, and who should not.

A good fit

  • Developers who run Claude Code, Codex, Hermes or Antigravity on tasks with a checkable finish (a failing test, a schema, a lint rule) and are tired of an agent reporting success while the check still fails.
  • Teams who need an attempt, token or time limit set before the run and enforced by the engine, with a record they can re-verify afterwards.
  • Anyone building multi-step agent pipelines who needs fan-out, joins, repair routes and human approval before an irreversible step. The graph engine covers those.

Probably not a fit

  • Your task has no machine-checkable finish. The gate is a command, a test suite or a schema, and without one there is nothing independent to run.
  • You want a hosted service. It is a local engine and CLI.
  • You need OS-level isolation outside macOS for graph runs. Per the README, bl graph run --execute needs macOS; every other command runs anywhere.

Quick start

Install it and run the first command.

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

How Bounded Loops 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

Ralph

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

LangGraph

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

A test in your own harness

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.

Changelog

What shipped.

The latest releases on GitHub.

  1. bounded-loops 0.7.6

    Native Antigravity lifecycle-hook repair.

  2. bounded-loops 0.7.5

    Hermes public-install compatibility repair. Users of 0.7.4 should upgrade before native Hermes installation.

  3. bounded-loops 0.7.4

    Native Hermes plugin support, an additive bridge v2 producer, and release-pinned runtime support.

  4. bounded-loops 0.7.3

    Fixes bl capabilities so loop and graph terminal states render separately.

  5. 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.

  6. 0.7.1 — the MCP handshake reports its version

    One fix. The MCP server did not report its own version.

Full history on GitHub

Research

The paper behind it.

arXiv:2609.278712026-08-20Preprint

Bounded Loops: Pre-Run Spend Bounds, Proved Termination, and Verified Completion for Agent Harnesses

The instrument found 47 vacuous gates — checks satisfied by the absence of the thing they check — in shipped, reviewed code

Guides

Read the guides.