Skip to main content

agentmeter

CI PyPI version License: MIT OpenInference compatible

agentmeter instruments multi-agent AI systems to track execution cost, latency, and outcome at the span level - giving you the economic signal your traces are missing.

Multi-agent systems fail silently and spend invisibly. LangSmith and Phoenix show you what happened. agentmeter tells you what it cost, what failed, and how it compares.

Quickstart

from agentmeter import Tracer, SpanKind, configure
def retrieve(q: str) -> list[str]:
    return ["doc-a"]
configure(log_path="./agentmeter_logs/run.jsonl")
tracer = Tracer("my-planner", SpanKind.AGENT)
with tracer.span("my-retriever", SpanKind.RETRIEVER) as s:
    docs = retrieve("change-order status")
    s.set_cost(0.0002)
    s.set_outcome("success")
print(f"Total cost: ${tracer.finish().total_cost_usd:.4f}")

SpanKind Reference

Name OpenInference-compatible Cost driver Example
LLM Yes (llm) prompt + completion tokens draft a summary
CHAIN Yes (chain) orchestration overhead + downstream calls run a multi-step chain
RETRIEVER Yes (retriever) vector/DB lookup count and latency fetch top-k documents
TOOL Yes (tool) external API/runtime call cost OCR a PDF
AGENT Yes (agent) planning + delegated subcalls route task to workers
EMBEDDING Yes (embedding) embedding model tokens embed a document chunk
RERANKER Yes (reranker) reranker model inference rerank candidate passages
GUARDRAIL Yes (guardrail) policy/model checks schema and safety gate
EVALUATOR Yes (evaluator) evaluation model/runtime calls score answer quality

Configuration

from agentmeter import configure

configure()  # silent stdout default
configure(silent=False)  # print JSON events to stdout
configure(log_path="./agentmeter_logs/run.jsonl")  # JSONL file output

Data Model

ExecutionTrace is the immutable top-level record for one execution and includes execution_id, root_agent_id, started_at, ended_at, outcome, and spans, plus computed total_cost_usd and total_latency_ms. Each Span captures span_id, parent_span_id, caller_agent_id, callee_agent_id, capability, timestamps, token counts, cost_usd, outcome, and optional error_message/metadata. AgentIdentity stores persistent identity fields (agent_id, capability, version, tags, created timestamp) for cross-run attribution.

OpenInference Compatibility

agentmeter SpanKinds align with the OpenInference specification used by Arize Phoenix and LangSmith. Traces can be compared against industry benchmarks using the same vocabulary.

Contributing

Contributions are welcome, especially around tracer integrations, emitter backends, and model validation hardening. Changes to SpanKind require discussion before merge because it is part of the public API and affects downstream compatibility.

License

MIT

agentmeter

Release files for agentmeter-caleb12 0.1.0

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

Source distribution (sdist)

Source distribution for agentmeter-caleb12 0.1.0
File Size Uploaded
agentmeter_caleb12-0.1.0.tar.gz 43.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for agentmeter-caleb12 0.1.0
File Interpreter ABI Platform
agentmeter_caleb12-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 83.9 kB

Release files / agentmeter_caleb12-0.1.0.tar.gz

Download URL agentmeter_caleb12-0.1.0.tar.gz
Size 43.7 kB
Tags Source
SHA-256 checksum
How to use checksums
369ed97bc3ba6c5205f851d643855364ebb27fc213535445448645541dc1bc90
BLAKE2b-256 checksum
How to use checksums
80eff9cc46e072f82d596ea2fe27cafb39891921ca6745eda1429aaf39b2ece4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / agentmeter_caleb12-0.1.0-py3-none-any.whl

Download URL agentmeter_caleb12-0.1.0-py3-none-any.whl
Size 40.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
94da19168bd43c671b459f92e892c33eda5d799c8e5d719cd2252f1d462615a5
BLAKE2b-256 checksum
How to use checksums
ff25c99e2f40a155a3f5a7ff4b42eeebe9d3c422045000b8ca60ee26194175a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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