Cost guardrails for LLM agent runs.
Project description
agentcap
agentcap is a cost guardrail for LLM agent runs. It calculates safe token limits before execution and enforces strict budget ceilings using real usage data.
Github: https://github.com/OliverIida/agentcap
PyPI: https://pypi.org/project/agentcap/
Install
pip install agentcap
Example usage
from agentcap import AgentCap
prompt = "Write 2 lines about Tallinn."
cap = AgentCap(
model="gpt-5",
budget_usd=0.05,
)
plan = cap.plan(prompt_text=prompt)
# Pass plan.max_output_tokens into your LLM call
actual_cost = cap.finalize(
prompt_tokens=response_prompt_tokens,
output_tokens=response_output_tokens,
)
print("Actual cost (USD):", actual_cost)
Documentation
https://github.com/OliverIida/agentcap/blob/main/DOCUMENTATION.md
Supported models
https://github.com/OliverIida/agentcap/blob/main/agentcap/models.json To add more models, open a PR.
Note: Prices may change. Please verify with the provider.
Model pricing sources
OpenAI pricing: https://developers.openai.com/api/docs/pricing?latest-pricing=standard
Anthropic pricing: https://platform.claude.com/docs/en/about-claude/pricing
Gemini pricing: https://ai.google.dev/gemini-api/docs/pricing#standard
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agentcap-0.1.1.tar.gz.
File metadata
- Download URL: agentcap-0.1.1.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
09d5bbeac86a5de6a16ed439a6c5e35a1d92ee590c97c31a85c8b3cfe5e5f048
|
|
| MD5 |
9fb55daaabe9e1b5b68317447ff7be7e
|
|
| BLAKE2b-256 |
ce4c242c8e3c6cee75ecdf18ee41ba2ccb9a79894103bb401f6d26d2e1dcee38
|
File details
Details for the file agentcap-0.1.1-py3-none-any.whl.
File metadata
- Download URL: agentcap-0.1.1-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c385b39bfccd00f2d7962f66d7cd9590bc2fee872715583860ab9e7f3eb0f33
|
|
| MD5 |
063ea8fa1e6aa14fb7ee80cc7c513eec
|
|
| BLAKE2b-256 |
08a40d533d8270e42f4a8ac14f2885bc590b1ca36c6d5397d42bde9f847fa48c
|