Skip to main content
The SerpAPI tool lets an agent search Google and other engines through the SerpAPI service.

Overview

The SerpAPI tool is a tool that allows you to search the web using the SerpAPI.

How It Works

Getting Started

1

Simple Usage

  1. Install dependencies (see Overview above)
  2. Set required API keys in your environment
  3. Run the agent example in Overview
2

With Configuration

Use the same tool with an agent — see the Overview example, or pass env vars from the sections above.

Best Practices

Set SERPAPI_API_KEY in your shell or .env. SerpAPIWrapper reads it automatically — never hard-code the key.
SerpAPI plans cap total searches per month. Cache repeated queries so agents do not exhaust the quota mid-task.
SerpAPI returns an error when the quota is exceeded. Wrap the call in try/except so the agent can fall back to another search tool.

Serp Search

SerpAPI wrapper

Google Search

LangChain Google search

Serper

Google search API