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 openai
export SERPER_API_KEY=***

Example

The following agent will search Google for the query: "What's happening in the USA?" and share results.

cookbook/91_tools/serper_tools.py
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

ParameterTypeDefaultDescription
api_keyOptional[str]NoneSerper API key. If not provided, uses the SERPER_API_KEY environment variable.
locationstr"us"Location to search from.
languagestr"en"Language code for search results.
num_resultsint10Default number of results to retrieve.
date_rangeOptional[str]NoneDefault date range filter for searches.
timeoutint30Per-request HTTP timeout in seconds.
enable_searchboolTrueEnable the search functionality.
enable_search_newsboolTrueEnable the search_news functionality.
enable_search_scholarboolTrueEnable the search_scholar functionality.
enable_scrape_webpageboolTrueEnable the scrape_webpage functionality.
allboolFalseEnable all functionality.

Toolkit Functions

FunctionDescription
search_webThis function searches Google for a query.
search_newsThis function searches Google News for a query.
search_scholarThis function searches Google Scholar for a query.
scrape_webpageThis function scrapes a webpage by URL, optionally returning markdown.

Developer Resources