Skip to content

Add usage and cost attribution - #18

Merged
imran-siddique merged 1 commit into
mainfrom
agent/usage-cost-attribution
Aug 19, 2026
Merged

imran-siddique merged 1 commit into
mainfrom
agent/usage-cost-attribution

Conversation

@imran-siddique

Copy link
Copy Markdown
Member

What changed

  • add a validated usage_record() constructor and explicit CostObservation
  • add idempotent model-call accumulation with per-agent and per-workflow rollups
  • label token and cost coverage, preserve cost provenance, and reject mixed currencies
  • add schema constraints, negative conformance fixtures, documentation, and package exports

Why

AGT and other runtimes expose token counts, estimates, provider costs, and pre-aggregated counters in different forms. Adopters need a backend-neutral boundary that can emit per-agent and per-workflow usage without fabricating unknown cost or silently double counting rollups.

Impact

Callers can report leaf usage facts and build conservative run-level totals. Unknown pricing remains absent rather than zero; partial observations remain visible through coverage counts.

Validation

  • python tools/check_versions.py
  • python tools/check_schemas.py
  • python -m unittest discover -s tests -v (85 tests, 20 subtests)
  • python conformance/runner/validate.py
  • python -m compileall -q src
  • python -m pytest -q (84 tests at the preceding proof point; final unittest suite contains the added safety case)
  • python -m build
  • isolated wheel install and import smoke test

@imran-siddique
imran-siddique merged commit a37a0b4 into main Aug 19, 2026
7 checks passed
@imran-siddique
imran-siddique deleted the agent/usage-cost-attribution branch August 19, 2026 03:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant