Skip to content

Releases

v0.4.0

Choose a tag to compare

@sahiljagtap08 sahiljagtap08 released this 30 May 17:42

Consolidated release bundling today's community fixes.

Added

  • LangChain / LangGraph coverage — usage is now tracked from modern chat-model usage_metadata and Anthropic response_metadata (not just legacy token_usage), so chat models and LangGraph runs are counted instead of silently recording $0.00. Adds tool-cost tracking, a context-manager lifecycle that fires on_hard_limit, and callback forwarding. Thanks @veeradyani222! (#26)
  • InvalidCost exception, exported from the package.
  • Contributor docs — issue/PR templates and CONTRIBUTING.md. Thanks @sundaram2021! (#25)

Changed

  • Drop-in API isolation — init()/teardown() session state is now scoped per thread and per async task via contextvars; concurrent requests no longer overwrite each other's sessions. Thanks @sundaram2021! (#20)

Fixed

  • Streaming cost on early exit — recorded when the caller breaks early or an async stream ends incompletely; OpenAI auto-injects include_usage. Thanks @Kunal1522! (#15)
  • Invalid cost values — negative/NaN/infinite costs are rejected before corrupting the ledger. Thanks @drewster99! (#21)

CI now also validates Go, TypeScript, and the website, and gates publishing on the full matrix (#24).

Full changelog: https://github.com/AgentBudget/agentbudget/blob/main/CHANGELOG.md

v0.3.0 — Streaming cost tracking, per-client API, and finalization reserve

Choose a tag to compare

@sahiljagtap08 sahiljagtap08 released this 29 Mar 03:28

What's new in v0.3.0

Features

  • Streaming cost tracking — stream=True calls are now fully tracked for OpenAI (sync + async) and Anthropic (sync + async).
    Chunks pass through unchanged; cost is recorded after the stream is exhausted. Thanks @KTS-o7!

    Note: OpenAI requires stream_options={"include_usage": True} — without it cost is silently $0.

  • agentbudget.wrap_client(client, session) — explicit per-client tracking as an alternative to global patching. Only the
    wrapped instance is tracked.
  • finalization_reserve param on AgentBudget — reserves a fraction of budget for the final response step, preventing
    agents from being cut off mid-task.
  • session.would_exceed(cost) — pre-flight budget check without recording anything.

Bug fixes

  • OpenRouter support — model names like "openai/gpt-4o" now resolve correctly. Previously these silently tracked as $0.00.
  • Thread safety in CircuitBreaker soft limit check (merged from @MistakenPirate)
  • Off-by-one in loop detection threshold (merged from @MistakenPirate)
  • Exception matching uses issubclass() instead of string comparison (merged from @MistakenPirate)
  • Negative price validation in register_model() (merged from @MistakenPirate)

CI

  • Tests now run on every push/PR across Python 3.9–3.13

Full changelog: v0.2.3...v0.3.0

v0.2.3 — Custom model pricing & fuzzy matching

Choose a tag to compare

@sahiljagtap08 sahiljagtap08 released this 17 Feb 08:58

What's New

Custom Model Pricing — Don't Wait for a Release

New model just launched? Register pricing at runtime:

import agentbudget

agentbudget.register_model(
    "gpt-5",
    input_price_per_million=5.00,
    output_price_per_million=20.00,
)

# Or batch register:
agentbudget.register_models({
    "gpt-5": (5.00, 20.00),
    "gpt-5-mini": (0.50, 2.00),
})

Custom pricing takes priority over built-in pricing, so you can also override existing models.

Fuzzy Matching for Dated Model Variants

Dated model names like gpt-4o-2025-06-15 now automatically match their base model (gpt-4o) pricing. No more None costs for new model
versions.

Resolution order: Custom pricing → Built-in table → Fuzzy match.

Updated Docs & README

  • New "Custom Model Pricing" section in docs
  • register_model and register_models added to API reference
  • Updated supported models table (40+ models)

Install / Upgrade

  pip install --upgrade agentbudget

Full Changelog: v0.2.2...v0.2.3

v0.2.2 - bug fixes & url fix

Choose a tag to compare

@sahiljagtap08 sahiljagtap08 released this 17 Feb 08:40

What's New

Drop-in Auto-Instrumentation

Two lines to enforce a budget on any AI agent session — zero code changes needed:

import agentbudget
agentbudget.init("$5.00")

Your existing OpenAI/Anthropic code works unchanged

Updated Model Pricing (Feb 2026)

Added pricing for 15+ new models:

  • OpenAI: GPT-4.1, GPT-4.1-mini, GPT-4.1-nano, o3, o3-pro, o4-mini
  • Anthropic: Claude Opus 4.6, Opus 4.5, Sonnet 4.5, Sonnet 4, Haiku 4.5
  • Google: Gemini 2.5 Pro, Gemini 2.5 Flash, Gemini 2.5 Flash Lite
  • Mistral: Updated pricing for mistral-large and mistral-small

CI/CD

  • Automated PyPI publishing via GitHub Actions with trusted publishing
  • Test matrix across Python 3.9, 3.10, 3.12, 3.13

Project

  • New domain: agentbudget.dev
  • Added project URLs to PyPI metadata (docs, repo, changelog)

Install / Upgrade

pip install --upgrade agentbudget

Full Changelog: v0.1.0...v0.2.1

v0.2.1 - new domain url updated

Choose a tag to compare

@sahiljagtap08 sahiljagtap08 released this 17 Feb 08:29

What's New

Drop-in Auto-Instrumentation

Two lines to enforce a budget on any AI agent session — zero code changes needed:

import agentbudget
agentbudget.init("$5.00")

Your existing OpenAI/Anthropic code works unchanged

Updated Model Pricing (Feb 2026)

Added pricing for 15+ new models:

  • OpenAI: GPT-4.1, GPT-4.1-mini, GPT-4.1-nano, o3, o3-pro, o4-mini
  • Anthropic: Claude Opus 4.6, Opus 4.5, Sonnet 4.5, Sonnet 4, Haiku 4.5
  • Google: Gemini 2.5 Pro, Gemini 2.5 Flash, Gemini 2.5 Flash Lite
  • Mistral: Updated pricing for mistral-large and mistral-small

CI/CD

  • Automated PyPI publishing via GitHub Actions with trusted publishing
  • Test matrix across Python 3.9, 3.10, 3.12, 3.13

Project

  • New domain: agentbudget.dev
  • Added project URLs to PyPI metadata (docs, repo, changelog)

Install / Upgrade

pip install --upgrade agentbudget

Full Changelog: v0.1.0...v0.2.1

v0.2.0 - Drop-in Mode, Updated Pricing & Website

Choose a tag to compare

@sahiljagtap08 sahiljagtap08 released this 17 Feb 07:41

What's New

Drop-in Auto-Instrumentation

Two lines to track every OpenAI and Anthropic call automatically — zero changes to your existing code:

import agentbudget
agentbudget.init("$5.00")

Updated Model Pricing (February 2026)

Added 20+ new models including GPT-4.1, GPT-4.1-mini, GPT-4.1-nano, o3, o4-mini, Claude Opus 4.6, Claude Sonnet 4.5, Claude Haiku 4.5,
Gemini 2.5 Pro/Flash. Updated Mistral pricing.

Website & Docs

  • Live at agentbudget.org
  • Full documentation at agentbudget.org/docs

Other Improvements

  • Async session support (budget.async_session())
  • Nested budgets with automatic cost rollup
  • Webhook support for budget events
  • LangChain and CrewAI integrations
  • Loop detection and circuit breaker
  • Event callbacks (on_soft_limit, on_hard_limit, on_loop_detected)

Install / Upgrade

pip install --upgrade agentbudget

Full Changelog: v0.1.0...v0.2.0

v0.1.0 - Initial Release

Choose a tag to compare

@sahiljagtap08 sahiljagtap08 released this 15 Feb 18:19

AgentBudget v0.1.0

Real-time cost enforcement for AI agent sessions.

Features

  • Per-session dollar-denominated budget enforcement
  • Auto-costing for OpenAI, Anthropic, Google Gemini, Mistral, and Cohere models
  • Manual cost tracking for tool calls and external APIs
  • Circuit breaker with hard limit, soft limit warnings, and loop detection
  • Async support
  • Nested budgets (parent/child sessions)
  • Webhook event streaming
  • LangChain callback and CrewAI middleware integrations
  • JSON cost reports

Install

pip install agentbudget

Quick Start

from agentbudget import AgentBudget

budget = AgentBudget(max_spend="$5.00")
with budget.session() as session:
response = session.wrap(openai_call(...))
session.track(tool_result, cost=0.01)
print(session.report())