handlers
handlers
marvin.handlers.handlers
Classes
AsyncHandler
Methods:
on_actor_end_turn
Handles actor turn completion. Called when an actor finishes its processing turn.on_actor_message
Handles complete messages from actors. Called when an actor produces a full response. This is the final event that follows any related actor_message_delta events.on_actor_message_delta
Handles streaming updates to actor messages. Called multiple times during message generation. These delta events always precede the final actor_message event.on_actor_start_turn
Handles actor turn initiation. Called when an actor begins its processing turn.on_end_turn_tool_call
Handles special end-of-turn tool calls. Called when actors use tools to signal turn completion. This event is produced instantly when an end turn tool is recognized (based on tool name). It follows any tool_call_delta events and precedes end_turn_tool_result or tool_retry events.on_end_turn_tool_result
Handles the final result from an end turn tool. This is the final event in the end turn tool sequence, following end_turn_tool_call and any tool_retry events.on_event
Called for every event before specific handlers. Override for global event processing.on_orchestrator_end
Handles normal orchestrator completion. Called when orchestration ends (including after an error).on_orchestrator_error
Handles orchestrator exceptions. Called when an error occurs during orchestration.on_orchestrator_start
Handles orchestrator initialization. Called once when orchestration begins.on_tool_call
Handles tool call events. Called when an actor invokes a function tool. This follows any tool_call_delta events and precedes tool_retry or tool_result events.on_tool_call_delta
Handles streaming updates during tool call formation. Called multiple times as tool calls are generated. These delta events always precede either a tool_call event (for function tools) or an end_turn_tool_call event.on_tool_result
Handles successful tool execution results. Called when a function tool returns output. This is the final event in the function tool sequence, following tool_call and any tool_retry events.on_tool_retry
Handles tool retry events. Called when a tool execution fails and needs to be retried. Can occur for both function tools and end turn tools before their respective final result events.on_user_message
Handles messages from the user. Called when a user sends input to the system.
Handler
Methods:
on_actor_end_turn
Handles actor turn completion. Called when an actor finishes its processing turn.on_actor_message
Handles complete messages from actors. Called when an actor produces a full response. This is the final event that follows any related actor_message_delta events.on_actor_message_delta
Handles streaming updates to actor messages. Called multiple times during message generation. These delta events always precede the final actor_message event.on_actor_start_turn
Handles actor turn initiation. Called when an actor begins its processing turn.on_end_turn_tool_call
Handles special end-of-turn tool calls. Called when actors use tools to signal turn completion. This event is produced instantly when an end turn tool is recognized (based on tool name). It follows any tool_call_delta events and precedes end_turn_tool_result or tool_retry events.on_end_turn_tool_result
Handles the final result from an end turn tool. This is the final event in the end turn tool sequence, following end_turn_tool_call and any tool_retry events.on_event
Called for every event before specific handlers. Override for global event processing.on_orchestrator_end
Handles normal orchestrator completion. Called when orchestration ends (including after an error).on_orchestrator_error
Handles orchestrator exceptions. Called when an error occurs during orchestration.on_orchestrator_start
Handles orchestrator initialization. Called once when orchestration begins.on_tool_call
Handles tool call events. Called when an actor invokes a function tool. This follows any tool_call_delta events and precedes tool_retry or tool_result events.on_tool_call_delta
Handles streaming updates during tool call formation. Called multiple times as tool calls are generated. These delta events always precede either a tool_call event (for function tools) or an end_turn_tool_call event.on_tool_result
Handles successful tool execution results. Called when a function tool returns output. This is the final event in the function tool sequence, following tool_call and any tool_retry events.on_tool_retry
Handles tool retry events. Called when a tool execution fails and needs to be retried. Can occur for both function tools and end turn tools before their respective final result events.on_user_message
Handles messages from the user. Called when a user sends input to the system.
Parent Module: handlers