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

# Vertex AI Basic With Timeout

> Set a five-second request timeout on Claude Sonnet 4 running on Vertex AI.

```python basic_with_timeout.py theme={null}
"""
Vertexai Basic With Timeout
===========================

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

from agno.agent import Agent, RunOutput  # noqa
from agno.models.vertexai.claude import Claude

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

agent = Agent(model=Claude(id="claude-sonnet-4@20250514", timeout=5), markdown=True)

agent.print_response("Share a 2 sentence horror story")

# ---------------------------------------------------------------------------
# Run Agent
# ---------------------------------------------------------------------------

if __name__ == "__main__":
    pass
```

## 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 `basic_with_timeout.py`, then run:

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

Full source: [cookbook/90\_models/vertexai/claude/basic\_with\_timeout.py](https://github.com/agno-agi/agno/blob/v2.7.4/cookbook/90_models/vertexai/claude/basic_with_timeout.py)
