pub struct TrajectoryRecorder { /* private fields */ }Expand description
Recorder for tracking agent execution trajectory
Implementations§
Source§impl TrajectoryRecorder
impl TrajectoryRecorder
Sourcepub fn new(agent_name: impl Into<String>, task_id: impl Into<String>) -> Self
pub fn new(agent_name: impl Into<String>, task_id: impl Into<String>) -> Self
Create a new trajectory recorder
Sourcepub fn with_metadata(self, metadata: Value) -> Self
pub fn with_metadata(self, metadata: Value) -> Self
Set metadata for the trajectory
Sourcepub fn start_step(&mut self)
pub fn start_step(&mut self)
Start timing a new step
Sourcepub fn record_llm_call(
&mut self,
model: &str,
tokens_in: Option<u32>,
tokens_out: Option<u32>,
)
pub fn record_llm_call( &mut self, model: &str, tokens_in: Option<u32>, tokens_out: Option<u32>, )
Record an LLM call
Sourcepub fn record_llm_failure(&mut self, model: &str, error: &str)
pub fn record_llm_failure(&mut self, model: &str, error: &str)
Record an LLM call failure
Sourcepub fn record_tool_call(
&mut self,
tool_name: &str,
arguments: &str,
success: bool,
error: Option<&str>,
)
pub fn record_tool_call( &mut self, tool_name: &str, arguments: &str, success: bool, error: Option<&str>, )
Record a tool call
Sourcepub fn record_handoff(&mut self, target_agent: &str, reason: &str)
pub fn record_handoff(&mut self, target_agent: &str, reason: &str)
Record a handoff to another agent
Sourcepub fn record_planning(&mut self, plan_steps: usize, goal: &str)
pub fn record_planning(&mut self, plan_steps: usize, goal: &str)
Record a planning step
Sourcepub fn record_memory(&mut self, operation: &str, key: &str, success: bool)
pub fn record_memory(&mut self, operation: &str, key: &str, success: bool)
Record a memory operation
Sourcepub fn record_custom(
&mut self,
step_type: StepType,
details: Value,
success: bool,
error: Option<&str>,
)
pub fn record_custom( &mut self, step_type: StepType, details: Value, success: bool, error: Option<&str>, )
Record a custom step
Sourcepub fn complete(self, result_preview: &str) -> Trajectory
pub fn complete(self, result_preview: &str) -> Trajectory
Complete the task successfully
Sourcepub fn fail(self, error: &str) -> Trajectory
pub fn fail(self, error: &str) -> Trajectory
Fail the task
Sourcepub fn step_count(&self) -> usize
pub fn step_count(&self) -> usize
Get current step count
Sourcepub fn elapsed_ms(&self) -> u64
pub fn elapsed_ms(&self) -> u64
Get elapsed time since start
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TrajectoryRecorder
impl RefUnwindSafe for TrajectoryRecorder
impl Send for TrajectoryRecorder
impl Sync for TrajectoryRecorder
impl Unpin for TrajectoryRecorder
impl UnsafeUnpin for TrajectoryRecorder
impl UnwindSafe for TrajectoryRecorder
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more