Agent with Tools
Give a Vertex AI Claude agent a web search tool and let Agno run the tool-use loop.
Attach WebSearchTools to a Vertex AI Claude agent to answer questions with current web results.
Code
from agno.agent import Agent
from agno.models.vertexai.claude import Claude
from agno.tools.websearch import WebSearchTools
agent = Agent(
model=Claude(id="claude-sonnet-4-6"),
tools=[WebSearchTools()],
markdown=True,
)
agent.print_response("Whats happening in France?")Usage
Complete the Vertex project, model enablement, permissions, and CLI prerequisites first. Use a region that serves Sonnet 4.6.
Set up your virtual environment
uv venv --python 3.12
source .venv/bin/activateSet your environment variables
export CLOUD_ML_REGION="us-east5"
export GOOGLE_CLOUD_PROJECT=xxxAuthenticate your CLI session
gcloud auth application-default loginYou don't need to authenticate your CLI every time.
Install dependencies
uv pip install -U 'anthropic[vertex]' ddgs agnoRun Agent
Save the code above as tool_use.py, then run:
python tool_use.py