Agent with Tools
Give a Claude agent a web search tool and let Agno execute the tool-use loop.
Attach WebSearchTools to an agent to answer a question with current web results.
Code
from agno.agent import Agent
from agno.models.anthropic import Claude
from agno.tools.websearch import WebSearchTools
agent = Agent(
model=Claude(id="claude-sonnet-4-6"),
tools=[WebSearchTools()],
markdown=True,
)
if __name__ == "__main__":
agent.print_response("What are the latest developments in fusion energy?")Agno converts each function into Anthropic's name, description, and input_schema tool shape. It executes returned tool_use blocks and sends the matching tool_result blocks back to Claude.
Anthropic tool selection remains automatic because the Claude adapter does not send Agent.tool_choice in the request.
Usage
Set up your virtual environment
uv venv --python 3.12
source .venv/bin/activateInstall dependencies
uv pip install -U "agno[anthropic,ddg]"Export your Anthropic API key
export ANTHROPIC_API_KEY="your_anthropic_api_key_here"Run the agent
Save the code above as tool_use.py, then run:
python tool_use.py