OPEN SOURCE · MIT · v1.0.0 ON PYPI

One wrap. It learns what you spend.

guard(app) with no budget is observe mode — nothing enforced. It records the real dollar cost of every run, learns your true distribution, and hands you a cap to accept. Then it enforces that number in-process, between every hop.

MIT · Python 3.11+ · in-process · no server, no stored keys · 221 tests
OBSERVE · guard(app) · example profile
RUNS OBSERVED
0
SUGGESTED CAP
—
p95 · cap here
cost per run · low → high · ▮ runaway
MEDIAN$0.18
P95$2.40
MAX$12.63
observe mode · no budget · nothing enforced yet
01  THE FAILURE MODE IS FINANCIAL

You find out
from the invoice.

Agents call models in loops. A retry loop. A "let me try one more approach." An infinite tool loop. Nothing crashes — the run looks healthy right up until accounting reads it back to you.

$0
REPORTED · 11 DAYS
0×
COST VARIANCE, SAME TASK
BREAKERBOX
COUNTERFACTUAL RECEIPT
WHAT THIS RUN WOULD HAVE COST
input tokens$0.84
output tokens$1.23
retry loop ×47$38.90
self-reflection ×12$54.20
"one more approach"$92.11
infinite tool loop$198.42
TOTAL$385.70
TRIPPED AT $5.00
EVERY RUN ENDS IN A RECEIPT
PER-HOP COSTS · TRIP REASON · BLAST RADIUS
02  EVERYTHING ELSE IS THE WRONG SHAPE

Three tools you already have. None of them stop this.

Provider rate limits

Org-wide and coarse. A runaway run burns $180 while still under a $500 key ceiling — and when the key finally trips, it 429s everyone, mid-flight.

WRONG GRANULARITY
Dashboards

They show cost after it happened, beautifully. Observation, not enforcement. A smoke detector is not a sprinkler.

WRONG TENSE
Gateways & proxies

Outside the process, blind to internal structure — sub-agents, loops, checkpoints. And they hold your keys.

WRONG SIDE OF THE WALL

A key limit is the fuse box for the building. Breakerbox is the breaker on this circuit.

03  THE MECHANISM

A credit-card hold, on every hop.

One callback handler propagates down the entire run tree — nodes, sub-agents, subgraphs. One wrap meters everything. No LLM in the hot path. Deterministic. In-process.

1RESERVE

Before each call, hold the maximum possible cost against the budget. Parallel branches cannot race past the ceiling.

2EXECUTE

Run the call to completion — never severed mid-flight. You never pay for a half-finished token stream.

3RECONCILE

Settle the hold against actual usage. Enforcement lands at the hop boundary — the next step simply never dispatches.

Hierarchical escrow

Parent holds $5.00; sub-agents draw slices they cannot exceed. sub_budgets={"researcher": 2.00}

Semantic loop detection

Fuzzy repeat matching, no LLM. Trips a spinning loop before the budget pays for it.

Pause, don't restart

on_trip="pause" checkpoints state so you resume. kill lists every side effect that already fired.

04  PROVABLE COST CEILING · FLAGSHIP

Prove the number before you spend it.

A static, worst-case dollar ceiling computed from the spec — before the run, with zero API calls. DAGs sum their worst cases. Capped loops multiply hops by the costliest call.

And when a loop has no cap, it prints UNBOUNDED instead of inventing a number. An estimate you can't trust at the tail is worse than no estimate.

$ breakerbox ceiling spec.json

  method   static analysis · 0 API calls
  rule     DAG → Σ worst-case(node)

  plan → research → draft → review
  4 nodes · 0 unbounded

  ┌──────────────────────────────┐
  │  CEILING              $2.09  │
  └──────────────────────────────┘
  this file cannot cost more than $2.09
05  SECURITY SUITE · NEW IN 0.11.0

The meter that counts dollars sees every tool call.

Prompt-level red-teamers grade text. Breakerbox asserts properties at the tool-call level, at runtime. Four commands, one finding format, composable into CI.

breakerbox dow
Denial-of-wallet

Names the uncapped loop as the attack surface and prices the worst case per invocation.

breakerbox flow
Embedded credentials

Scans exported Langflow flows for the CVE-2026-55255 class, plus untrusted→action paths with no approval gate.

breakerbox mcp
MCP server posture

Hardcoded secrets, unpinned npx @latest supply chain, non-TLS remotes.

breakerbox baseline
Regression gate

Accept today's findings once; CI then fails only on new ones.

guard(capability_lock=True)
mark_untrusted(tool)

After untrusted content enters the run, side-effecting tools are blocked before they execute — not flagged afterwards.

06  THE WHOLE SURFACE AREA

One function. Eight ways to trip.

app = guard(
    compiled,
    budget_usd=5.00,            # hard dollar ceiling
    sub_budgets={"researcher": 2.00},   # hierarchical escrow
    max_hops=40, max_depth=3, ttl_seconds=900,
    velocity_usd_per_min=0.50,   # burn-rate rail
    detect_loops=True,           # semantic, no LLM
    capability_lock=True,        # block side effects post-untrusted
    on_trip="pause",             # or "kill"
    live=True, alerts=..., tags=..., otel=True,
)
TRIP REASONSbudgethopsttlvelocityloopdepthremotecapability
07  CI & FINOPS

The budget becomes a build artifact.

lock --checkPin prices and ceilings; fail the build on drift.
diff --fail-on-increaseBudget delta between commits, as a sticky PR comment.
breakerbox.yamlPolicy-as-code: the build refuses to emit violating code.
tags · otelPer-team cost attribution and OpenTelemetry spans.
08  OPTIONAL CLOUD

A builder that only writes code.

A React Flow canvas that emits plain guarded Python. Codegen only — nothing executes server-side, keys never leave the browser. Live run timeline, remote pause/kill with per-run control keys, shareable receipt links.

THE CORE STAYS LOCAL AND OFFLINE

Four lines to a hard cap.

No server. No stored keys. No LLM in the hot path. Add it to one run and the ceiling is real from the next hop onward.

Become a design partner →
$ pip install breakerbox
from breakerbox import guard
app = guard(compiled, budget_usd=5.00, on_trip="pause")
app.invoke(state)