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

# Vertex AI Claude Adaptive Thinking

> Use adaptive thinking with effort levels to control reasoning depth on Claude VertexAI.

Cookbook example demonstrating adaptive thinking with output\_config on VertexAI.

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

Cookbook example demonstrating adaptive thinking with output_config on VertexAI.

For Claude 4.6 VertexAI 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)

Prerequisites:
- Set GOOGLE_CLOUD_PROJECT and CLOUD_ML_REGION environment variables
- Authenticate with: gcloud auth application-default login
"""

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

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

agent = Agent(
    model=Claude(
        id="claude-sonnet-4-6@20250514",
        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

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

  <Step title="Install dependencies">
    ```bash theme={null}
    uv pip install -U agno "anthropic[vertex]"
    ```
  </Step>

  <Step title="Export environment variables">
    <CodeGroup>
      ```bash Mac/Linux theme={null}
      export ANTHROPIC_VERTEX_PROJECT_ID="your_anthropic_vertex_project_id_here"
      export CLOUD_ML_REGION="your_cloud_ml_region_here"
      ```

      ```bash Windows theme={null}
      $Env:ANTHROPIC_VERTEX_PROJECT_ID="your_anthropic_vertex_project_id_here"
      $Env:CLOUD_ML_REGION="your_cloud_ml_region_here"
      ```
    </CodeGroup>
  </Step>

  <Step title="Authenticate with Google Cloud">
    Sign in with Application Default Credentials:

    ```bash theme={null}
    gcloud auth application-default login
    ```
  </Step>

  <Step title="Run the example">
    Save the code above as `adaptive_thinking.py`, then run:

    ```bash theme={null}
    python adaptive_thinking.py
    ```
  </Step>
</Steps>

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