Thinking Module
The thinking module provides configurable thinking budgets for LLM reasoning, allowing control over token and time budgets for extended thinking.Installation
Features
- Token budgets for extended thinking
- Time budgets for reasoning
- Adaptive budget allocation
- Budget tracking and reporting
Quick Start
Classes
ThinkingBudget
Configure thinking budgets for agents.Constructor
| Parameter | Type | Default | Description |
|---|---|---|---|
max_tokens | int | 8000 | Maximum thinking tokens |
max_time_seconds | int | 30 | Maximum thinking time |
adaptive | bool | False | Adapt budget based on task |
ThinkingConfig
Configuration for thinking behavior.Attributes
| Attribute | Type | Description |
|---|---|---|
enabled | bool | Whether thinking is enabled |
budget | ThinkingBudget | Budget configuration |
show_thinking | bool | Show thinking in output |
ThinkingUsage
Track thinking usage.Attributes
| Attribute | Type | Description |
|---|---|---|
tokens_used | int | Tokens used for thinking |
time_seconds | float | Time spent thinking |
budget_remaining | int | Remaining token budget |
ThinkingTracker
Track thinking across multiple calls.Usage Examples
Basic Thinking Budget
Adaptive Budget
Time-Limited Thinking
Track Usage
Best Practices
- Set appropriate budgets - Balance quality vs. cost
- Use adaptive mode - Let the system optimize for task complexity
- Monitor usage - Track thinking costs over time
- Time limits - Set time limits for time-sensitive applications

