Skip to main content

ThinkingTracker

Defined in the thinking module.
Rust AI Agent SDK Tracks thinking usage across multiple sessions. Provides aggregate statistics and reporting.

Fields

NameTypeDescription
sessionsVec<ThinkingUsage>All tracked sessions
total_tokens_usedusizeTotal tokens used across all sessions
total_time_secondsf64Total time across all sessions

Methods

new

fn new() -> Self
Create a new tracker.

start_session

fn start_session(
        &mut self,
        budget_tokens: usize,
        budget_time: Option<f64>,
        complexity: f64,
    ) -> usize
Start a new thinking session. # Arguments * budget_tokens - Token budget for this session * budget_time - Optional time budget * complexity - Task complexity (0.0 to 1.0) # Returns Index of the new session Parameters:
NameType
budget_tokensusize
budget_timeOption&lt;f64&gt;
complexityf64

end_session

fn end_session(&mut self, session_idx: usize, tokens_used: usize, time_seconds: f64) -> ()
End a thinking session. # Arguments * session_idx - Index of the session to end * tokens_used - Actual tokens used * time_seconds - Actual time taken Parameters:
NameType
session_idxusize
tokens_usedusize
time_secondsf64

session_count

fn session_count(&self) -> usize
Get the number of sessions.

average_tokens_per_session

fn average_tokens_per_session(&self) -> f64
Get average tokens per session.

average_time_per_session

fn average_time_per_session(&self) -> f64
Get average time per session.

average_utilization

fn average_utilization(&self) -> f64
Get average budget utilization.

over_budget_count

fn over_budget_count(&self) -> usize
Get number of sessions that went over budget.

get_summary

fn get_summary(&self) -> HashMap<String, serde_json::Value>
Get summary statistics.

clear

fn clear(&mut self) -> ()
Clear all tracking data.

Source

View on GitHub

praisonai/src/thinking/mod.rs at line 389