Feature

Implementation of the AIAgentFeature interface for the EventHandler feature.

This companion object provides the necessary functionality to install the EventHandler feature into an agent's pipeline. It intercepts various events in the agent's lifecycle and forwards them to the appropriate handlers defined in the EventHandlerConfig.

The EventHandler provides a way to register callbacks for different events that occur during the execution of an agent, such as agent lifecycle events, strategy events, node events, LLM call events, and tool call events.

Example usage:

handleEvents {
onToolCall = { stage, tool, toolArgs ->
println("Tool called: ${tool.name} with args $toolArgs")
}

onAgentFinished = { strategyName, result ->
println("Agent finished with result: $result")
}
}

Properties

Link copied to clipboard
open override val key: AIAgentStorageKey<EventHandler>

Functions

Link copied to clipboard
Link copied to clipboard
open override fun install(config: EventHandlerConfig, pipeline: AIAgentPipeline)
Link copied to clipboard
open fun installUnsafe(config: Any?, pipeline: AIAgentPipeline)