latent.agents.metrics¶
Utilities for extracting timing and token metrics from agent events.
Classes¶
CallMetrics¶
Aggregated timing and token metrics from agent events.
Functions¶
collect_call_metrics¶
Extract aggregated timing and token metrics from agent events.
Sums across all LLM calls in the event list. Duration is computed from matched LLMCallStart/LLMCallEnd timestamp pairs.
Args: events: List of agent events (typically from agent.events).
Returns: CallMetrics with total duration, input/output/total tokens.