EventHandlerConfig
Configuration class for the EventHandler feature.
This class provides a way to configure handlers for various events that occur during the execution of an agent. These events include agent lifecycle events, strategy events, node events, LLM call events, and tool call events.
Each handler is a property that can be assigned a lambda function to be executed when the corresponding event occurs.
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
A deprecated property to handle events triggered after a response is received from the language model (LLM).
A deprecated variable used to define a handler that is called after a node in the agent's execution graph has been processed.
A deprecated handler invoked when an agent finishes execution.
A deprecated variable used to define a handler that is called when an error occurs during agent execution.
A handler invoked before an AI agent is started.
Deprecated variable used to define a handler that is invoked before a call is made to the language model.
A handler invoked before a node in the agent's execution graph is processed.
A deprecated variable that defines a handler to be invoked when a strategy finishes execution. Replaced by the onStrategyFinished(handler)
method to provide a more structured and extensible approach.
A suspendable handler invoked when a strategy starts execution in the AI Agent workflow.
A deprecated variable for appending a handler called when a tool is about to be invoked.
Defines a handler invoked when a tool call fails due to an exception.
Deprecated variable representing a handler invoked when a tool call is completed successfully. The handler is a suspend function with parameters for the tool, its arguments, and the result of the tool call.
A deprecated variable representing the handler invoked when a validation error occurs during a tool call. Use onToolValidationError(handler)
instead to register error handling logic.
Functions
Append handler called after a response is received from the language model.
Append handler called after a node in the agent's execution graph has been processed.
Appends a handler called before an agent is closed. This allows for additional behavior to be executed prior to the agent being closed.
Append handler called when an agent finishes execution.
Append handler called when an error occurs during agent execution.
Append handler called when an agent is started.
Append handler called before a call is made to the language model.
Append handler called before a node in the agent's execution graph is processed.
Append handler called when a strategy finishes execution.
Append handler called when a strategy starts execution.
Append handler called when a tool is about to be called.
Append handler called when a tool call fails with an exception.
Append handler called when a tool call completes successfully.
Append handler called when a validation error occurs during a tool call.