> For the complete documentation index, see [llms.txt](https://whitepaper.aitech.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://whitepaper.aitech.io/agentforge/tools/serper.md).

# serper

[Serper](https://www.serper.com/) is a Google Search API that provides developers with programmatic access to Google search results. It offers a reliable, high-performance way to integrate Google search capabilities into applications without the complexity of web scraping or the limitations of other search APIs.

With Serper, you can:

* **Access Google search results**: Get structured data from Google search results programmatically
* **Perform different search types**: Run web searches, image searches, news searches, and more
* **Retrieve rich metadata**: Obtain titles, snippets, URLs, and other relevant information from search results
* **Scale your applications**: Build search-powered features with a reliable and fast API
* **Avoid rate limiting**: Get consistent access to search results without worrying about IP blocks

The Agent Forge Serper integration gives your agents the power of web search right in their workflows.

This enables sophisticated automation that requires up-to-date internet information. Your agents can formulate queries, retrieve relevant results, and use this real-time data to make decisions or provide accurate responses.

By connecting Agent Forge with Serper, you bridge the gap between your workflow automation and the vast knowledge of the web, allowing you to create agents that stay current and deliver greater value to users without manual intervention.

### Usage Instructions

Access real-time web search results with Serper's Google Search API integration. Retrieve structured search data including web pages, news, images, and places with customizable language and region settings.

### Where to Get Your Serper API Key

You can obtain your Serper API key directly from the Serper website dashboard after creating a free account.

{% stepper %}
{% step %}

### Sign up or Log in

Navigate to the official [Serper website](https://serper.dev/) and sign up for an account. They offer a free tier that is excellent for starting out.
{% endstep %}

{% step %}

### Access the Dashboard

Once you have successfully logged in, you will be directed to your user dashboard.
{% endstep %}

{% step %}

### Find the API Key Section

Look for the **"API Key"** section in the navigation menu or sidebar.
{% endstep %}

{% step %}

### Copy and Store Your Key

Your unique Serper API key will be displayed on this page.

* **Copy it immediately** and save it in a secure location (such as a password manager or a `.env` file).
* When using the key in your code (especially with tools like LangChain or CrewAI), it should typically be set as an environment variable named **`SERPER_API_KEY`**.
  {% endstep %}
  {% endstepper %}

### Tools

#### `serper_search`

A powerful web search tool that provides access to Google search results through Serper.dev API. Supports different types of searches including regular web search, news, places, and images, with each result containing relevant metadata like titles, URLs, snippets, and type-specific information.

**Input**

| Parameter | Type   | Required | Description                      |
| --------- | ------ | -------- | -------------------------------- |
| `query`   | string | Yes      | The search query                 |
| `num`     | number | No       | Number of results to return      |
| `gl`      | string | No       | Country code for search results  |
| `hl`      | string | No       | Language code for search results |
| `type`    | string | No       | Type of search to perform        |
| `apiKey`  | string | Yes      | Serper API Key                   |

**Output**

| Parameter       | Type | Description         |
| --------------- | ---- | ------------------- |
| `searchResults` | json | Search results data |

### Notes

* Category: `tools`
* Type: `serper`


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://whitepaper.aitech.io/agentforge/tools/serper.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
