Skip to main content

Event

Defined in the bus module.
Rust AI Agent SDK An event in the event bus.

Fields

NameTypeDescription
event_typeEventTypeEvent type
sourceStringSource of the event (agent name, tool name, etc.)
dataserde_json::ValueEvent data
timestampu64Timestamp (Unix millis)
correlation_idOption<String>Correlation ID for tracing

Methods

new

fn new(event_type: EventType, source: impl Into<String>) -> Self
Create a new event Parameters:
NameType
event_typeEventType
sourceimpl Into&lt;String&gt;

data

fn data(mut self, data: serde_json::Value) -> Self
Set event data Parameters:
NameType
dataserde_json::Value

correlation_id

fn correlation_id(mut self, id: impl Into<String>) -> Self
Set correlation ID Parameters:
NameType
idimpl Into&lt;String&gt;

agent_start

fn agent_start(agent_name: impl Into<String>) -> Self
Create agent start event Parameters:
NameType
agent_nameimpl Into&lt;String&gt;

agent_end

fn agent_end(agent_name: impl Into<String>) -> Self
Create agent end event Parameters:
NameType
agent_nameimpl Into&lt;String&gt;

agent_error

fn agent_error(agent_name: impl Into<String>, error: impl Into<String>) -> Self
Create agent error event Parameters:
NameType
agent_nameimpl Into&lt;String&gt;
errorimpl Into&lt;String&gt;

tool_start

fn tool_start(tool_name: impl Into<String>) -> Self
Create tool start event Parameters:
NameType
tool_nameimpl Into&lt;String&gt;

tool_end

fn tool_end(tool_name: impl Into<String>) -> Self
Create tool end event Parameters:
NameType
tool_nameimpl Into&lt;String&gt;

tool_error

fn tool_error(tool_name: impl Into<String>, error: impl Into<String>) -> Self
Create tool error event Parameters:
NameType
tool_nameimpl Into&lt;String&gt;
errorimpl Into&lt;String&gt;

llm_request

fn llm_request(model: impl Into<String>) -> Self
Create LLM request event Parameters:
NameType
modelimpl Into&lt;String&gt;

llm_response

fn llm_response(model: impl Into<String>) -> Self
Create LLM response event Parameters:
NameType
modelimpl Into&lt;String&gt;

workflow_start

fn workflow_start(workflow_name: impl Into<String>) -> Self
Create workflow start event Parameters:
NameType
workflow_nameimpl Into&lt;String&gt;

workflow_end

fn workflow_end(workflow_name: impl Into<String>) -> Self
Create workflow end event Parameters:
NameType
workflow_nameimpl Into&lt;String&gt;

handoff_start

fn handoff_start(source: impl Into<String>, target: impl Into<String>) -> Self
Create handoff start event Parameters:
NameType
sourceimpl Into&lt;String&gt;
targetimpl Into&lt;String&gt;

handoff_end

fn handoff_end(source: impl Into<String>, target: impl Into<String>) -> Self
Create handoff end event Parameters:
NameType
sourceimpl Into&lt;String&gt;
targetimpl Into&lt;String&gt;

custom

fn custom(source: impl Into<String>, data: serde_json::Value) -> Self
Create custom event Parameters:
NameType
sourceimpl Into&lt;String&gt;
dataserde_json::Value

Source

View on GitHub

praisonai/src/bus/mod.rs at line 73