Skip to main content
Tavily is an AI-powered search engine that gives agents high-quality results with built-in answer synthesis.

Overview

Tavily is an AI-powered search engine optimized for LLMs and AI agents. It provides high-quality, relevant search results with built-in answer synthesis.

Installation

Environment Variables

Get your API key from Tavily.

How It Works

Quick Start

1

Simple Usage

2

With Configuration

Use the same tool with an agent — see Usage with Agent below, or pass env vars and options from the sections above.

Usage with Agent

Available Methods

search(query, max_results=5)

Search the web with AI-powered results.

search_context(query)

Get search context optimized for RAG applications.

extract(urls)

Extract content from specific URLs.

Configuration Options

Function-Based Usage

CLI Usage

Error Handling

Common Errors

Best Practices

TavilyTool() defaults to the TAVILY_API_KEY env var. Set it in your shell or .env rather than passing api_key= inline.
search_context(query) returns text optimised for LLM consumption. Prefer it over raw search when feeding results straight into the agent.
search_depth="advanced" returns richer results at higher latency. Use "basic" for quick lookups to keep the agent responsive.

Exa Search

Neural search engine

DuckDuckGo

Privacy-focused search

Serper

Google search API