Thinking Tracker • Rust AI Agent SDK
ThinkingTracker: Tracks thinking usage across multiple sessions. Provides aggregate statistics and reporting.
ThinkingTracker
Defined in the thinking module.
Rust AI Agent SDK
Tracks thinking usage across multiple sessions. Provides aggregate statistics and reporting.
Fields
| Name | Type | Description |
|---|---|---|
sessions | Vec<ThinkingUsage> | All tracked sessions |
total_tokens_used | usize | Total tokens used across all sessions |
total_time_seconds | f64 | Total time across all sessions |
Methods
new
fn new() -> SelfCreate a new tracker.
start_session
fn start_session(
&mut self,
budget_tokens: usize,
budget_time: Option<f64>,
complexity: f64,
) -> usizeStart 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:
| Name | Type |
|---|---|
budget_tokens | usize |
budget_time | Option<f64> |
complexity | f64 |
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:
| Name | Type |
|---|---|
session_idx | usize |
tokens_used | usize |
time_seconds | f64 |
session_count
fn session_count(&self) -> usizeGet the number of sessions.
average_tokens_per_session
fn average_tokens_per_session(&self) -> f64Get average tokens per session.
average_time_per_session
fn average_time_per_session(&self) -> f64Get average time per session.
average_utilization
fn average_utilization(&self) -> f64Get average budget utilization.
over_budget_count
fn over_budget_count(&self) -> usizeGet 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 GitHubpraisonai/src/thinking/mod.rs at line 389