Expand description
Cost tracking for agent runs.
CostTracker observes token usage flowing through the agent and accumulates
cost data. It writes a cost.json file into the session
directory alongside the JSONL transcript, and can update the session meta
file with cost summary fields.
§Usage
ⓘ
let tracker = CostTracker::new(&workspace, "gpt-4o", "openai");
// after runtime.run(...):
tracker.record_usage(outcome.total_usage, outcome.llm_latency_ms);
tracker.finish()?;Structs§
- Cost
Data - Accumulated cost data for a single agent run.
- Cost
Pricing - Serializable pricing rates, mirroring
ModelPricingbut serializable. - Cost
Tracker - Tracks token usage and cost across an agent run, persisting to the session directory.