01 / REQUEST FLOW
[ GATEWAY SPECIFICATION // REV-2026 ]
Stop runaway agents before they drain your API budget.
A drop-in reverse proxy that catches infinite tool loops and enforces hard spend caps in volatile RAM. Sub-35ms overhead. Zero payload retention.
curl -I https://circuit-breaker-api.onrender.com/health12:08:41.018 POST /v1/chat/completions
12:08:41.021 window scan: prompt hash match 1/3
12:08:41.024 spend check: within configured cap
HTTP/2 200 · upstream response passed
Simulated trace · example values
INTERACTIVE REQUEST SIMULATION
Loop detection trace
$ agent.run --task "insert order"
The agent repeats the same database write after an unchanged retry.
CLIENT CONFIGURATION
Change the base URL. Keep the SDK.
from openai import OpenAI
client = OpenAI(
base_url="https://circuit-breaker-api.onrender.com/v1",
api_key="cb_live_...",
)ARCHITECTURE // REQUEST PATH
Data path and enforcement points
02 / BLOCK RESPONSE
HTTP 400 payload
{
"error": {
"message": "Request blocked by Circuit Breaker",
"type": "circuit_breaker_loop_detected",
"code": "infinite_loop_killed"
}
}03 / VOLATILE MEMORY
RAM hash benchmark
<15ms
memory execution target
04 / MICRO-DOLLAR ACCOUNTING
Rolling spend ceilings and backpressure
Requests are checked against hourly and daily account caps before they are sent upstream. The bars below illustrate cap windows, not live account utilization.
CAP THRESHOLD · USAGE NOT SHOWN
CAP THRESHOLD · USAGE NOT SHOWN
Performance figures are engineering targets and depend on deployment, network conditions, and request profile.
FAILURE ANALYSIS // ILLUSTRATIVE SCENARIO
Autopsy of an Overrun
An unhandled SQL error leaves an agent retrying the same tool call at 120 attempts per minute. In this example, the sliding deque recognizes the repeat at attempt three and interrupts the cycle before the remaining requests are sent.
The $680+ / 45-minute cost is a modeled scenario, not measured customer spend. Estimated avoided spend assumes $35 per intercepted incident.
01 · 00:00
SQL write fails
Agent receives retryable error.
02 · 00:01
Retry cadence begins
Unchanged tool plan repeats at 120/min.
03 · 00:02
Attempt #3 detected
Prompt fingerprint crosses repeat threshold.
04 · 00:02+
Loop halted
$680+ illustrative exposure avoided.

Built by an Engineer
Built by Roan de Jager (@roandejager) in Norway.
I built Circuit Breaker after an autonomous agent got trapped in a recursive tool retry loop and burned through hundreds of dollars in API credits overnight. It's built in Python and FastAPI for sub-35ms raw performance with strict zero-payload retention.