RetryStatsMetric

@Serializable
@SerialName(value = "retryStats")
data class RetryStatsMetric(val key: MetricKey<RetryStatsMetric> = KEY, val totalRetriesPerformed: Int = 0, val leavesWithRetries: Int = 0, val leavesWithRetriesRatioOfFinished: Ratio = Ratio.ZERO, val leavesResolvedAfterRetries: Int = 0, val leavesResolvedAfterRetriesRatioOfLeavesWithRetries: Ratio = Ratio.ZERO, val avgRetriesPerLeafWithRetries: Double? = null, val completedLeavesByRetryCount: Map<Int, Int> = emptyMap(), val leavesUnresolvedAfterRetries: Int = 0) : Metric

Counts retries performed below this stage and how often they resolve a failure.

Present on every stage. All fields are omitted when at their default, so a retries-free stage serializes to an empty "retryStats": {} object.

Constructors

Link copied to clipboard
constructor(key: MetricKey<RetryStatsMetric> = KEY, totalRetriesPerformed: Int = 0, leavesWithRetries: Int = 0, leavesWithRetriesRatioOfFinished: Ratio = Ratio.ZERO, leavesResolvedAfterRetries: Int = 0, leavesResolvedAfterRetriesRatioOfLeavesWithRetries: Ratio = Ratio.ZERO, avgRetriesPerLeafWithRetries: Double? = null, completedLeavesByRetryCount: Map<Int, Int> = emptyMap(), leavesUnresolvedAfterRetries: Int = 0)

Types

Link copied to clipboard
object Companion

Key holder for RetryStatsMetric.

Properties

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

Mean retries per leaf that retried at least once, or null when none retried.

Link copied to clipboard
@EncodeDefault(mode = EncodeDefault.Mode.NEVER)
val completedLeavesByRetryCount: Map<Int, Int>

Histogram of finished-Completed leaves keyed by how many retries each needed (0 included).

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

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 leavesResolvedAfterRetries: Int = 0

Leaves that retried and ultimately completed successfully.

Link copied to clipboard
@EncodeDefault(mode = EncodeDefault.Mode.NEVER)
val leavesUnresolvedAfterRetries: Int = 0

Leaves that retried at least once and ended Failed.

Link copied to clipboard
@EncodeDefault(mode = EncodeDefault.Mode.NEVER)
val leavesWithRetries: Int = 0

Number of leaves that retried at least once.

Link copied to clipboard
@EncodeDefault(mode = EncodeDefault.Mode.NEVER)
val leavesWithRetriesRatioOfFinished: Ratio

leavesWithRetries over the number of finished leaves.

Link copied to clipboard
@EncodeDefault(mode = EncodeDefault.Mode.NEVER)
val totalRetriesPerformed: Int = 0

Total retry attempts performed by all leaves below this stage.

Functions

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

Recompute this metric from the full list of substages records.