> ## 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 Budget • Rust AI Agent SDK

> ThinkingBudget: Budget constraints for extended thinking. Controls how much thinking/reasoning the LLM can do before producing a response.

# ThinkingBudget

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

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

Budget constraints for extended thinking. Controls how much thinking/reasoning the LLM can do before producing a response.

## Fields

| Name                    | Type                        | Description                                  |
| ----------------------- | --------------------------- | -------------------------------------------- |
| `max_tokens`            | `usize`                     | Maximum tokens for thinking                  |
| `max_time_seconds`      | `Option&lt;f64&gt;`         | Maximum time in seconds (optional)           |
| `adaptive`              | `bool`                      | Whether to adapt budget based on complexity  |
| `level`                 | `Option&lt;BudgetLevel&gt;` | Budget level (if using predefined)           |
| `min_tokens`            | `usize`                     | Minimum tokens for adaptive budgeting        |
| `complexity_multiplier` | `f64`                       | Complexity multiplier for adaptive budgeting |

## Methods

### `new`

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

Create a new ThinkingBudget with default values.

### `from_level`

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

Create a budget from a predefined level.

**Parameters:**

| Name    | Type          |
| ------- | ------------- |
| `level` | `BudgetLevel` |

### `minimal`

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

Create a minimal budget.

### `low`

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

Create a low budget.

### `medium`

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

Create a medium budget.

### `high`

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

Create a high budget.

### `maximum`

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

Create a maximum budget.

### `get_tokens_for_complexity`

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

Get token budget based on task complexity. # Arguments \* `complexity` - Complexity score (0.0 to 1.0) # Returns Adjusted token budget

**Parameters:**

| Name         | Type  |
| ------------ | ----- |
| `complexity` | `f64` |

### `to_map`

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

Convert to HashMap for serialization.

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-rust/praisonai/src/thinking/mod.rs#L80">
  `praisonai/src/thinking/mod.rs` at line 80
</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" />

  <Card title="Rust Budget" icon="wallet" href="/docs/rust/budget" />

  <Card title="Rust Token Management" icon="coins" href="/docs/rust/token-management" />
</CardGroup>
