Tavily — Search API Built for AI Agents & RAG
Search API designed specifically for AI agents and RAG pipelines. Returns clean, LLM-ready results with content extraction, no HTML parsing needed. Official MCP server available. 5,000+ stars.
What it is
Tavily is a search API built specifically for AI agents and RAG pipelines. Unlike Google or Bing APIs that return HTML snippets requiring parsing, Tavily returns clean, LLM-ready text with source attribution. It includes an official MCP server, Python and JavaScript SDKs, and integrations with LangChain, LlamaIndex, and CrewAI.
Tavily targets developers building AI agents that need real-time web knowledge. It works with Claude Code, Cursor, and any MCP client.
How it saves time or tokens
Traditional search APIs return HTML snippets filled with tags, navigation elements, and boilerplate that waste tokens. Tavily extracts and returns only the relevant content, reducing token consumption per search result. The built-in content extraction eliminates the need for a separate scraping step. Source quality filtering ensures results are relevant rather than SEO-optimized filler. At an estimated 2,600 tokens per workflow, Tavily keeps search costs predictable.
How to use
- Add the Tavily MCP server to your configuration:
{
"mcpServers": {
"tavily": {
"command": "npx",
"args": ["-y", "tavily-mcp"],
"env": {
"TAVILY_API_KEY": "tvly-your-key"
}
}
}
}
- Get your free API key at tavily.com (1,000 free searches per month).
- Or use the Python SDK directly:
from tavily import TavilyClient
client = TavilyClient(api_key='tvly-your-key')
results = client.search(
query='best practices for deploying Claude Code in enterprise',
search_depth='advanced',
max_results=5
)
for result in results['results']:
print(f'{result["title"]}: {result["content"][:200]}')
Example
Using Tavily with LangChain for a RAG agent:
from langchain_community.tools.tavily_search import TavilySearchResults
from langchain.agents import create_react_agent
search = TavilySearchResults(max_results=3)
# Agent uses Tavily to answer questions with real-time web data
# Results come back as clean text, ready for the LLM context
agent = create_react_agent(
llm=llm,
tools=[search],
prompt=prompt
)
result = agent.invoke({'input': 'What are the latest MCP server releases?'})
Related on TokRepo
- AI tools for research — More search and research tools for AI workflows.
- RAG tools — Browse retrieval-augmented generation tools on TokRepo.
Common pitfalls
- Using the basic search depth when you need comprehensive answers misses important sources. Use search_depth='advanced' for complex queries.
- Not setting max_results leads to excessive API consumption. Start with 3-5 results per query and increase only if needed.
- Relying solely on Tavily for factual claims without verifying sources. Always check the source URLs for critical information.
Frequently Asked Questions
Google Search API returns HTML snippets that require parsing and scraping. Tavily returns clean text with source attribution, ready for LLM consumption. Tavily also filters for source quality and relevance. Pricing: Tavily offers 1,000 free searches per month.
Yes. Tavily provides an official MCP server that integrates with Claude Code, Cursor, and any MCP-compatible client. Install with npx -y tavily-mcp and configure your API key.
Tavily integrates with LangChain, LlamaIndex, CrewAI, and any framework via the REST API. Python and JavaScript SDKs are available for direct integration.
Yes. Tavily provides 1,000 free searches per month. This is sufficient for development and testing. Paid plans offer higher limits and advanced features.
Tavily returns clean text content with titles, URLs, and relevance scores. For structured data extraction from specific pages, combine Tavily search with a scraping tool like Firecrawl.
Citations (3)
- Tavily GitHub— Tavily search API for AI agents
- Tavily Documentation— Tavily MCP server for Claude Code
- LangChain Documentation— LangChain Tavily integration