Quick Use
- Sign up at tavily.com → copy API key
pip install tavily-python(ornpm install @tavily/core)client.search(query=..., include_answer=True)returns LLM-ready snippets
Intro
Tavily Search is the search API designed for AI agents and RAG. Unlike Google Custom Search or Bing API, Tavily returns curated content snippets ready to feed an LLM — not a list of URLs to scrape. Optional include_answer gives a generated synthesis. Best for: AI agents that need fresh facts, citations, real-time info. Works with: Tavily REST API, Python / TypeScript SDK, MCP server. Setup time: 2 minutes.
Hello world
from tavily import TavilyClient
client = TavilyClient(api_key=os.environ["TAVILY_API_KEY"])
response = client.search(
query="What is the latest version of Python?",
search_depth="advanced",
include_answer=True,
include_raw_content=False,
max_results=5,
)
print(response["answer"])
# "As of October 2024, the latest stable version of Python is 3.13.0..."
for r in response["results"]:
print(f"{r['title']} — {r['url']}")
print(r["content"][:200])Search depth
| Mode | Use | Cost |
|---|---|---|
basic |
Quick fact lookups | 1 credit |
advanced |
Multi-source research, RAG | 2 credits |
Advanced mode crawls more sources and runs a rerank pass — better for answer quality, slightly higher latency and cost.
Filter by domain
# Whitelist
response = client.search(
query="Latest LangChain release notes",
include_domains=["python.langchain.com", "github.com"],
)
# Blacklist
response = client.search(
query="Best vector databases",
exclude_domains=["medium.com"], # avoid SEO blogspam
)As MCP
{
"mcpServers": {
"tavily": {
"command": "npx",
"args": ["-y", "tavily-mcp"],
"env": { "TAVILY_API_KEY": "tvly-..." }
}
}
}Now Claude Code / Cursor can call tavily_search, tavily_extract, tavily_crawl directly.
FAQ
Q: Is Tavily free? A: Yes — free tier 1,000 API credits/month, no credit card needed. Paid plans add higher quotas and team features. Pricing on tavily.com.
Q: How is Tavily different from Google search via SerpAPI? A: SerpAPI returns Google's HTML organic results — you scrape and clean. Tavily already runs the cleaning, ranking, and (optionally) synthesis. Tavily is purpose-built for LLM consumption; SerpAPI is purpose-built for SERP scraping.
Q: Can I use Tavily with LangChain?
A: Yes — langchain_community.tools.tavily_search.TavilySearchResults is a built-in LangChain tool. Same for LlamaIndex, CrewAI, Pydantic AI.
Source & Thanks
Built by Tavily. Commercial product with free tier.
tavily-ai/tavily-python — ⭐ Active