agent-budget
Wrap it around your LLM calls and it counts tokens and dollars. Once an agent hits its budget, new calls get refused.
const budget = new AgentBudget({ limitUSD: 0.50, warnAtPercent: 80, guardBefore: true, // block calls when already exceeded});
Costs are counted in whole microdollars with BigInt, so the total doesn't drift after thousands of calls the way floats would.
No dependencies. It's on npm.
Try it
$ npm install @leelakrishnaravuri/agent-budget