Skip to main content
The Google Trends tool lets an agent pull trending-topic data through the SerpAPI Google Trends endpoint.

Overview

The Google Trends tool is a tool that allows you to search the web using the Google Trends API.
pip install langchain-community google-search-results
export SERPAPI_API_KEY="${SERPAPI_API_KEY:?Set SERPAPI_API_KEY in your shell}"
from langchain_community.utilities.google_trends import GoogleTrendsAPIWrapper
from praisonaiagents import Agent, AgentTeam

research_agent = Agent(
    instructions="Research trending topics related to AI",
    tools=[GoogleTrendsAPIWrapper]
)

summarise_agent = Agent(
    instructions="Summarise findings from the research agent",
)

agents = AgentTeam(agents=[research_agent, summarise_agent])
agents.start()

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

Google Trends here runs through SerpAPI, so set SERPAPI_API_KEY in your shell or .env. Never hard-code the key.
Trends data is per keyword. Feed the agent concrete terms rather than broad phrases so the returned interest data is meaningful.
SerpAPI enforces a monthly search quota. Wrap the call in try/except so the agent can report a clean message when the quota is hit.

Serp Search

SerpAPI search

Google Search

LangChain Google search

Tavily

AI-powered search