Web Fetch
Code
1from kern.agent import Agent2from kern.models.anthropic import Claude34agent = Agent(5 model=Claude(6 id="claude-opus-4-1-20250805",7 betas=["web-fetch-2025-09-10"],8 ),9 tools=[10 {11 "type": "web_fetch_20250910",12 "name": "web_fetch",13 "max_uses": 5,14 }15 ],16 markdown=True,17)1819agent.print_response(20 "Tell me more about https://en.wikipedia.org/wiki/Glacier_National_Park_(U.S.)",21 stream=True,22)Usage
Set up your virtual environment
1uv venv --python 3.122source .venv/bin/activate1uv venv --python 3.122.venv\Scripts\activateSet your API key
1export ANTHROPIC_API_KEY=xxxInstall dependencies
1uv pip install -U anthropic kern-aiRun Agent
1python cookbook/11_models/anthropic/web_fetch.py