Skip to main content

AgenticMeter

Find the bugs that waste money in your agent runs.

AgenticMeter is a linter for AI agent runs. Wrap your agent, run it, and get told what went wrong and what it cost: tool loops, duplicate LLM calls, context bloat, failures your agent quietly swallowed. You don't have to dig through a trace to find them.

It runs locally. Traces stay in a SQLite file on your machine, there is no account or cloud service, and the core has zero dependencies.

Try it in 10 seconds

pip install agenticmeter-cli
agenticmeter demo

demo runs a simulated travel agent (no API keys, no network) with the bugs real agents ship with:

▸ travel_agent — 11 steps · 28.2k tok · $0.0739 · 0.7s

⚠ One step = 69% of this run's cost
    'openai.chat' cost $0.0510 of $0.0739 total.
    → optimize or cache that single call before anything else.

⚠ Tool failed 1x but the run succeeded anyway
    fetch_hotel_prices errored mid-run; the agent recovered, so nothing surfaced.
    → check whether the recovery path is actually correct, not just quiet.

⚠ Context grew 1,200 → 18,000 tokens
    prompt size grew 15.0x across 5 calls (~$0.0420 of re-sent history on that call)
    → trim or summarize history between steps to stop the quadratic creep.

⚠ Same tool called 4x with identical args
    'search_flights' ran 4 times with the same input — likely a loop or a missing cache.
    → add a cache, or fix the condition that re-calls it.
...

Every warning links to the exact spans that prove it. Nothing is guessed.

Lint your own agent

import agenticmeter as am

am.configure(sink="sqlite")   # persist runs to ~/.agenticmeter/traces.db

@am.tool
def search(query): ...

@am.meter
def agent(task):
    ...

agent("plan my launch week")  # warnings print to stderr when the run ends

OpenAI, Anthropic and LangChain calls are captured automatically when those libraries are installed, with tokens and cost per call. For anything else, mark steps by hand:

with am.span("retrieve", am.SpanType.RETRIEVAL):
    ...

Clean runs stay silent. Pass summary=True to always print, or summary=False to never print.

What it catches

Check Fires when
Silent tool failure a tool errored but the run reported success
Cost concentration one step is ≥ 60% of the run's cost (across ≥ 3 priced steps)
Duplicate LLM calls the identical prompt was paid for ≥ 2 times
Context bloat the prompt grew ≥ 3x and by ≥ 2k tokens over the run
Tool loop the same tool was called ≥ 3 times with identical arguments
Time bottleneck ≥ 70% of step time went to retrieval, tools or custom code

Thresholds live in agenticmeter.analysis.insights.Config. Very short runs (fewer than two steps, or under 50ms of work) don't trigger the time check.

Look back at runs

agenticmeter runs            # recent runs: steps, tokens, cost
agenticmeter show            # latest run: trace tree + warnings
agenticmeter show <id>       # a specific run (id prefix is fine)
agenticmeter ui              # local web viewer at http://127.0.0.1:4319
agenticmeter demo --save     # keep the demo run so you can explore it in `show` / `ui`

In the viewer, clicking a warning highlights the steps that caused it.

Design rules

  • Zero-dependency core. Integrations are optional extras: pip install "agenticmeter-cli[openai,anthropic,langchain]".
  • Local-first. No telemetry, no network calls. Your traces never leave your machine.
  • Fail open. If AgenticMeter hits an internal error, it drops the span and logs once. It never crashes or slows your agent.
  • Secrets scrubbed by default. Inputs and outputs are redacted before they are stored (redact="scrub"; also "truncate", "off" or your own function).
  • Prices are configurable. Override or add models with am.cost.set_prices({...}).

Install notes

The PyPI package is agenticmeter-cli. The import name and command are both agenticmeter. Requires Python 3.10+.

Development

pip install -e ".[openai,anthropic]"
python smoke_test.py       # capture layer
python behavior_test.py    # detectors: messy run fires all, clean and trivial runs fire none

See CONTRIBUTING.md. MIT licensed.

Metadata

Release files for agenticmeter-cli 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 agenticmeter-cli 0.2.1
File Size Uploaded Provenance Actions
agenticmeter_cli-0.2.1.tar.gz 28.0 kB Without provenance Details for agenticmeter_cli-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for agenticmeter-cli 0.2.1
File Interpreter ABI Platform Actions
agenticmeter_cli-0.2.1-py3-none-any.whl Python 3 none any Details for agenticmeter_cli-0.2.1-py3-none-any.whl

Total release size: 60.3 kB

Release files / agenticmeter_cli-0.2.1.tar.gz

Download URL agenticmeter_cli-0.2.1.tar.gz
Size 28.0 kB
Tags Source
SHA-256 checksum
How to use checksums
5525de6967a44ed1a493ff449e4ed5968f09215e1ea1bf954a2cdd79d8a0c0eb
BLAKE2b-256 checksum
How to use checksums
e2bd692f745046ed51040443f86e46894493a4ba63548e0265c8b26119c225fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.4

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

Download URL agenticmeter_cli-0.2.1-py3-none-any.whl
Size 32.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
54bad4a88cb4b67c4ed9e766e7af4aed3ecaaf44370d2da23a92615aa6e704ef
BLAKE2b-256 checksum
How to use checksums
40f0ffa6ed2b32fc06a3daf758eb25527a5e7835d05f9dd3084d7c2bcf8685a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.4

Security for agenticmeter-cli 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.

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.

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