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

NameTypeDescription
sinkBox<dyn ContextTraceSinkProtocol>–

Methods

new

rust
fn new(sink: impl ContextTraceSinkProtocol + 'static) -> Self

Create with a specific sink.

Parameters:

NameType
sinkimpl ContextTraceSinkProtocol + 'static

noop

rust
fn noop() -> Self

Create with no-op sink (zero overhead).

with_list_sink

rust
fn with_list_sink() -> Self

Create with list sink.

emit

rust
fn emit(&mut self, event: ContextEvent) -> ()

Emit an event.

Parameters:

NameType
eventContextEvent

events

rust
fn events(&self) -> &[ContextEvent]

Get events.

clear

rust
fn clear(&mut self) -> ()

Clear events.

agent_start

rust
fn agent_start(&mut self, agent_id: &str, agent_name: &str, input: &str) -> ()

Emit agent start event.

Parameters:

NameType
agent_id&str
agent_name&str
input&str

agent_end

rust
fn agent_end(&mut self, agent_id: &str, agent_name: &str, output: &str, duration_ms: u64) -> ()

Emit agent end event.

Parameters:

NameType
agent_id&str
agent_name&str
output&str
duration_msu64

tool_start

rust
fn tool_start(&mut self, tool_name: &str, args: serde_json::Value) -> ()

Emit tool start event.

Parameters:

NameType
tool_name&str
argsserde_json::Value

tool_end

rust
fn tool_end(&mut self, tool_name: &str, result: serde_json::Value, duration_ms: u64) -> ()

Emit tool end event.

Parameters:

NameType
tool_name&str
resultserde_json::Value
duration_msu64

Source

View on GitHub

praisonai/src/trace/mod.rs at line 629


Related Documentation