runAgentWithRetries

open suspend override fun runAgentWithRetries(item: TrainSetItem<Input, InputLabel>, maxAttempts: Int, until: RunUntil, agentToRun: GraphAIAgent<Input, Output>, innerRetryPolicy: RetryPolicy?): CompletedAgentRun<Output>?

Re-samples the agent: runs it up to maxAttempts times, returning the first attempt whose outcome satisfies until (default RunUntil.SOLVED). The intended use is intentional re-sampling — e.g. bootstrap demonstration generation — not transient-failure recovery.

Transient-failure retries are applied automatically inside each call to runAgent per the session's retry configuration. Each re-sample attempt therefore completes with either a success or a non-transient failure (the inner retry layer has already absorbed transient blips before this function sees the result). To opt out of inner transient retries for a specific call — e.g., to count transient-failed attempts as full samples — pass innerRetryPolicy = RetryPolicy.None (which the inner runAgent will use instead of the session-default policy).

Parameters

innerRetryPolicy

override for the transient-retry policy applied inside each re-sample attempt. null (default) = use the session's retry configuration policy. RetryPolicy.None = disable inner transient retries for this call.


open suspend override fun <RunData> runAgentWithRetries(item: TrainSetItem<Input, InputLabel>, maxAttempts: Int, until: RunUntil, innerRetryPolicy: RetryPolicy?, agentProvider: suspend () -> PreparedAgentRun<Input, Output, RunData>): MatchedAgentRun<Output, RunData>?

Runs the agent up to maxAttempts times, creating a fresh agent per attempt via agentProvider.

innerRetryPolicy mirrors the overload above — overrides the inner transient-retry policy applied inside each runAgent call.