pub struct ExecutionTracker {
pub limits: ExecutionLimits,
pub turns: usize,
pub tokens_used: usize,
pub cost_accumulated: f64,
pub started_at: Instant,
}Expand description
Tracks execution state against limits
Fields§
§limits: ExecutionLimits§turns: usize§tokens_used: usize§cost_accumulated: f64Accumulated dollar cost across all turns. Updated via record_cost().
Only non-zero when AgentLoopConfig.cost_config is set.
started_at: InstantImplementations§
Source§impl ExecutionTracker
impl ExecutionTracker
pub fn new(limits: ExecutionLimits) -> Self
pub fn record_turn(&mut self, tokens: usize)
Sourcepub fn record_cost(&mut self, cost: f64)
pub fn record_cost(&mut self, cost: f64)
Accumulate incremental cost for the current turn.
Sourcepub fn check_limits(&self) -> Option<String>
pub fn check_limits(&self) -> Option<String>
Check if any limit has been exceeded. Returns the reason if so.
Auto Trait Implementations§
impl Freeze for ExecutionTracker
impl RefUnwindSafe for ExecutionTracker
impl Send for ExecutionTracker
impl Sync for ExecutionTracker
impl Unpin for ExecutionTracker
impl UnsafeUnpin for ExecutionTracker
impl UnwindSafe for ExecutionTracker
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