Serper
Search Google, Google News, and Google Scholar, and scrape webpages, with SerperTools via the Serper API.
SerperTools enable an Agent to search Google, Google News, and Google Scholar, and scrape webpages.
Prerequisites
The following example requires the requests and openai libraries and an API key from Serper.
uv pip install -U agno requests openaiexport SERPER_API_KEY=***Example
The following agent will search Google for the query: "What's happening in the USA?" and share results.
from agno.agent import Agent
from agno.tools.serper import SerperTools
agent = Agent(tools=[SerperTools(location="us")])
agent.print_response("What's happening in the USA?", markdown=True)Toolkit Params
| Parameter | Type | Default | Description |
|---|---|---|---|
api_key | Optional[str] | None | Serper API key. If not provided, uses the SERPER_API_KEY environment variable. |
location | str | "us" | Location to search from. |
language | str | "en" | Language code for search results. |
num_results | int | 10 | Default number of results to retrieve. |
date_range | Optional[str] | None | Default date range filter for searches. |
timeout | int | 30 | Per-request HTTP timeout in seconds. |
enable_search | bool | True | Enable the search functionality. |
enable_search_news | bool | True | Enable the search_news functionality. |
enable_search_scholar | bool | True | Enable the search_scholar functionality. |
enable_scrape_webpage | bool | True | Enable the scrape_webpage functionality. |
all | bool | False | Enable all functionality. |
Toolkit Functions
| Function | Description |
|---|---|
search_web | This function searches Google for a query. |
search_news | This function searches Google News for a query. |
search_scholar | This function searches Google Scholar for a query. |
scrape_webpage | This function scrapes a webpage by URL, optionally returning markdown. |