A sample usage of Claude Agent SDK with SerpApi. See how to connect your AI agent to live web search results.
- Claude Agent SDK: An SDK provided by Anthropic team to create agent programmatically
- SerpApi: A simple API to access search engine results that you can use either for any application or specifically for AI/LLM.
Create env setup (one time only):
python3 -m venv path/to/venv
Activate the env
source path/to/venv/bin/activate
Run the code
python $filename.py
- Agent File (for testing only) -
agent-basic-file.py - Native web search -
agent-native-websearch.py# Not optimal result - Custom tool (SerpApi - one tool) -
agent-serpapi-flight.py - Custom tool (SerpApi - multiple tools) -
agent-serpapi-travel.py - Multi turn conversation with agent travel -
agent-serpapi-travel-with-session.py - Connect MCP - Server SerpApi -
agent-serpapi-mcp.py - Connect Claude skills - SerpApi -
agent-serpapi-skill.py
- Blog post: Claude Agent SDK tutorial
- Video tutorial (coming soon..)