pub struct AgentTrace {
pub events: Vec<TraceEvent>,
pub result: Option<String>,
pub stop_reason: StopReason,
pub duration: Duration,
pub total_tokens: u32,
pub iterations: usize,
pub errors: usize,
pub successful_tool_calls: usize,
}Expand description
Complete execution trace for an agent run
Fields§
§events: Vec<TraceEvent>All events that occurred during execution
result: Option<String>Final result text (if any)
stop_reason: StopReasonReason the agent stopped
duration: DurationTotal execution time
total_tokens: u32Total tokens used
iterations: usizeNumber of iterations
errors: usizeNumber of errors
successful_tool_calls: usizeNumber of successful tool calls
Implementations§
Source§impl AgentTrace
impl AgentTrace
pub fn new() -> Self
Sourcepub fn add_event(&mut self, event: TraceEvent)
pub fn add_event(&mut self, event: TraceEvent)
Add an event to the trace
Sourcepub fn tool_executions(&self) -> Vec<&ToolExecution>
pub fn tool_executions(&self) -> Vec<&ToolExecution>
Get all tool executions from the trace
Sourcepub fn errors_trace(&self) -> Vec<&str>
pub fn errors_trace(&self) -> Vec<&str>
Get all errors from the trace
Sourcepub fn model_responses(&self) -> Vec<&String>
pub fn model_responses(&self) -> Vec<&String>
Get all model responses
Sourcepub fn print_summary(&self)
pub fn print_summary(&self)
Print a human-readable summary
Sourcepub fn print_detailed(&self)
pub fn print_detailed(&self)
Print detailed trace of all events
Trait Implementations§
Source§impl Clone for AgentTrace
impl Clone for AgentTrace
Source§fn clone(&self) -> AgentTrace
fn clone(&self) -> AgentTrace
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for AgentTrace
impl Debug for AgentTrace
Source§impl Default for AgentTrace
impl Default for AgentTrace
Source§impl<'de> Deserialize<'de> for AgentTrace
impl<'de> Deserialize<'de> for AgentTrace
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for AgentTrace
impl RefUnwindSafe for AgentTrace
impl Send for AgentTrace
impl Sync for AgentTrace
impl Unpin for AgentTrace
impl UnwindSafe for AgentTrace
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more