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 module.

Rust AI Agent SDK

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

Fields

NameTypeDescription
max_tokensusizeMaximum tokens for thinking
max_time_secondsOption<f64>Maximum time in seconds (optional)
adaptiveboolWhether to adapt budget based on complexity
levelOption<BudgetLevel>Budget level (if using predefined)
min_tokensusizeMinimum tokens for adaptive budgeting
complexity_multiplierf64Complexity multiplier for adaptive budgeting

Methods

new

rust
fn new() -> ThinkingBudgetBuilder

Create a new ThinkingBudget with default values.

from_level

rust
fn from_level(level: BudgetLevel) -> Self

Create a budget from a predefined level.

Parameters:

NameType
levelBudgetLevel

minimal

rust
fn minimal() -> Self

Create a minimal budget.

low

rust
fn low() -> Self

Create a low budget.

medium

rust
fn medium() -> Self

Create a medium budget.

high

rust
fn high() -> Self

Create a high budget.

maximum

rust
fn maximum() -> Self

Create a maximum budget.

get_tokens_for_complexity

rust
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:

NameType
complexityf64

to_map

rust
fn to_map(&self) -> HashMap<String, serde_json::Value>

Convert to HashMap for serialization.

Source

View on GitHub

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


Related Documentation