> ## Documentation Index
> Fetch the complete documentation index at: https://agno-v2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Anthropic Adaptive Thinking

> Let Claude 4.6 decide its own thinking depth with thinking={"type": "adaptive"} and an effort level.

Cookbook example demonstrating adaptive thinking with output\_config.

```python adaptive_thinking.py theme={null}
"""
Anthropic Adaptive Thinking
===========================

Cookbook example demonstrating adaptive thinking with output_config.

For Claude 4.6 models, use adaptive thinking with the effort parameter
to control thinking depth. Valid effort values:
- "low": Most efficient, significant token savings
- "medium": Balanced approach with moderate savings
- "high": Default, high capability for complex reasoning
- "max": Absolute maximum capability (Opus 4.6 only)
"""

from agno.agent import Agent
from agno.models.anthropic import Claude

# ---------------------------------------------------------------------------
# Create Agent with Adaptive Thinking
# ---------------------------------------------------------------------------

agent = Agent(
    model=Claude(
        id="claude-sonnet-4-6",
        max_tokens=4096,
        thinking={"type": "adaptive"},
        output_config={"effort": "high"},
    ),
    markdown=True,
)

# ---------------------------------------------------------------------------
# Run Agent
# ---------------------------------------------------------------------------
if __name__ == "__main__":
    # Complex reasoning task that benefits from extended thinking
    agent.print_response(
        "Explain the key differences between recursion and iteration, "
        "and when you would choose one over the other in software development."
    )

    # With streaming
    agent.print_response(
        "What are the trade-offs between microservices and monolithic architectures?",
        stream=True,
    )
```

## Run the Example

<Snippet file="create-venv-step.mdx" />

**1. Install dependencies**

```bash theme={null}
uv pip install -U agno anthropic
```

**2. Export your Anthropic API key**

```bash Mac/Linux theme={null}
export ANTHROPIC_API_KEY="your_anthropic_api_key_here"
```

```bash Windows theme={null}
$Env:ANTHROPIC_API_KEY="your_anthropic_api_key_here"
```

**3. Run the example**

Save the code above as `adaptive_thinking.py`, then run:

```bash theme={null}
python adaptive_thinking.py
```

Full source: [cookbook/90\_models/anthropic/adaptive\_thinking.py](https://github.com/agno-agi/agno/blob/v3.0.4/cookbook/90_models/anthropic/adaptive_thinking.py)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.