agenttrace
Cost + latency aggregation for LLM agent runs. Group calls into named runs, get totals, p50/p95, per-model breakdown.
[]
= "0.1"
Why
cachebench tells you per-call hit rate. claude-cost tells you per-call dollars. agenttrace tells you what one agent run (one user turn, one workflow) cost end-to-end and how long it took. That's the unit your product team and finance care about.
Quick start
use Tracer;
use Duration;
let tracer = new;
// One agent run = one user request:
let run = tracer.run;
run.record;
run.record;
run.finish;
// After many runs:
let agg = tracer.aggregate;
println!;
for in &agg.by_model
Composes with cachebench and claude-cost
use Tracer;
use ;
use ;
let cache = new;
let trace = new;
let run = trace.run;
let resp = call_claude; // your code
cache.record;
let usd = cost;
run.record;
run.finish;
API
new
tracer.run .record
run.finish .runs .aggregate
tracer.reset
RunRecord and CallRecord derive Serialize/Deserialize — easy to dump to JSON, ship to your warehouse, etc.
What it doesn't do
- Doesn't compute cost — you supply it. Use
claude-costor your own pricing. - Doesn't make HTTP calls.
- Not OTel — for traces, ship your own span emitter or watch for a future
agenttrace-otelcompanion.
Sibling: JS @mukundakatta/agenttrace
JS users: see @mukundakatta/agenttrace.
License
MIT