Event • Rust AI Agent SDK
Event: An event in the event bus.
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>) -> SelfCreate a new event
Parameters:
| Name | Type |
|---|---|
event_type | EventType |
source | impl Into<String> |
data
fn data(mut self, data: serde_json::Value) -> SelfSet event data
Parameters:
| Name | Type |
|---|---|
data | serde_json::Value |
correlation_id
fn correlation_id(mut self, id: impl Into<String>) -> SelfSet correlation ID
Parameters:
| Name | Type |
|---|---|
id | impl Into<String> |
agent_start
fn agent_start(agent_name: impl Into<String>) -> SelfCreate agent start event
Parameters:
| Name | Type |
|---|---|
agent_name | impl Into<String> |
agent_end
fn agent_end(agent_name: impl Into<String>) -> SelfCreate 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>) -> SelfCreate agent error event
Parameters:
| Name | Type |
|---|---|
agent_name | impl Into<String> |
error | impl Into<String> |
tool_start
fn tool_start(tool_name: impl Into<String>) -> SelfCreate tool start event
Parameters:
| Name | Type |
|---|---|
tool_name | impl Into<String> |
tool_end
fn tool_end(tool_name: impl Into<String>) -> SelfCreate tool end event
Parameters:
| Name | Type |
|---|---|
tool_name | impl Into<String> |
tool_error
fn tool_error(tool_name: impl Into<String>, error: impl Into<String>) -> SelfCreate tool error event
Parameters:
| Name | Type |
|---|---|
tool_name | impl Into<String> |
error | impl Into<String> |
llm_request
fn llm_request(model: impl Into<String>) -> SelfCreate LLM request event
Parameters:
| Name | Type |
|---|---|
model | impl Into<String> |
llm_response
fn llm_response(model: impl Into<String>) -> SelfCreate LLM response event
Parameters:
| Name | Type |
|---|---|
model | impl Into<String> |
workflow_start
fn workflow_start(workflow_name: impl Into<String>) -> SelfCreate workflow start event
Parameters:
| Name | Type |
|---|---|
workflow_name | impl Into<String> |
workflow_end
fn workflow_end(workflow_name: impl Into<String>) -> SelfCreate workflow end event
Parameters:
| Name | Type |
|---|---|
workflow_name | impl Into<String> |
handoff_start
fn handoff_start(source: impl Into<String>, target: impl Into<String>) -> SelfCreate 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>) -> SelfCreate 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) -> SelfCreate custom event
Parameters:
| Name | Type |
|---|---|
source | impl Into<String> |
data | serde_json::Value |
Source
View on GitHubpraisonai/src/bus/mod.rs at line 73