Skip to main content
The user describes a research question; the agent calls Tavily search and returns concise findings.
Prerequisites
  • Python 3.10 or higher
  • PraisonAI Agents package installed
  • tavily-python package installed
  • TAVILY_API_KEY environment variable set
Tavily is an AI-powered search API optimized for LLM applications. PraisonAI includes built-in Tavily tools for easy integration.

Quick Start

1

Install and set key

2

Search with agent

Installation

Setup

Built-in Tavily Tool

PraisonAI provides a built-in tavily tool that you can import directly:

Available Functions

Basic Usage

Search with Options

Extract Content from URLs

Crawl Websites

Get Site Map

With PraisonAI Agent

Using TavilyTools Class

For more control, use the TavilyTools class directly:

Async Usage

Search Parameters

Key Points

  • Simple function signature: Tool must accept query: str and return str
  • Environment variable: Set TAVILY_API_KEY before running
  • Agent decides: The LLM decides when to use the tool based on the query
  • Works globally: --query-rewrite works with any PraisonAI command

Best Practices

from praisonaiagents import tavily is the simplest integration - use it unless you need specific parameters.
Use search_depth='basic' for quick lookups and 'advanced' for research needing deeper results.
Set include_answer=True to get a Tavily-generated summary alongside raw search results.
Set topic='news' for current events or topic='finance' for financial queries.

Custom Tools

Build your own agent tools

Tools Overview

Browse PraisonAI tool documentation