ElapsedTimeMetric

@Serializable
@SerialName(value = "elapsedTime")
data class ElapsedTimeMetric(val key: MetricKey<ElapsedTimeMetric> = KEY, val avgPerFinishedSubstage: Duration? = null, val maxPerFinishedSubstage: Duration? = null, val etc: Duration? = null, val withRetries: ElapsedWithRetries? = null) : Metric

Derived timing aggregates for a stage.

The stage's own wall-clock duration lives on StageRecord.realElapsed — this metric only exposes values that are genuinely derived from substages or from the stage's own elapsed:

  • avgPerFinishedSubstage: mean elapsed time across finished substages. In-progress substages are excluded — including their partial elapsed would skew the average.

  • maxPerFinishedSubstage: longest finished substage. Useful for spotting outlier items in a dataset iteration.

  • etc: projected time-to-completion. Prefers the running direct child's own ETC when available (plus projected time for siblings not yet started) — this covers the common "single iterateDataset child" case that the naive realElapsed / processed × remaining formula can't handle. Falls back to that formula when no child ETC exists.

Constructors

Link copied to clipboard
constructor(key: MetricKey<ElapsedTimeMetric> = KEY, avgPerFinishedSubstage: Duration? = null, maxPerFinishedSubstage: Duration? = null, etc: Duration? = null, withRetries: ElapsedWithRetries? = null)

Types

Link copied to clipboard
object Companion

Key holder for ElapsedTimeMetric.

Properties

Link copied to clipboard
@EncodeDefault(mode = EncodeDefault.Mode.NEVER)
val avgPerFinishedSubstage: Duration? = null

Mean elapsed time across finished substages (in-progress ones excluded), or null if none.

Link copied to clipboard
@EncodeDefault(mode = EncodeDefault.Mode.NEVER)
val etc: Duration? = null

Projected estimated time to completion for the stage, or null when it can't be derived.

Link copied to clipboard
@Transient
open override val key: MetricKey<ElapsedTimeMetric>

The key that identifies this metric in a ai.koog.agents.optimization.training.metrics.MetricsMap.

Link copied to clipboard
@EncodeDefault(mode = EncodeDefault.Mode.NEVER)
val maxPerFinishedSubstage: Duration? = null

Longest finished substage, useful for spotting outlier items, or null if none.

Link copied to clipboard
@EncodeDefault(mode = EncodeDefault.Mode.NEVER)
val withRetries: ElapsedWithRetries? = null

Retries-aware totals; null when no retries fired below this stage.

Functions

Link copied to clipboard
open override fun recompute(currentStage: StageRecord, substages: List<TrainingRecord>, isStageUpdate: Boolean): ElapsedTimeMetric

Recompute this metric from the full list of substages records.