Skip to main content
The TavilySearch tool lets an agent run AI-optimised web search through the Tavily API.

Overview

The TavilySearch tool is a tool that allows you to search the web using the TavilySearch.
pip install "langchain-community>=0.2.11" tavily-python
export TAVILY_API_KEY="${TAVILY_API_KEY:?Set TAVILY_API_KEY in your shell}"
from praisonaiagents import Agent, AgentTeam
from langchain_community.tools import TavilySearchResults

def search_tool(query: str):
    tool = TavilySearchResults(
        max_results=5,
        search_depth="advanced",
        include_answer=True,
        include_raw_content=True,
        include_images=True
    )
    return tool.run(query)

data_agent = Agent(instructions="I am looking for the top google searches on AI tools of 2025", tools=[search_tool])
editor_agent = Agent(instructions="Analyze the data and rank the tools based on their popularity")

agents = AgentTeam(agents=[data_agent, editor_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

Set TAVILY_API_KEY in your shell or .env. The tool reads it automatically — never hard-code the key.
TavilySearchResults(max_results=5) controls how many hits return. Lower it so the agent processes fewer tokens.
Set include_answer=True when the agent needs a synthesised answer rather than raw links — it saves a follow-up LLM step.

Tavily

Tavily tool (praisonai-tools)

Exa Search

Exa LangChain integration

DuckDuckGo

Privacy-focused search