> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Thinking Tracker • Rust AI Agent SDK

> ThinkingTracker: Tracks thinking usage across multiple sessions. Provides aggregate statistics and reporting.

# ThinkingTracker

> Defined in the [**thinking**](../modules/thinking) module.

<Badge color="orange">Rust AI Agent SDK</Badge>

Tracks thinking usage across multiple sessions. Provides aggregate statistics and reporting.

## Fields

| Name                 | Type                       | Description                           |
| -------------------- | -------------------------- | ------------------------------------- |
| `sessions`           | `Vec&lt;ThinkingUsage&gt;` | All tracked sessions                  |
| `total_tokens_used`  | `usize`                    | Total tokens used across all sessions |
| `total_time_seconds` | `f64`                      | Total time across all sessions        |

## Methods

### `new`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn new() -> Self
```

Create a new tracker.

### `start_session`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
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:**

| Name            | Type                |
| --------------- | ------------------- |
| `budget_tokens` | `usize`             |
| `budget_time`   | `Option&lt;f64&gt;` |
| `complexity`    | `f64`               |

### `end_session`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
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`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn session_count(&self) -> usize
```

Get the number of sessions.

### `average_tokens_per_session`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn average_tokens_per_session(&self) -> f64
```

Get average tokens per session.

### `average_time_per_session`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn average_time_per_session(&self) -> f64
```

Get average time per session.

### `average_utilization`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn average_utilization(&self) -> f64
```

Get average budget utilization.

### `over_budget_count`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn over_budget_count(&self) -> usize
```

Get number of sessions that went over budget.

### `get_summary`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn get_summary(&self) -> HashMap<String, serde_json::Value>
```

Get summary statistics.

### `clear`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn clear(&mut self) -> ()
```

Clear all tracking data.

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-rust/praisonai/src/thinking/mod.rs#L389">
  `praisonai/src/thinking/mod.rs` at line 389
</Card>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Rust Thinking" icon="lightbulb" href="/docs/rust/thinking" />

  <Card title="Rust Reasoning" icon="brain" href="/docs/rust/reasoning" />
</CardGroup>
