subgraphWithRetry

inline fun <Input : Any, Output> AIAgentSubgraphBuilderBase<*, *>.subgraphWithRetry(noinline condition: suspend (Output) -> Boolean, maxRetries: Int, toolSelectionStrategy: ToolSelectionStrategy = ToolSelectionStrategy.ALL, name: String? = null, noinline defineAction: AIAgentSubgraphBuilderBase<Input, Output>.() -> Unit): AIAgentSubgraphDelegate<Input, RetrySubgraphResult<Output>>(source)

Creates a subgraph with retry mechanism, allowing a specified action subgraph to be retried multiple times until a given condition is met or the maximum number of retries is reached.

Parameters

condition

A function that evaluates whether the output meets the desired condition.

maxRetries

The maximum number of allowed retries. Must be greater than 0.

toolSelectionStrategy

The strategy used to select a tool for executing the action.

name

The optional name of the subgraph.

defineAction

A lambda defining the action subgraph to perform within the retry subgraph.