interceptAgentClosing

fun interceptAgentClosing(feature: AIAgentFeature<*, *>, handle: suspend (eventContext: AgentClosingContext) -> Unit)(source)

Intercepts and sets a handler to be invoked before an agent is closed.

Parameters

feature

The feature associated with this handler.

handle

A suspendable function that is executed during the agent's pre-close phase.

Example:

pipeline.interceptAgentClosing(feature) { eventContext ->
// Handle agent run before close event.
}