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

# Vertex AI Thinking

> Enable extended thinking with a 1024-token budget on Claude Sonnet 4 via Vertex AI.

```python thinking.py theme={null}
"""
Vertexai Thinking
=================

Cookbook example for `vertexai/claude/thinking.py`.
"""

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

# ---------------------------------------------------------------------------
# Create Agent
# ---------------------------------------------------------------------------

agent = Agent(
    model=Claude(
        id="claude-sonnet-4@20250514",
        max_tokens=2048,
        thinking={"type": "enabled", "budget_tokens": 1024},
    ),
    markdown=True,
)

# Print the response in the terminal

# ---------------------------------------------------------------------------
# Run Agent
# ---------------------------------------------------------------------------
if __name__ == "__main__":
    # --- Sync ---
    agent.print_response("Share a very scary 2 sentence horror story")

    # --- Sync + Streaming ---
    agent.print_response("Share a very scary 2 sentence horror story", stream=True)
```

## Run the Example

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

**1. Install dependencies**

```bash theme={null}
uv pip install -U agno "anthropic[vertex]"
```

**2. Export environment variables**

```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"
```

**3. Authenticate with Google Cloud**

Sign in with Application Default Credentials:

```bash theme={null}
gcloud auth application-default login
```

**4. Run the example**

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

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

Full source: [cookbook/90\_models/vertexai/claude/thinking.py](https://github.com/agno-agi/agno/blob/v3.0.4/cookbook/90_models/vertexai/claude/thinking.py)


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