context.costs
Cost usage tracking for pydantic-ai agents.
Provides a lightweight in-memory store for per-agent cost totals, model breakdowns, and per-run traceability records.
ModelCostBreakdown Objects
@dataclass
class ModelCostBreakdown()
Aggregated cost/tokens for a single model.
CostRunTrace Objects
@dataclass
class CostRunTrace()
Traceability record for one completed model run.
AgentCostUsage Objects
@dataclass
class AgentCostUsage()
Per-agent cost usage state.
AgentCostStore Objects
class AgentCostStore()
Global in-memory cost tracking state.