Skip to main content

Agent cost control, energy budget management, and token tracking

Project description

agent-energy-budget

Agent cost control, energy budget management, and token tracking

CI PyPI version Python versions License

Part of the AumOS open-source agent infrastructure portfolio.


Features

  • BudgetTracker performs pre-call affordability checks and records actual spend to a per-agent JSONL log, supporting daily, weekly, and monthly limits simultaneously
  • Four degradation strategies when budgets are tight: TOKEN_REDUCTION (cap output tokens to fit remaining budget), MODEL_DOWNGRADE (switch to the cheapest affordable model), CACHED_FALLBACK (signal to use cached responses), and BLOCK_WITH_ERROR (raise BudgetExceededError)
  • Model pricing tables for OpenAI, Anthropic, Google, and custom models with a CostEstimator that projects spend before the call is made
  • Hierarchical sub-budget allocation — a parent BudgetTracker can allocate fractional child budgets for sub-agents in a multi-agent team
  • Threshold-based alert system fires warning, critical, and exhausted callbacks at configurable utilization percentages
  • Middleware wrappers for LangChain, CrewAI, AutoGen, Anthropic SDK, and OpenAI SDK that intercept calls and apply budget checks transparently
  • Spend reporting with per-model breakdowns, top-N cost attribution, and ASCII/matplotlib visualizations

Quick Start

Install from PyPI:

pip install agent-energy-budget

Verify the installation:

agent-energy-budget version

Basic usage:

import agent_energy_budget

# See examples/01_quickstart.py for a working example

Documentation

Enterprise Upgrade

For production deployments requiring SLA-backed support and advanced integrations, contact the maintainers or see the commercial extensions documentation.

Contributing

Contributions are welcome. Please read CONTRIBUTING.md before opening a pull request.

License

Apache 2.0 — see LICENSE for full terms.


Part of AumOS — open-source agent infrastructure.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agent_energy_budget-0.2.0.tar.gz (170.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agent_energy_budget-0.2.0-py3-none-any.whl (140.1 kB view details)

Uploaded Python 3

File details

Details for the file agent_energy_budget-0.2.0.tar.gz.

File metadata

  • Download URL: agent_energy_budget-0.2.0.tar.gz
  • Upload date:
  • Size: 170.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for agent_energy_budget-0.2.0.tar.gz
Algorithm Hash digest
SHA256 4c8808e3b0fed84727a019c0037bde0202fd85c08903256dede530a07f8b9588
MD5 e6d6f03af95e499bf7d95127fcb2c3c5
BLAKE2b-256 694133582ea554f8eb8c7a9004b99ff8b3b3a084068d064a7b3f773b982a87b9

See more details on using hashes here.

File details

Details for the file agent_energy_budget-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for agent_energy_budget-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4d8b7406968fab524f7689d5367c511a69bdc49d3a952b013d9dffc1cf96cf58
MD5 634bd0118df2343da7b395920b7e553b
BLAKE2b-256 d72bbef0373baec7ad8f17c466e9ad73c1b582201cd62926a8d550248fdcb910

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page