Event Overview
All class-based events are in theVizra\VizraADK\Events namespace and use Laravel’s event system.
Agent Execution Events
AgentExecutionStarting
AgentExecutionStarting
Fired when an agent begins execution.Properties:
| Property | Description |
|---|---|
$context | The agent execution context |
$agentName | Name of the agent being executed |
$input | Initial input provided to the agent |
AgentExecutionFinished
AgentExecutionFinished
Fired when an agent completes execution.Properties:
| Property | Description |
|---|---|
$context | The agent execution context |
$agentName | Name of the agent that finished |
AgentResponseGenerated
AgentResponseGenerated
Fired when an agent generates its final response.Properties:
| Property | Description |
|---|---|
$context | The agent execution context |
$agentName | Name of the agent |
$finalResponse | The final response generated by the agent |
LLM Interaction Events
LlmCallInitiating
LlmCallInitiating
Fired before making a call to the LLM.Properties:
| Property | Description |
|---|---|
$context | The agent execution context |
$agentName | Name of the agent making the call |
$promptMessages | Array of messages being sent to the LLM |
LlmResponseReceived
LlmResponseReceived
Fired after receiving a response from the LLM.Properties:
| Property | Description |
|---|---|
$context | The agent execution context |
$agentName | Name of the agent |
$llmResponse | The response from the LLM |
$request | The Prism request object (optional) |
LlmCallFailed
LlmCallFailed
Fired when an LLM API call fails.Properties:
| Property | Description |
|---|---|
$context | The agent execution context |
$agentName | Name of the agent |
$exception | The exception that caused the failure |
$request | The failed request details (optional) |
Tool Execution Events
ToolCallInitiating
ToolCallInitiating
Fired before executing a tool.Properties:
| Property | Description |
|---|---|
$context | The agent execution context |
$agentName | Name of the agent executing the tool |
$toolName | Name of the tool being called |
$arguments | Arguments passed to the tool |
ToolCallCompleted
ToolCallCompleted
Fired after a tool completes execution.Properties:
| Property | Description |
|---|---|
$context | The agent execution context |
$agentName | Name of the agent |
$toolName | Name of the tool that completed |
$result | JSON-encoded result from the tool |
ToolCallFailed
ToolCallFailed
Fired when a tool call encounters an error.Properties:
| Property | Description |
|---|---|
$context | The agent execution context |
$agentName | Name of the agent |
$toolName | Name of the tool that failed |
$exception | The exception that caused the failure |
State Management Events
StateUpdated
StateUpdated
Fired when agent state is updated.Properties:
| Property | Description |
|---|---|
$context | The agent execution context |
$key | The state key that was updated |
$value | The new value |
MemoryUpdated
MemoryUpdated
Fired when agent memory is updated.Properties:
Update Types:
| Property | Description |
|---|---|
$memory | The agent memory instance |
$session | The associated session (optional) |
$updateType | Type of update performed |
| Type | Description |
|---|---|
'session_completed' | Session summary extracted |
'learning_added' | New learning stored |
'fact_added' | New fact stored |
Multi-Agent Events
TaskDelegated
TaskDelegated
Fired when an agent delegates a task to a sub-agent.Properties:
| Property | Description |
|---|---|
$parentContext | Context of the delegating agent |
$subAgentContext | Context for the sub-agent |
$parentAgentName | Name of the parent agent |
$subAgentName | Name of the sub-agent receiving the task |
$taskInput | The task being delegated |
$contextSummary | Summary of context passed to sub-agent |
$delegationDepth | Current depth of delegation chain |
Media Generation Events
These are string-based events fired byMediaGenerationJob when processing queued media generation tasks (images, audio, etc.).
media.job.completed
media.job.completed
Fired when any media generation job completes successfully.Payload:
Example:
| Key | Type | Description |
|---|---|---|
job_id | string | Unique identifier for the job |
agent_class | string | Fully qualified class name of the media agent |
response | ImageResponse|AudioResponse | The generated media response object |
media.{agent_name}.completed
media.{agent_name}.completed
Fired when a specific agent’s media job completes. The event name includes the agent’s name (e.g., Payload:
Example:
media.image_agent.completed).| Key | Type | Description |
|---|---|---|
job_id | string | Unique identifier for the job |
response | ImageResponse|AudioResponse | The generated media response object |
session_id | string | Session ID associated with the job |
media.job.failed
media.job.failed
Fired when a media generation job fails after all retry attempts.Payload:
Example:
| Key | Type | Description |
|---|---|---|
job_id | string | Unique identifier for the failed job |
agent_class | string | Fully qualified class name of the media agent |
error | string | Error message describing the failure |
Usage Examples
Monitoring Agent Performance
Debugging Tool Calls
Memory Tracking
Event Best Practices:
- Use event listeners for cross-cutting concerns like logging and monitoring
- Keep event handlers lightweight to avoid impacting agent performance
- Use queued listeners for heavy processing tasks
- Events are synchronous by default - be mindful of execution time
- All class-based events include the AgentContext for accessing session state
- Tool results are JSON strings - decode them for processing
- Media events are string-based and receive array payloads