frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Show HN: AgentBudget – Real-time dollar budgets for AI agents

https://github.com/sahiljagtap08/agentbudget
4•sahiljagtapyc•1h ago
Hey HN,

I built AgentBudget after an AI agent loop cost me $187 in 10 minutes — GPT-4o retrying a failed analysis over and over. Existing tools (LangSmith, Langfuse) track costs after execution but don't prevent overspend.

AgentBudget is a Python SDK that gives each agent session a hard dollar budget with real-time enforcement. Integration is two lines:

    import agentbudget
    agentbudget.init("$5.00")
It monkey-patches the OpenAI and Anthropic SDKs (same pattern as Sentry/Datadog), so existing code works without changes. When the budget is hit, it raises BudgetExhausted before the next API call goes out.

How it works:

- Two-phase enforcement: estimates cost pre-call (input tokens + average completion), reconciles post-call with actual usage. Worst-case overshoot is bounded to one call. - Loop detection: sliding window over (tool_name, argument_hash, timestamp) tuples. Catches infinite retries even if budget remains. - Cost engine: pricing table for 50+ models across OpenAI, Anthropic, Google, Mistral, Cohere. Fuzzy matching for dated model variants. - Unified ledger: tracks both LLM calls and external tool costs (via track() or @track_tool decorator) in a single session.

Benchmarks: 3.5μs median overhead per enforcement check. Zero budget overshoot across all tested scenarios. Loop detection: 0 false positives on diverse workloads, catches pathological loops at exactly N+1 calls.

No infrastructure needed — it's a library, not a platform. No Redis, no cloud services, no accounts.

I also wrote a whitepaper covering the architecture and integration with Coinbase's x402 payment protocol (where agents make autonomous stablecoin payments): https://doi.org/10.5281/zenodo.18720464

1,300+ PyPI installs in the first 4 days, all organic. Apache 2.0.

Happy to answer questions about the design.

Comments

dayumsam•1h ago
I found this from your twitter post, crazy that i found your post here hahaha, i am trying to implement it for my side project to keep the agents from taking over my side project budget.

Looks really promising so far!

sahiljagtapyc•1h ago
Thanks! That's awesome - love that the Twitter thread connected here. Let me know how the integration goes, happy to help if you hit any issues. What are your agents running on?

Help me with positioning/marketing of my AI agent

https://getharmony.ai/
1•Vishal19111999•2m ago•1 comments

Dimon's 'cockroaches' to the BlueOwl freeze: Stress spreading in private credit

https://www.cnbc.com/2026/02/24/private-credit-3-trillion-boom-bankruptcies-fraud-blue-owl-redemp...
1•zerosizedweasle•5m ago•0 comments

Meta executive warned Facebook Messenger encryption plan was 'so irresponsible'

https://www.reuters.com/legal/government/meta-executive-warned-facebook-messenger-encryption-plan...
1•c420•5m ago•0 comments

The reason to avoid the damp in the morning

https://dreamhomestore.co.uk/collections/chest-of-drawers
1•Emmasahota97•8m ago•2 comments

The Anthropic Hive Mind

https://steve-yegge.medium.com/the-anthropic-hive-mind-d01f768f3d7b
1•sideway•8m ago•0 comments

OpenAI resets spending expectations. Compute target is around $600B by 2030

https://www.cnbc.com/2026/02/20/openai-resets-spend-expectations-targets-around-600-billion-by-20...
2•dnw•11m ago•0 comments

Ask HN: What should be done to prevent world control by pedo-rings of satanists

1•julienreszka•13m ago•0 comments

Under water, in denial: is Europe drowning out the climate crisis?

https://www.theguardian.com/news/ng-interactive/2026/feb/21/under-water-in-denial-is-europe-drown...
1•xbmcuser•19m ago•0 comments

Speeding up HTML generation by 2000%

https://bobrubbens.nl/post/speeding-up-html-generation-2000/
1•todsacerdoti•21m ago•0 comments

Show HN: Notion-CLI – Full Notion API from the terminal, 39 commands, one binary

https://github.com/4ier/notion-cli
1•4ier•26m ago•0 comments

Apple Plans to Manufacture Mac Mini in Houston

https://www.wsj.com/tech/apple-plans-to-manufacture-mac-mini-in-houston-c9b4c23c
1•7777777phil•26m ago•0 comments

Rows will be joining Superhuman

https://rows.com/blog/post/rows-is-joining-superhuman
1•soheilpro•26m ago•0 comments

Show HN: A Claude Code hook that sends you to bed

https://github.com/ElleNajt/agent-bedtime
1•ellenajt•28m ago•0 comments

Ask HN: How do you prove a privileged infra change ran as approved?

1•ahmedmostafa16•29m ago•0 comments

Claude Code to Figma: The Complete Guide to AI Driven Product Design Workflows

https://manojgopanapalli.substack.com/p/claude-code-to-figma-the-complete
2•thecontentboy•29m ago•1 comments

Tracking NixOS option values and dependencies

https://oddlama.org/blog/tracking-options-in-nixos/
1•birdculture•30m ago•0 comments

Show HN: Suplex – All-in-one cold email (leads, sending, CRM)

https://www.trysuplex.com
1•machomillions•32m ago•0 comments

Tim Paterson

https://en.wikipedia.org/wiki/Tim_Paterson
1•keepamovin•32m ago•0 comments

Improving Deep Agents with Harness Engineering

https://twitter.com/Vtrivedy10/status/2023805578561060992
1•gmays•33m ago•0 comments

Computer-Using World Model

https://arxiv.org/abs/2602.17365
1•steamboatwillie•34m ago•0 comments

Situated Software

https://gwern.net/doc/technology/2004-03-30-shirky-situatedsoftware.html
1•ustad•36m ago•0 comments

Show HN: Pragmatica Aether – a distributed Java runtime that replaces Kubernetes

https://github.com/pragmaticalabs/pragmatica
1•siy•37m ago•0 comments

The Future of Agentic Computing

https://www.cjroth.com/blog/2026-02-23-the-future-of-agentic-computing
1•thoughtfulchris•38m ago•0 comments

Wealthy spouses are hiding crypto assets in divorce cases, say lawyers

https://www.ft.com/content/df01cdb5-aac8-4d41-bbd8-56a198694394
3•mmarian•42m ago•0 comments

Show HN: Scheme-langserver – Digest incomplete code with static analysis

https://github.com/ufo5260987423/scheme-langserver
1•ufo5260987423•43m ago•0 comments

Work experience kids messed with manager's PC to send him to Ctrl-Alt-Del hell

https://www.theregister.com/2026/02/23/who_me/
1•vismit2000•50m ago•0 comments

NASA's Perseverance Now Autonomously Pinpoints Its Location on Mars

https://www.nasa.gov/missions/mars-2020-perseverance/perseverance-rover/nasas-perseverance-now-au...
1•pieterr•52m ago•0 comments

Everyone in AI is building the wrong thing for the same reason

https://www.joanwestenberg.com/everyone-in-ai-is-building-the-wrong-thing-for-the-same-reason/
4•pmg101•55m ago•1 comments

DJI Romo's MQTT broker had no ACLs – one token, 7k home cameras

https://www.theverge.com/tech/879088/dji-romo-hack-vulnerability-remote-control-camera-access-mqtt
1•bakibab•58m ago•0 comments

Anthropic: AI helps break the cost barrier to COBOL modernization

https://claude.com/blog/how-ai-helps-break-cost-barrier-cobol-modernization
2•aquir•1h ago•3 comments