run Stage
Runs a named substage. Creates a StageRecord as a substage of the current stage.
Exceptions from the block are caught, recorded as a stage failure, and wrapped in StageFailedException. Use .getOrThrow() to re-throw.
Parameters
The display name of this substage.
How many substages does this stage have. Used to calculate ETC and progress.
The metrics preset for the substage. Defaults to standardStageMetrics; pass a different preset (e.g. ai.koog.agents.optimization.training.metrics.datasetIterationMetrics) when the stage needs an extended set. Follow the standardStageMetrics() + extras convention so cluster progress and consumption tracking keep working. Pass a fresh MetricsMap per call (factory or +); the map is mutated in place during the stage's lifetime, so sharing instances across stages is unsafe.