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.1.0.tar.gz (115.9 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.1.0-py3-none-any.whl (103.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: agent_energy_budget-0.1.0.tar.gz
  • Upload date:
  • Size: 115.9 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.1.0.tar.gz
Algorithm Hash digest
SHA256 d6f5dee117d0dfdbf6e91f800fbcdba34100bc15c9c7951e24f0e694b8f4a589
MD5 117917e2c53aa943175246a9e7ea0e2b
BLAKE2b-256 e31f6519ac1feb18e8214ec202d426c95b4a47ab6293fb5fba3d6a555fd5b7c4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for agent_energy_budget-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0484b2a8c99a9b52d0140bcab1dd96f3b2475dcb5a2f7d7636efc98184306110
MD5 7646d89cde20e47af702f45a0470d1b0
BLAKE2b-256 cccd3fc4566b7b1deb3b0cc8f8c51b58a531a734239c83ae1c63b37b6d296980

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