TrainingResources

class TrainingResources<Input, Output, InputLabel>(val trackedAgent: GraphAIAgent<Input, Output>, val dataset: TrainSet<Input, InputLabel>, val substepPromptExecutor: PromptExecutor, val metric: (TrainSetItem<Input, InputLabel>, Output) -> Double, val threshold: Double, val serializers: DatasetExecutionSerializers<Input, Output, InputLabel>, val actionLogTruncation: ActionLogTruncation, val retriesPolicy: RetryPolicy, val failureAnalyzer: FailureAnalyzer, val capturingExecutorFactory: (PromptExecutor) -> CapturingPromptExecutor, val consumptionCollector: () -> LLMConsumption? = { null }, val runAgentAttempt: suspend (agent: GraphAIAgent<Input, Output>, input: Input) -> Pair<GraphAIAgent<Input, Output>, Output> = { agent, input -> agent to agent.run(input) }, val withItemContext: suspend (itemId: String, block: suspend () -> Unit) -> Unit = { _, block -> block() })

Shared execution resources created once per training session.

Holds the tracked agent, the injected execution collaborators (consumption capture, failure analysis, per-item context, agent invocation), and configuration shared across all scope instances.

These collaborators (failureAnalyzer, consumptionCollector, capturingExecutorFactory, runAgentAttempt, withItemContext) are supplied by the app; the defaults make the resources usable on their own (no consumption, no provider-specific recognition, plain agent runs).

Constructors

Link copied to clipboard
constructor(trackedAgent: GraphAIAgent<Input, Output>, dataset: TrainSet<Input, InputLabel>, substepPromptExecutor: PromptExecutor, metric: (TrainSetItem<Input, InputLabel>, Output) -> Double, threshold: Double, serializers: DatasetExecutionSerializers<Input, Output, InputLabel>, actionLogTruncation: ActionLogTruncation, retriesPolicy: RetryPolicy, failureAnalyzer: FailureAnalyzer, capturingExecutorFactory: (PromptExecutor) -> CapturingPromptExecutor, consumptionCollector: () -> LLMConsumption? = { null }, runAgentAttempt: suspend (agent: GraphAIAgent<Input, Output>, input: Input) -> Pair<GraphAIAgent<Input, Output>, Output> = { agent, input -> agent to agent.run(input) }, withItemContext: suspend (itemId: String, block: suspend () -> Unit) -> Unit = { _, block -> block() })

Properties

Link copied to clipboard

Truncation applied to action-log strings recorded during the session.

Link copied to clipboard

Wraps a delegate executor into a consumption-capturing one, created once per leaf prompt call.

Link copied to clipboard

Returns the consumption accumulated by the tracked agent since the last call (cleared each call).

Link copied to clipboard

The training dataset iterated by the DSL.

Link copied to clipboard

Recognizes caught exceptions into the project's failure taxonomy.

Link copied to clipboard

Scores an agent's output against its dataset item; higher is better.

Link copied to clipboard

Session-level retry policy applied inside leaf primitives (runAgent / executeWithTrackedPromptExecutor).

Link copied to clipboard
val runAgentAttempt: suspend (agent: GraphAIAgent<Input, Output>, input: Input) -> Pair<GraphAIAgent<Input, Output>, Output>

Runs one agent attempt; returns the (possibly re-prepared) agent and its output.

Link copied to clipboard

Serializers for dataset items and agent outputs used when recording runs.

Link copied to clipboard
val substepPromptExecutor: PromptExecutor

Executor used for the session's leaf prompt calls (executePrompt and variants).

Link copied to clipboard

Score at or above which a run counts as solved.

Link copied to clipboard
val trackedAgent: GraphAIAgent<Input, Output>

The agent being trained/evaluated; the default target of runAgent.

Link copied to clipboard
val withItemContext: suspend (itemId: String, block: suspend () -> Unit) -> Unit

Establishes any per-item context (e.g. tracing) around a dataset item's processing.