Open-sourced a pre-call spend gate for agents — stops the runaway loop before the first bad call, not after the bill

Reddit r/AI_Agents Tools

Summary

Open-sourced a pre-call spend gate and tamper-evident audit log to prevent runaway API costs from recursive loops in autonomous agents, MIT-licensed with Postgres+TypeScript demo.

My co-founder's been shipping autonomous agents, and the scariest failure mode we've run into isn't a wrong answer — it's a recursive loop or a tool-parse error quietly burning API budget overnight. Most "fixes" I see out there are reactive: count repeated calls, or check the bill after the fact. By then the money's gone. So we built a small MIT-licensed reference for two things that pair together: a pre-call spend gate (authorize the spend before the LLM/tool call fires) and a hash-chained, tamper-evident audit log so every approve/deny decision is provably recorded. The demo simulates a rogue agent hitting a daily limit — loops 1–3 approved, loop 4 denied, execution halted, chain verified. Postgres + TypeScript, but both patterns are language/DB-agnostic. Curious how others here are handling agent spend limits — reactive monitoring, or something upstream?
Original Article

Similar Articles