Skip to main content

agentbelt-budget

A lightweight, in-process circuit breaker for LLM token and cost spend. Part of the agentbelt suite.

pip install agentbelt-budget

Quickstart

from agentbelt_budget import Budget, CircuitBreaker, BudgetExceeded

breaker = CircuitBreaker(Budget(max_tokens=100_000, max_cost_usd=5.0, window="24h"))

try:
    breaker.check("session-123")
    response = call_llm(prompt)
    breaker.record_response("session-123", response, model="gpt-4o")
except BudgetExceeded as e:
    print(f"blocked: {e}")

What did this actually catch?

print(breaker.impact_report())
# 5 call(s) blocked across 1 session(s) before exceeding budget (1 distinct trip event(s))

Countable events (calls blocked, distinct sessions, trip count) — not a dollar estimate, since there's no way to know what a blocked call would have actually cost. .metrics on the returned ImpactReport gives the same numbers as a plain dict if you want to log or export them.

See the suite README for the full concept and how this fits with agentbelt-loop and agentbelt-sampler.

License

MIT

Metadata

Release files for agentbelt-budget 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agentbelt-budget 0.1.0
File Size Uploaded Provenance
agentbelt_budget-0.1.0.tar.gz 10.5 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for agentbelt-budget 0.1.0
File Interpreter ABI Platform
agentbelt_budget-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 20.7 kB

Release files / agentbelt_budget-0.1.0.tar.gz

Download URL agentbelt_budget-0.1.0.tar.gz
Size 10.5 kB
Tags Source
SHA-256 checksum
How to use checksums
cc2cbeffc9964f5fa03b35195914dd47b1376394ced8b80ea2b341c449e9dad2
BLAKE2b-256 checksum
How to use checksums
be7a404a7aa2af9dbdc5f783891449731dfac050fb04cd9750d0307d9bcddb50
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 8, 2026.

Transparency log

Release files / agentbelt_budget-0.1.0-py3-none-any.whl

Download URL agentbelt_budget-0.1.0-py3-none-any.whl
Size 10.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
901c26e89a10579be775cbbc0f63be717fd0e64d8129686ce60de749bc096b8c
BLAKE2b-256 checksum
How to use checksums
532fd679c4385d8fe4f5ab7804a3eb5d8d9922b43dd8838df3a5283ea28e1d00
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 8, 2026.

Transparency log

Security for agentbelt-budget 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for agentbelt_budget-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 8, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page