interceptAgentRunError

fun <TFeature : Any> interceptAgentRunError(context: InterceptContext<TFeature>, handle: suspend TFeature.(eventContext: AgentRunErrorContext) -> Unit)(source)

Intercepts and handles errors occurring during the execution of an AI agent's strategy.

Parameters

handle

A suspend function providing custom logic to execute when an error occurs,

Example:

pipeline.interceptAgentRunError(InterceptContext) { eventContext ->
// Handle the error here, using the strategy name and the exception that occurred.
}