Skip to main content
Attach WebSearchTools to an agent to answer a question with current web results.

Code

tool_use.py
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.
Agno 2.7.2 leaves Anthropic tool selection automatic because the adapter omits Agent.tool_choice from the request.

Usage

1

Set up your virtual environment

2

Install dependencies

3

Export your Anthropic API key

4

Run the agent

Save the code above as tool_use.py, then run:

Developer Resources