Circuit breakers
Set limits on how one agent may behave in a stretch of time: denied requests, flagged requests or new requests. Once a key reaches one, the breaker contains it in your name, or in watch mode only records the trip.
Containment takes an agent out of play, but someone has to notice first. An agent steered by a prompt injection, or stuck in a loop, can do a lot in the half hour before anyone looks. A circuit breaker watches for the signs on its own. You set limits for one agent key in a stretch of time; once the key reaches one, the breaker contains it in your name, exactly as if you had pressed Contain.
The breaker counts over one hour. Changing a limit starts again.
Counted since the last reset: Denied requests 0 of 2 · Flagged requests 0 of 3 · New requests 0
- Nothing asked yet. Press Agent asks, then deny what looks wrong.
What it counts
Each limit is optional, but a breaker needs at least one. Counts are per agent key, over the window you choose (5 minutes to a day):
- denials
- Requests of the key denied in the window: by a person wherever they decide, by a deny rule, or because a person stopped their run. 1 to 100000.
- flagged
- Requests of the key made in the window that were unusual for it, caught by the trifecta guard, or off their run's plan. 1 to 100000.
- requests
- Requests of the key made in the window, of any kind, for a runaway loop. 2 to 100000.
The flagged signal reads what Unusual, the trifecta guard and run plans already found, so turn those on for it to count anything.
When it checks, and what a trip does
The breaker checks one key right after each request the key sends, and after people act on its requests: a denial from the inbox, Slack, email or Telegram, a stopped run or a cancelled approval. When a count reaches its limit, it trips:
- In contain mode the key is contained: paused, what waits is denied, approvals inside their cancel window are cancelled, its runs are stopped, and every approval it was given before is void for good. The request that tripped it is denied if it was waiting, and the agent is told so in the same answer.
- In watch mode nothing is contained. The trip is listed and logged as
circuit_breaker.tripped, so you can see how often your limits would have fired before you let them act. - Either way, if the workspace has a chat webhook, it gets a message naming the key and what reached the limit.
A containment made by the breaker is recorded in the name of the owner who set the breaker last, as “Circuit breaker set by …”, with a reason like this one:
Circuit breaker: 5 denied requests in 1 hour (limit 5)Counting starts again after each trip, each containment and each release, so one run of trouble trips once, and a released agent starts with a clean slate.
Setting it
Owners set and remove the breaker; every member can see it and its trips. It works on every plan, Free included. Start in watch mode ("contain": false) for a few days, then switch it on.
curl -X PUT https://api.variantgate.com/v1/workspaces/$WORKSPACE_ID/circuit-breaker \
-H "Authorization: Bearer YOUR_SESSION_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"window_minutes": 60,
"denials": 5,
"flagged": 3,
"requests": 200,
"contain": false
}'{
"window_minutes": 60,
"denials": 5,
"flagged": 3,
"requests": 200,
"contain": false,
"tripped": 0,
"last_tripped_at": null,
"set_by": "maya@northwind.example",
"updated_at": "2026-11-30T09:12:44Z"
}- 200
- The breaker is set. Setting it again replaces it.
- 403
- You are a member, not an owner.
- 422
- No limit at all, a window outside 5 to 1440 minutes, or a limit out of range.
Read it, or turn it off:
curl https://api.variantgate.com/v1/workspaces/$WORKSPACE_ID/circuit-breaker \
-H "Authorization: Bearer YOUR_SESSION_TOKEN"curl -X DELETE https://api.variantgate.com/v1/workspaces/$WORKSPACE_ID/circuit-breaker \
-H "Authorization: Bearer YOUR_SESSION_TOKEN"Its trips
Every trip, the latest first, with the containment it made, whose report shows what the agent was approved to do in the day before:
curl "https://api.variantgate.com/v1/workspaces/$WORKSPACE_ID/circuit-breaker/trips?limit=20" \
-H "Authorization: Bearer YOUR_SESSION_TOKEN"{
"trips": [
{
"id": "0193f1c2-7a00-7000-8000-0000000000d1",
"agent_key_id": "0193f1c2-7a00-7000-8000-0000000000aa",
"key_name": "support-bot",
"signal": "denials",
"count": 5,
"limit": 5,
"window_minutes": 60,
"contained": true,
"containment_id": "0193f1c2-7a00-7000-8000-0000000000c1",
"tripped_at": "2026-11-30T10:03:51Z"
}
]
}Releasing
A contained agent stays contained until an owner releases it by resuming its key, as with any containment. Approvals from before stay void. Check the exposure report and the allow rules written for the key before you release it.
What it never does
- It never approves a request, and never sets allowed to true.
- It never releases an agent; only an owner can.
- It counts one key at a time, never adding up different agents.
- An agent key can never read or change it.
During a deploy
While two versions of the API run side by side during a deploy, one from before circuit breakers ignores them, so a request or a denial handled there does not trip anything. That is never less cautious than before. The next request through a newer instance counts everything stored so far. Set a breaker once every instance runs this version.