Add live search to your Python agent
serpapi-search-tools gives Python agents current web and specialized search through SerpApi. Add only the capabilities your agent needs—such as web, news, maps, shopping, hotels, or flights—and use them with your existing agent SDK or as normal Python functions.
Supported agent SDKs
The package works with OpenAI Agents SDK, Pydantic AI, LangChain, LangGraph, CrewAI, LlamaIndex, Claude Agent SDK, Microsoft Agent Framework, AutoGen, Haystack, Semantic Kernel, Agno, smolagents, and Google ADK. When one supported SDK family is installed, the package detects it automatically. See Agent SDKs for version details and a complete example for each SDK.
You can also use every search tool without an agent SDK by choosing provider="function".
Install
If your agent SDK is already installed, add the base package:
pip install serpapi-search-toolsIf you want the package to install an agent SDK too, use its extra. For OpenAI Agents SDK:
pip install "serpapi-search-tools[openai-agents]"Set your SerpApi key before running a search:
export SERPAPI_API_KEY="your-serpapi-key"Try it with OpenAI Agents SDK
This example gives one agent both general web search and current-news search:
from agents import Agent, Runner
from serpapi_search_tools import news_search, web_search
agent = Agent(
name="research-assistant",
instructions="Use search when the answer needs current information.",
tools=[web_search(), news_search()],
)
result = Runner.run_sync(
agent,
"Find three recent Python packaging changes and explain why they matter.",
)
print(result.final_output)With only OpenAI Agents SDK installed, web_search() and news_search() are detected and created in the right format automatically. If your environment contains several supported SDKs, select one explicitly—for example, web_search(provider="openai-agents").
Choose the right search capability
| Your agent needs | Start with |
|---|---|
| General websites and background research | web_search |
| Current reporting | news_search |
| Places and local businesses | maps_search |
| Images and source pages | images_search |
| Products and marketplace listings | shopping_search |
| YouTube videos, channels, and playlists | videos_search |
| Hotel availability for known dates | hotels_search |
| Flights for a known route and date | flights_search |
| Destination ideas from a departure point | travel_explore_search |
Continue from here
- Follow the Quickstart for setup, keys, a first agent, customization, and troubleshooting.
- Read the Introduction to understand what the package handles and how it fits into an agent application.
- Open Agent SDK examples for copy-ready code for your framework.
- Browse Recipes for research, local discovery, shopping, and travel combinations.