onSuccessful
infix inline fun <IncomingOutput, OutgoingInput, TResult : ToolResult> AIAgentEdgeBuilderIntermediate<IncomingOutput, SafeTool.Result<TResult>, OutgoingInput>.onSuccessful(crossinline condition: suspend (TResult) -> Boolean): AIAgentEdgeBuilderIntermediate<IncomingOutput, SafeTool.Result.Success<TResult>, OutgoingInput>(source)
Filters and transforms the intermediate outputs of the AI agent node based on the success results of a tool operation.
This method is used to create a conditional path in the agent's execution by selecting only the successful results of type SafeTool.Result.Success and evaluating them against a provided condition.
Return
An instance of AIAgentEdgeBuilderIntermediate configured to handle only successful tool results that satisfy the specified condition, with output type adjusted to SafeTool.Result.Success.
Parameters
condition
A suspending lambda function that accepts a result of type TResult and evaluates it to a Boolean value. Returns true
if the condition is satisfied, and false
otherwise.