Context Trace Emitter • Rust AI Agent SDK
ContextTraceEmitter: Context trace emitter.
ContextTraceEmitter
Defined in the trace module.
Rust AI Agent SDK
Context trace emitter.
Fields
| Name | Type | Description |
|---|---|---|
sink | Box<dyn ContextTraceSinkProtocol> | – |
Methods
new
fn new(sink: impl ContextTraceSinkProtocol + 'static) -> SelfCreate with a specific sink.
Parameters:
| Name | Type |
|---|---|
sink | impl ContextTraceSinkProtocol + 'static |
noop
fn noop() -> SelfCreate with no-op sink (zero overhead).
with_list_sink
fn with_list_sink() -> SelfCreate with list sink.
emit
fn emit(&mut self, event: ContextEvent) -> ()Emit an event.
Parameters:
| Name | Type |
|---|---|
event | ContextEvent |
events
fn events(&self) -> &[ContextEvent]Get events.
clear
fn clear(&mut self) -> ()Clear events.
agent_start
fn agent_start(&mut self, agent_id: &str, agent_name: &str, input: &str) -> ()Emit agent start event.
Parameters:
| Name | Type |
|---|---|
agent_id | &str |
agent_name | &str |
input | &str |
agent_end
fn agent_end(&mut self, agent_id: &str, agent_name: &str, output: &str, duration_ms: u64) -> ()Emit agent end event.
Parameters:
| Name | Type |
|---|---|
agent_id | &str |
agent_name | &str |
output | &str |
duration_ms | u64 |
tool_start
fn tool_start(&mut self, tool_name: &str, args: serde_json::Value) -> ()Emit tool start event.
Parameters:
| Name | Type |
|---|---|
tool_name | &str |
args | serde_json::Value |
tool_end
fn tool_end(&mut self, tool_name: &str, result: serde_json::Value, duration_ms: u64) -> ()Emit tool end event.
Parameters:
| Name | Type |
|---|---|
tool_name | &str |
result | serde_json::Value |
duration_ms | u64 |
Source
View on GitHubpraisonai/src/trace/mod.rs at line 629