Prerequisites
The following example requires an API key from Serper.Example
The following agent will search for the latest news about artificial intelligence developments:cookbook/tools/serper_tools.py
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
You are viewing v1 docs. For the latest documentation, visit docs.agno.com
export SERPER_API_KEY=***
from agno.agent import Agent
from agno.tools.serper import SerperTools
agent = Agent(
tools=[SerperTools()],
show_tool_calls=True,
)
agent.print_response(
"Search for the latest news about artificial intelligence developments",
markdown=True,
)
agent.print_response(
"Find 2 recent academic papers about large language model safety and alignment",
markdown=True,
)
agent.print_response(
"Use this Google Place ID: ChIJ_Yjh6Za1j4AR8IgGUZGDDTs and analyze the reviews",
markdown=True
)
agent.print_response(
"Scrape and summarize the main content from this OpenAI blog post: https://openai.com/index/gpt-4/",
markdown=True
)
| Parameter | Type | Default | Description |
|---|---|---|---|
api_key | Optional[str] | None | API key for authentication. |
country | str | "us" | Country code for search results (e.g., “us”, “uk”). |
location | Optional[str] | None | Google location code for search results. |
language | str | "en" | Language code for search results (e.g., “en”, “es”). |
num_results | int | 10 | Default number of search results to retrieve. |
date_range | Optional[str] | None | Default date range filter for searches. |
sort_reviews_by | Optional[str] | "mostRelevant" | Sort order for reviews search (“mostRelevant”, “newest”, etc.). |
| Function | Description |
|---|---|
search | Searches Google for a query. Parameters: query (str), optional num_results (int). |
search_news | Searches for news articles. Parameters: query (str), optional num_results (int). |
search_scholar | Searches Google Scholar for academic papers. Parameters: query (str), optional num_results (int). |
search_reviews | Searches for reviews using place identifiers. Parameters: optional place_id, cid, fid, or topic_id (str). |
scrape_webpage | Scrapes content from a webpage. Parameters: url (str), optional markdown (bool). |
Was this page helpful?