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
Additional Examples
Google Scholar Search
Reviews Search
Web Scraping
Toolkit Params
| 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.). | 
Toolkit Functions
| 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). |