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.
ContextEvent
Defined in the trace module.
Rust AI Agent SDK
A context event for replay/debugging.
Fields
| Name | Type | Description |
|---|
event_type | ContextEventType | Event type |
name | String | Event name |
timestamp_ms | u64 | Timestamp (milliseconds since epoch) |
agent_id | Option<String> | Agent ID (if applicable) |
agent_name | Option<String> | Agent name (if applicable) |
tool_name | Option<String> | Tool name (if applicable) |
input | Option<serde_json::Value> | Input data |
output | Option<serde_json::Value> | Output data |
error | Option<String> | Error message (if applicable) |
duration_ms | Option<u64> | Duration in milliseconds (if applicable) |
metadata | HashMap<String | Additional metadata |
serde_json | :Value> | Additional metadata |
Methods
new
fn new(event_type: ContextEventType, name: impl Into<String>) -> Self
Create a new context event.
Parameters:
| Name | Type |
|---|
event_type | ContextEventType |
name | impl Into<String> |
agent
fn agent(mut self, id: impl Into<String>, name: impl Into<String>) -> Self
Set agent info.
Parameters:
| Name | Type |
|---|
id | impl Into<String> |
name | impl Into<String> |
fn tool(mut self, name: impl Into<String>) -> Self
Set tool name.
Parameters:
| Name | Type |
|---|
name | impl Into<String> |
fn input(mut self, input: serde_json::Value) -> Self
Set input.
Parameters:
| Name | Type |
|---|
input | serde_json::Value |
output
fn output(mut self, output: serde_json::Value) -> Self
Set output.
Parameters:
| Name | Type |
|---|
output | serde_json::Value |
error
fn error(mut self, error: impl Into<String>) -> Self
Set error.
Parameters:
| Name | Type |
|---|
error | impl Into<String> |
duration_ms
fn duration_ms(mut self, ms: u64) -> Self
Set duration.
Parameters:
fn metadata(mut self, key: impl Into<String>, value: serde_json::Value) -> Self
Add metadata.
Parameters:
| Name | Type |
|---|
key | impl Into<String> |
value | serde_json::Value |
Source
View on GitHub
praisonai/src/trace/mod.rs at line 486