AgentBudget
Real-time dollar budgets for AI agents
Get picks like this daily. Today's launch numbers, the top launches, AI and tech news, and a daily opportunity pick, straight to your inbox.
Want to reach these readers? Sponsor an issue.
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.187204641,300+ PyPI installs in the first 4 days, all organic. Apache 2.0.Happy to answer questions about the design.
HN · launched Feb 24, 2026 · 7 upvotes (top 62%) · 0 views
Niche: ai token and inference cost trackers · 85 launches, 7 in the last 7 days · Explore this niche →
Category and tags
- Horizontal
- Observability & eval
- Developer
- AI-native
- Commercial product
Visit website ↗ Source listing ↗
More like this: all 85 launches in ai token and inference cost trackers →
Could you build this?
Yes It is a client-side SDK wrapper around LLM client calls (like OpenAI or Anthropic) that tracks token counts, applies pricing arithmetic, and throws exceptions when limits are exceeded.
Discussion
8 comments analyzed.
Competitors mentioned: Apiosk (server-side x402 gateway for API monetization), Simplio.dev (AI gateway with multi-provider routing for cost optimization), Veronica-core (hierarchical budget tracking with parent-child relationships)
Concerns raised: Deduplication problem in dynamic pipelines with runtime call graphs, Cost non-linearity from fanout and retry compounding, Heterogeneous service costs (different models/pricing per step in RAG), Hard to track per-user-action/outcome costs vs just per-call costs, Blocking enforcement vs eventual consistency tradeoffs
Feature requests: Per-step/tool budget granularity, not just per overall run, Per-token budgeting support, Integration with provider predictive alerts (e.g., OpenAI API), x402-aware budget tracking with automatic on-chain settlement recording, Retry ratio trend tracking (429/timeouts) for cost spikes
Competitors
Other products that read as similar to this one : 638 launches clear the similarity bar, closest 8 shown.
Attention rank: #346 of 639 (itself plus its competitors, highest first, normalized so YC and Product Hunt are compared fairly).
Launched 116 days after the earliest competitor.
- Tokencap · hn · 2026-04-04 · 7 upvotes · similarity 0.53
- AgentWatch · hn · 2026-06-28 · 7 upvotes · similarity 0.53
- AI Spend Tracker · ph · 2026-10-21 · 1 upvotes · similarity 0.53
- Silvanexum · ph · 2026-11-05 · 1 upvotes · similarity 0.52
- Nano Tab · ph · 2026-10-23 · 1 upvotes · similarity 0.49
- AgentCash · hn · 2026-03-10 · 6 upvotes · similarity 0.47
- Navige · ph · 2026-10-15 · 251 upvotes · similarity 0.47
- AI agents are bad at API integrations · hn · 2026-04-09 · 6 upvotes · similarity 0.47
The niche, labels, vibe code rating and competitor comparison on this page are analysis by Nicheloom. If you use them, please credit nicheloom.com. How you may use our data.