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
Metadata
Release files for agentcap 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| agentcap-0.1.1.tar.gz | 4.5 kB | Without provenance | Details for agentcap-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| agentcap-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for agentcap-0.1.1-py3-none-any.whl |
Total release size: 12.4 kB
Release files / agentcap-0.1.1.tar.gz
| Download URL | agentcap-0.1.1.tar.gz |
|---|---|
| Size | 4.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
09d5bbeac86a5de6a16ed439a6c5e35a1d92ee590c97c31a85c8b3cfe5e5f048
|
|
BLAKE2b-256 checksum How to use checksums |
ce4c242c8e3c6cee75ecdf18ee41ba2ccb9a79894103bb401f6d26d2e1dcee38
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.12
|
Release files / agentcap-0.1.1-py3-none-any.whl
| Download URL | agentcap-0.1.1-py3-none-any.whl |
|---|---|
| Size | 7.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5c385b39bfccd00f2d7962f66d7cd9590bc2fee872715583860ab9e7f3eb0f33
|
|
BLAKE2b-256 checksum How to use checksums |
08a40d533d8270e42f4a8ac14f2885bc590b1ca36c6d5397d42bde9f847fa48c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.12
|
Security for agentcap 0.1.1
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.