AgentBudget
Real-time dollar budgets for AI agents
Details
- External ID
- 47133305
- Source
- HN
- Company
- —
- Product
- AgentBudget
- Website domain
- github.com
- Launched
- Feb. 24, 2026
- Cohort
- —
- Upvotes
- 7
- Upvotes percentile
- 0.38207547169811323
- Tags
- —
- Fetched at
- Sept. 7, 2026, 9:25 p.m.
- Updated at
- Sept. 7, 2026, 9:25 p.m.
Description
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.
Enrichment
- Theme
- AI agent frameworks and developer tools
- Vertical
- Horizontal
- Function
- Observability & eval
- Audience
- Developer
- AI stance
- AI feature
- Project type
- Commercial product
- Normalized one-liner
- real-time budget management for ai agents
- Manually corrected
- False
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 — 229 launches clear the similarity bar, closest 8 shown.
Attention rank: #150 of 230 (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.52
- AgentWatch · hn · 2026-06-28 · 7 upvotes · similarity 0.52
- AgentCash · hn · 2026-03-10 · 6 upvotes · similarity 0.46
- AI agents are bad at API integrations · hn · 2026-04-09 · 6 upvotes · similarity 0.45
- AI agents run my one-person company on Gemini's free tier · hn · 2026-03-08 · 16 upvotes · similarity 0.45
- Tokenflow · ph · 2026-09-17 · 3 upvotes · similarity 0.44
- AgentRaaS · ph · 2026-09-08 · 1 upvotes · similarity 0.44
- Rebuno · ph · 2026-09-14 · 3 upvotes · similarity 0.42
Other launches for this product
- No other launches for this product.
Same idea, different domain
Nobody's really built a observability & eval tool for Media & entertainment yet.