> ## Documentation Index
> Fetch the complete documentation index at: https://agno-v2-docs-scavio-google-v2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 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](https://serper.dev/).

```shell theme={null}
uv pip install -U requests openai
```

```shell theme={null}
export SERPER_API_KEY=***
```

## Example

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

```python cookbook/91_tools/serper_tools.py theme={null}
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. |

## Developer Resources

* [Tools](https://github.com/agno-agi/agno/blob/main/libs/agno/agno/tools/serper.py)
