A $47K Agent Loop: Add a Hard Spend-Cap in 40 Lines
Last November, a market-research pipeline of four LangChain agents ran for 11 straight days before anyone noticed. Two of them — an Analyzer and a Verifier — got stuck asking each other to "please clarify section 3.2" with effectively the same payload, every cycle. The invoice came to $47,000. Week 1 was $127. Week 4 was $18,400. The dashboard was working the whole time. It just had nothing to say except yes, you are still spending money.
That story is about token bills. But if you put an agent behind a wallet, the currency of a runaway loop changes from API tokens to gas and trades — and the failure mode is identical. Here's a hard pre-execution brake you can drop into a crypto agent today. It's about 40 lines, runs with no API key, and moves zero funds.
TL;DR
Tracking is not control. A dashboard tells you what you already spent; it can't stop the next call.






