> ## Documentation Index
> Fetch the complete documentation index at: https://docs.phidata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Serpapi

**SerpApiTools** enable an Agent to search Google and YouTube for a query.

## Prerequisites

The following example requires the `google-search-results` library and an API key from [SerpApi](https://serpapi.com/).

```shell theme={null}
pip install -U google-search-results
```

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

## Example

The following agent will search Google for the query: "Whats happening in the USA" and share results.

```python cookbook/tools/serpapi_tools.py theme={null}
from phi.agent import Agent
from phi.tools.serpapi_tools import SerpApiTools

agent = Agent(tools=[SerpApiTools()])
agent.print_response("Whats happening in the USA?", markdown=True)
```

## Toolkit Params

| Parameter        | Type   | Default | Description                                                 |
| ---------------- | ------ | ------- | ----------------------------------------------------------- |
| `api_key`        | `str`  | -       | API key for authentication purposes.                        |
| `search_youtube` | `bool` | `False` | Enables the functionality to search for content on YouTube. |

## Toolkit Functions

| Function         | Description                                |
| ---------------- | ------------------------------------------ |
| `search_google`  | This function searches Google for a query. |
| `search_youtube` | Searches YouTube for a query.              |

## Information

* View on [Github](https://github.com/agno-agi/phidata/blob/main/phi/tools/serpapi_tools.py)
