Tavily Python Wrapper
Welcome to the official Python wrapper for the Tavily API.
The Tavily Python SDK (tavily-python) provides a robust, seamless interface to interact with the Tavily API. Built specifically for Large Language Models (LLMs) and AI agents, Tavily bypasses the limitations of traditional search engines by providing clean, parsed, and highly relevant context. Whether you are building an autonomous research agent, a dynamic Retrieval-Augmented Generation (RAG) pipeline, or a simple Q&A bot, this SDK gives you the tools to ground your AI in real-time web data.
Why Tavily?
Traditional search APIs (like Google or Bing) return a list of blue links, requiring you to scrape, clean, and chunk the HTML yourself before an LLM can understand it. Tavily solves this by returning context that is already optimized for AI ingestion.
- LLM-Optimized: Returns clean markdown or text, stripping out ads, boilerplate, and tracking scripts.
- Fact-Based: Prioritizes high-quality, trustworthy sources to minimize LLM hallucinations.
- Comprehensive Tooling: Goes beyond basic search to offer deep crawling, site mapping, and autonomous multi-step research.
Key Capabilities
The SDK is divided into several core functionalities, accessible via a unified client:
- Search: The core engine. Query the web and receive pre-processed, highly relevant context snippets or full raw page content. Supports advanced filtering by date, domain, and topic.
- Extract: Target specific URLs to scrape. Pass a list of links and receive clean, LLM-ready text or markdown, complete with image extraction capabilities.
- Crawl & Map: Traverse entire domains. Crawl allows you to intelligently navigate and extract content across a site based on AI instructions. Map provides a structural blueprint of a website's URLs.
- Research: An autonomous agentic endpoint. Pass a high-level research prompt, and Tavily will perform multiple searches, aggregate data, and return a comprehensive, cited report based on a custom JSON schema.
- Hybrid RAG: A specialized client that merges your internal MongoDB Vector database with live web search, reranking the combined results for unified knowledge retrieval.
- Asynchronous Support: Built from the ground up with
httpx, theAsyncTavilyClientensures your high-throughput applications remain non-blocking.
Intended Audience
This documentation is designed for software engineers, AI developers, and data scientists who want to integrate real-time web knowledge into their Python applications. Familiarity with basic API concepts and Python 3.8+ is assumed.
Getting Help & Community
- Support: If you encounter bugs, rate limits, or unexpected behavior, please email support at [email protected].
- Community: Join our active Developer Community to discuss use cases, share your projects, and stay updated on new feature releases.