Why $/min spend caps fail against looping agents — and the sliding-window latch fuse that works

MaverikSh · reddit · 2026-11-05

The builder of Cognocient AI, an LLM cost proxy, explains why dollars-per-minute limits don't stop looping agents: each reset lets the loop run again and you pay every lap. His fix has four parts: (1) a sliding window summing 1-second spend buckets over the last 60s; (2) an optional short burst window (5–59s) to catch fast loops early; (3) a latched fuse that refuses all calls on a key for 5 minutes once tripped, with Retry-After and manual reset, refused calls unbilled; (4) per-run limits via an X-Cost-Run-ID header so only the runaway run stops when 10 agents share a key. Known limits: in-flight calls still finish and bill, and the 5-minute default latch may not suit long-running agents.

Related event: Developers share guardrails to stop runaway agent costs(2 posts)→

Original post →

More from coding & agent

coding & agent channel →