Skip to main content
SearchApiTools enable an Agent to search Google, Google News, Google Images, and YouTube.

Prerequisites

The following example requires the requests and openai libraries and an API key from SearchAPI.io.
uv pip install -U requests openai
export SEARCHAPI_API_KEY=***

Example

The following agent will search Google for the latest AI developments.
cookbook/91_tools/searchapi_tools.py
from agno.agent import Agent
from agno.tools.searchapi import SearchApiTools

agent = Agent(tools=[SearchApiTools()])
agent.print_response("What are the latest developments in AI agents?", markdown=True)

Toolkit Params

ParameterTypeDefaultDescription
api_keyOptional[str]NoneSearchAPI key. If not provided, uses SEARCHAPI_API_KEY environment variable.
num_resultsint5Default number of results to return per search.
timeoutint30Request timeout in seconds.
enable_search_googleboolTrueEnable Google web search.
enable_search_newsboolFalseEnable Google News search.
enable_search_imagesboolFalseEnable Google Images search.
enable_search_youtubeboolFalseEnable YouTube search.
allboolFalseEnable all available search functions.

Toolkit Functions

FunctionDescription
search_googleSearch Google. Parameters: query (str), num_results (int), location (str, optional), language (str, optional). Returns organic results, knowledge graph, and related questions.
search_newsSearch Google News. Parameters: query (str), num_results (int), country (str, optional), language (str, optional). Returns news articles with title, source, date, and snippet.
search_imagesSearch Google Images. Parameters: query (str), num_results (int), safe_search (str, optional). Returns image results with title, link, and thumbnail.
search_youtubeSearch YouTube. Parameters: query (str), num_results (int). Returns video results with title, link, channel, length, and views.

Developer Resources