Skip to main content
The Serper tool lets an agent fetch structured Google results via the Serper API.

Overview

Serper provides fast, affordable access to Google Search results via API. Get structured search results including web, images, news, and more.

Installation

Environment Variables

Get your API key from Serper.

How It Works

Quick Start

1

Simple Usage

2

With Configuration

Use the same tool with an agent — see Usage with Agent below, or pass env vars and options from the sections above.

Usage with Agent

Available Methods

search(query, num_results=10)

Search Google for web results.

news(query, num_results=10)

Search Google News.

images(query, num_results=10)

Search Google Images.

Configuration Options

Function-Based Usage

CLI Usage

Error Handling

Common Errors

Best Practices

SerperTool() defaults to the SERPER_API_KEY env var. Set it in your shell or .env rather than passing api_key= inline.
search(query, num_results=10) defaults to 10. Lower it so the agent processes fewer tokens and responds faster.
Serper exposes search, news, and images. Route the agent to the endpoint that matches the task to avoid noisy results.

Tavily

AI-powered search

DuckDuckGo

Privacy-focused search

Exa

Neural search