Skip to main content

pramiti-agent-finops

Standalone AI agent warehouse cost attribution and cap enforcement. Zero dependencies -- inject any storage backend via the ICostBackend protocol.

Install

pip install pramiti-agent-finops

Quick Start

from pramiti_agent_finops import CapChecker, CapExceededError
from pramiti_agent_finops.backends import InMemoryBackend

backend = InMemoryBackend()
backend.set_cap("ws-1", "agent-1", max_usd=5.0, action="block")
backend.add_cost("ws-1", "agent-1", 6.0)

checker = CapChecker(backend)
try:
    checker.check("ws-1", "agent-1")
except CapExceededError as e:
    print(f"Blocked: {e}")
    # Blocked: Agent 'agent-1' daily warehouse cost cap exceeded: $6.0000 >= $5.0000 limit

Use action="warn" instead of "block" to issue a CapWarning (Python warning) rather than raising an exception.

Enforcement Semantics

check() is a pre-flight check against recorded spend, not a transactional reservation:

  • The decision is based on costs/counts already recorded in the backend at check time. An in-flight call is not metered until its cost is recorded, so a single call may exceed the cap by its own cost.
  • Concurrent calls that both pass check() before either is recorded can each proceed (check-then-act race). If you need hard atomic enforcement, implement it in your backend (e.g. a conditional UPDATE / reservation) -- this package does not provide it.
  • Enforcement granularity is one call: the cap blocks the next call after recorded spend reaches the limit.

The same semantics apply to ActionBudgetChecker (tool-call count budgets).

API

Export Description
CapChecker Core enforcement engine. Inject any ICostBackend. Call check() to enforce and get_today_cost() to query.
ICostBackend Protocol for storage backends. Requires get_cap() and get_today_cost().
InMemoryBackend In-memory backend for testing and development. Provides set_cap(), add_cost(), reset_cost().
CapExceededError Raised when an agent exceeds its daily cost cap (action="block").
CapWarning Python UserWarning issued when cap exceeded with action="warn".

Custom Backend

Implement ICostBackend (structural subtyping via Protocol -- no inheritance required) to use your own storage:

from pramiti_agent_finops.backends import ICostBackend

class MyBackend:
    def get_cap(self, workspace_id: str, agent_id: str) -> dict | None:
        """Return {"max_usd_per_day": float, "action_on_breach": "block"|"warn"} or None."""
        ...

    def get_today_cost(self, workspace_id: str, agent_id: str) -> float:
        """Return total warehouse cost in USD for agent today (midnight UTC to now)."""
        ...

License

MIT -- Pramiti Labs

Metadata

Release files for pramiti-agent-finops 0.2.1

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

Source distribution (sdist)

Source distribution for pramiti-agent-finops 0.2.1
File Size Uploaded Provenance Actions
pramiti_agent_finops-0.2.1.tar.gz 10.8 kB With provenance Details for pramiti_agent_finops-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pramiti-agent-finops 0.2.1
File Interpreter ABI Platform Actions
pramiti_agent_finops-0.2.1-py3-none-any.whl Python 3 none any Details for pramiti_agent_finops-0.2.1-py3-none-any.whl

Total release size: 20.8 kB

Release files / pramiti_agent_finops-0.2.1.tar.gz

Download URL pramiti_agent_finops-0.2.1.tar.gz
Size 10.8 kB
Tags Source
SHA-256 checksum
How to use checksums
3c306fe839e785825345d84170d9004d0098bce277ee12df829a19cd13e51b0f
BLAKE2b-256 checksum
How to use checksums
93e74e8f1670dfaea6d8f46836a708ff90d7b220cf4e7d5aa961701a1706279d
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 Oct 6, 2026.

Transparency log

Release files / pramiti_agent_finops-0.2.1-py3-none-any.whl

Download URL pramiti_agent_finops-0.2.1-py3-none-any.whl
Size 10.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7d3bd49be6f3342230bd069a552c17bc63c1acb0c36fc7f69db57238ed8ec12a
BLAKE2b-256 checksum
How to use checksums
61d7217d5b06f322460f86b1e0ad5316d61dab25bbe47a8bfb939be487325ab2
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 Oct 6, 2026.

Transparency log

Security for pramiti-agent-finops 0.2.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.

Full provenance

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

Select from 2 files

Attestation for pramiti_agent_finops-0.2.1.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 Oct 6, 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.2.1 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