The guardrail that almost stopped a healthy agent (and 3 other near misses building an AI kill switch)
I spent the Agentware 2026 hackathon building LoopLasso, a supervisor for AI agents that do developer work. It catches retries that make no progress, revokes the agent's authority, hands the leftover work to a narrower r
I spent the Agentware 2026 hackathon building LoopLasso, a supervisor for AI agents that do developer work. It catches retries that make no progress, revokes the agent's authority, hands the leftover work to a narrower recovery worker, and calls the job done only after it independently checks the output. The demo task is preparing a release-notes draft from Git, PR and CI data (all sandboxed).
The tagline is "Stop the spiral. Finish the job." My own guardrails nearly broke the second half of it. Here are four near misses, with the numbers that caught them.
1. My budget cap would have killed a healthy agent
The first version capped a run at 12 model calls and held 4 back for recovery, which left the worker 8.
Then I measured instead of guessing:
- healthy run: 6–7 calls
- CI that is slow but genuinely progressing (queued → running → running → done): 9 calls
So the "legitimate waiting" case, the one I had promised never to interrupt, would have hit the worker's budget ceiling and been revoked. My kill switch would have punished an agent for being patient.
Fix: raise the total to 16 with a 5-call reserve, and write the measurement into the code next to the constant. An acceptance test now asserts that slow-but-progressing polling is never interrupted.
Lesson: a guardrail number you didn't measure is just a second bug.
2. A free-tier quota made the agent look broken
My first benchmark ran 6 live Gemini runs back to back. 5 of 6 ended HALTED with MODEL_ERROR.
The agent was fine. The supervisor was fine: it revoked, attempted recovery, and halted within budget, exactly as designed. The cause was HTTP 429. The free tier for gemini-3.5-flash-lite allows 15 requests per minute, and the error even said "retry in 33s".
The dangerous part was not the failure. It was that my metrics counted these as agent failures and supervisor "interventions".
Fix:
- a client-side sliding-window limiter in the model broker (14 RPM), with every wait visible in the timeline
- honour the provider's
retryDelayonce, only if it fits inside the run's deadline - a cool-down between live benchmark runs
- the "false intervention" metric now counts only watchdog decisions, not infrastructure errors
After the fix: 6/6 live runs completed.
3. A kill switch that waits is not a kill switch
An early sketch of STOP ALL did "let the current tool finish, then stop". With a slow write in flight, that means the write lands after the user pressed STOP.
Fix: kill commits KILLED to SQLite first and aborts every pending model and tool call without waiting. The write path then re-checks kill state, epoch and session inside the same transaction as the insert.
To prove it, I added a sandbox fault: a deliberately non-cancellable 3-second write. In the recorded demo:
- STOP took effect in 7 ms
- the delayed write hit the commit guard with
KILLED, STALE_EPOCH, SESSION_REVOKED -
0 drafts were written, and the operation is recorded as
not_executed
Across benchmark runs, the kill was accepted in ≤ 1.04 ms, with 0 model or tool calls started afterwards.
4. The official Trap Pack showed what my supervisor doesn't do
The organisers released 20 hostile inputs: hidden prompt injections, fake CEOs, poisoned CI logs, broken data. I ran all 20 through the live agent, planting each one in a PR body and CI log.
The good news:
- 0 canary leaks, in every proposed tool call, executed call, the rendered notes and the DB
- 0 secret leaks
- 20/20 runs completed with exactly one verified draft
The honest news:
- LoopLasso contains planted instructions, because there is simply no network, payment, delete, merge or shell tool to abuse. It does not flag them. Several traps expect the agent to report the hidden text, and mine didn't.
- On the Developer Workflow PR trap, nobody flagged the
postinstallhook that exfiltrates env vars, because my task summarises PRs and doesn't review diffs. - My agent only sees the first 1,500 characters of a PR body, so the tail of one trap file was never in view.
- The 5 broken-data traps weren't really exercised: a release-notes task doesn't parse bank CSVs or sensor feeds.
Containment is not detection. That is the next thing to build.
The run I'm proudest of
In the main demo, a live Gemini worker meets a CI aggregator stuck at pending. It polls, the gateway rejects polls that come too early, and after the third identical result with the same state version and no progress (about 6 seconds in), the watchdog revokes its epoch. A recovery worker that has no aggregator tool at all fetches HMAC-signed CI attestations directly, saves exactly one draft, and the verifier passes it. Nobody touched the keyboard. That's 10 model calls and ~26k input tokens, about $0.01 at paid list prices.
- Code (MIT): https://github.com/dorakingx/looplasso
- Demo (2:26): https://youtu.be/uJBizv6F5yY
- Trap Pack results: https://github.com/dorakingx/looplasso/blob/main/tests/trap-pack/RESULTS.md
Built for Agentware 2026 by Hackathon Raptors (raptors.dev). The Trap Pack is "Agentware 2026 Trap Pack, Hackathon Raptors" (CC BY 4.0).
Written by an AI coding agent from the project's own traces and benchmark files, at the builder's request.
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.