Understand where the package fits
serpapi-search-tools connects SerpApi search results to Python agent SDKs. It saves you from writing a separate custom-tool wrapper for every kind of search and every SDK.
What it adds to your agent
The package gives you focused tools for general web pages, news, maps, images, shopping, videos, hotels, flights, and destination discovery. Each tool asks for the information needed for that search. For example, web search uses a query, hotel search asks for stay dates, and flight search asks for airports and an outbound date.
Inputs are checked before a request is sent to SerpApi. This helps your agent correct mistakes early and avoids unnecessary failed searches.
How the pieces work together
- SerpApi retrieves current search results and returns structured data.
serpapi-search-toolsturns each search capability into a ready-to-use Python or agent-SDK tool.- Your agent SDK and model decide when to call a tool and how to use the returned results in the final response.
The package does not include a language model or create the agent loop. You continue to configure those through the SDK you already use.
You need a SerpApi account and API key for live searches. Agent examples may also need a separate key for the model provider used by that example.
One constructor for each kind of search
Start with only the tools your agent needs:
from serpapi_search_tools import maps_search, news_search, web_search
tools = [web_search(), news_search(), maps_search()]Separate tools make their purpose and inputs clear. They also let you configure web, news, local, shopping, or travel searches independently as your application grows.
See Choose a search tool for all nine capabilities and their required inputs.
Use an agent SDK or plain Python
When one supported agent SDK is installed, the package detects it and returns tools that can be added to that SDK’s normal tool list. If several supported SDKs are installed, pass provider= to choose one explicitly.
For scripts, tests, or a framework that is not listed, request a callable:
from serpapi_search_tools import web_search
search = web_search(provider="function")
response = search(query="Python packaging")
print(response)Every tool returns compact Markdown by default, including its main result sections and useful web answer sections. result_limit controls how many rows are kept in each result table in compact and full modes. Application code that needs structured fields can opt into SearchResultFormat.JSON. Set mode=SearchResultMode.FULL and result_limit=None when application code needs every response section, field, and returned result.