Package-level declarations
Types
A mutable, typed wrapper around Map<MetricKey<*>, Metric>.
KSerializer that encodes a MetricsMap as a plain map of metric-key id to polymorphic Metric.
Functions
Collect all AgentRunRecords (both completed and failed), recursively through stages.
true if any leaf in this subtree performed at least one retry.
Return the average of the list, or null if the list is empty.
Get the consumption of any record.
Count substages that are completed successfully (no failure).
Count substages that are failed (stages with failure, or failed leaf records).
Count substages that have finished, regardless of failures.
Dataset iteration metrics: standard + dataset-specific solved rate + agent run stats + solved-aware consumption.
Keep only finished substages: leaves are atomic so they always pass, stages pass only when StageRecord.isFinished. Intended for aggregate metrics that would otherwise include an in-flight stage's partial state (consumption/solved counts/etc.) in the roll-up.
Wall-clock per finished substage. Stage substages contribute StageRecord.realElapsed (only once finished, since a running stage's live value would skew avg / max); leaf substages contribute aggregatedElapsedTime (final attempt + retries + retry wait delays) — the real cost a downstream avgPerFinishedSubstage / ETC projection should reflect.
Check if a record (or its substages recursively) contains any solved agent run.
Root stage metrics: standard + cross-stage summary metrics.
Standard metrics for any stage: elapsed time, substage counts, consumption, failures, retry stats.
Collect a specific metric from all substage StageRecords that have it.
Sum consumption across all substages, skipping NA values.
Retry-attempt consumption only (excludes the final attempt), summed across substages.
Final attempt + retry attempts, summed across substages.
Retry-attempt elapsed + retry wait delays (excludes the final attempt), summed across substages.
Final attempt + retry attempts + retry wait delays, summed across substages.