Documentation Index
Fetch the complete documentation index at: https://docs.praison.ai/llms.txt
Use this file to discover all available pages before exploring further.
Event
Defined in the bus module.
Rust AI Agent SDK
An event in the event bus.
Fields
| Name | Type | Description |
|---|
event_type | EventType | Event type |
source | String | Source of the event (agent name, tool name, etc.) |
data | serde_json::Value | Event data |
timestamp | u64 | Timestamp (Unix millis) |
correlation_id | Option<String> | Correlation ID for tracing |
Methods
new
fn new(event_type: EventType, source: impl Into<String>) -> Self
Create a new event
Parameters:
| Name | Type |
|---|
event_type | EventType |
source | impl Into<String> |
data
fn data(mut self, data: serde_json::Value) -> Self
Set event data
Parameters:
| Name | Type |
|---|
data | serde_json::Value |
correlation_id
fn correlation_id(mut self, id: impl Into<String>) -> Self
Set correlation ID
Parameters:
| Name | Type |
|---|
id | impl Into<String> |
agent_start
fn agent_start(agent_name: impl Into<String>) -> Self
Create agent start event
Parameters:
| Name | Type |
|---|
agent_name | impl Into<String> |
agent_end
fn agent_end(agent_name: impl Into<String>) -> Self
Create agent end event
Parameters:
| Name | Type |
|---|
agent_name | impl Into<String> |
agent_error
fn agent_error(agent_name: impl Into<String>, error: impl Into<String>) -> Self
Create agent error event
Parameters:
| Name | Type |
|---|
agent_name | impl Into<String> |
error | impl Into<String> |
fn tool_start(tool_name: impl Into<String>) -> Self
Create tool start event
Parameters:
| Name | Type |
|---|
tool_name | impl Into<String> |
fn tool_end(tool_name: impl Into<String>) -> Self
Create tool end event
Parameters:
| Name | Type |
|---|
tool_name | impl Into<String> |
fn tool_error(tool_name: impl Into<String>, error: impl Into<String>) -> Self
Create tool error event
Parameters:
| Name | Type |
|---|
tool_name | impl Into<String> |
error | impl Into<String> |
llm_request
fn llm_request(model: impl Into<String>) -> Self
Create LLM request event
Parameters:
| Name | Type |
|---|
model | impl Into<String> |
llm_response
fn llm_response(model: impl Into<String>) -> Self
Create LLM response event
Parameters:
| Name | Type |
|---|
model | impl Into<String> |
workflow_start
fn workflow_start(workflow_name: impl Into<String>) -> Self
Create workflow start event
Parameters:
| Name | Type |
|---|
workflow_name | impl Into<String> |
workflow_end
fn workflow_end(workflow_name: impl Into<String>) -> Self
Create workflow end event
Parameters:
| Name | Type |
|---|
workflow_name | impl Into<String> |
handoff_start
fn handoff_start(source: impl Into<String>, target: impl Into<String>) -> Self
Create handoff start event
Parameters:
| Name | Type |
|---|
source | impl Into<String> |
target | impl Into<String> |
handoff_end
fn handoff_end(source: impl Into<String>, target: impl Into<String>) -> Self
Create handoff end event
Parameters:
| Name | Type |
|---|
source | impl Into<String> |
target | impl Into<String> |
custom
fn custom(source: impl Into<String>, data: serde_json::Value) -> Self
Create custom event
Parameters:
| Name | Type |
|---|
source | impl Into<String> |
data | serde_json::Value |
Source
View on GitHub
praisonai/src/bus/mod.rs at line 73