Install & Compatibility
Where this runs
tested against v0.2.18 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 2.570s · 84.2MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 11.4s · import 2.446s · 94MB
95MB installed
● package 95MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
TavilySearch
✓ from langchain_tavily import TavilySearch
TavilyExtract
✓ from langchain_tavily import TavilyExtract
TavilyMap
✓ from langchain_tavily import TavilyMap
TavilyCrawl
✓ from langchain_tavily import TavilyCrawl
TavilyResearch
✓ from langchain_tavily import TavilyResearch
TavilySearchResults
✓ from langchain_tavily import TavilySearchResults
✗ from langchain_community.tools.tavily_search import TavilySearchResults
The `langchain_community.tools.tavily_search.TavilySearchResults` import is deprecated. Migrate to `langchain_tavily` for the latest features and updates.
This quickstart demonstrates how to instantiate and use the `TavilySearch` tool to perform a web search. It highlights the importance of setting the `TAVILY_API_KEY` and how to invoke the tool with a natural language query to get structured results.
import os
from langchain_tavily import TavilySearch
# Set your Tavily API key as an environment variable
# You can get one from https://tavily.com/
# os.environ["TAVILY_API_KEY"] = "your_tavily_api_key"
# Ensure TAVILY_API_KEY is set (using .get for runnable example)
tavily_api_key = os.environ.get("TAVILY_API_KEY", "dummy_key")
# Instantiate the Tavily Search tool
# Parameters like 'max_results' can be set here.
# For a full list of parameters, refer to the documentation.
tool = TavilySearch(max_results=5, topic="general", tavily_api_key=tavily_api_key)
# Invoke the tool with a query
query = "Latest news about AI advancements in healthcare"
results = tool.invoke({"query": query})
print(f"Tavily Search Results for '{query}':")
for i, result in enumerate(results):
print(f"Result {i+1}: {result['title']} - {result['url']}")
# For detailed content, uncomment below (if include_raw_content was enabled at instantiation)
# print(result.get('raw_content', 'No raw content'))
Debug
Known issues
breakingThe `TavilySearchResults` tool previously available under `langchain_community.tools.tavily_search` has been deprecated. Users should migrate to the dedicated `langchain-tavily` package for all Tavily integrations.fixUninstall `langchain-community` if it's only for Tavily. Install `langchain-tavily` (`pip install -U langchain-tavily`). Update import statements from `from langchain_community.tools.tavily_search import TavilySearchResults` to `from langchain_tavily import TavilySearchResults` or other specific Tavily tools.
affects: LangChain versions using `langchain_community` where `TavilySearchResults` was located.
gotchaA `TAVILY_API_KEY` is required for authentication with the Tavily API. This key must be set as an environment variable or passed directly during instantiation.fixObtain an API key from the Tavily website (tavily.com). Set it as an environment variable: `export TAVILY_API_KEY="your_key_here"` or pass it as an argument during class instantiation: `TavilySearch(tavily_api_key="your_key_here")`.
affects: All versions
gotchaSome parameters for `TavilySearch`, such as `include_answer` and `include_raw_content`, cannot be modified during tool invocation. They must be set during the initial instantiation of the `TavilySearch` object.fixEnsure these parameters are configured when creating the `TavilySearch` instance, e.g., `tool = TavilySearch(include_answer=True, include_raw_content=True)`. Attempting to set them in `tool.invoke({'query': ..., 'include_answer': False})` will be ignored or raise an error. affects: All versions
gotchaWhen performing time-sensitive searches (e.g., 'news today'), the default search behavior might not always return the most real-time results, potentially referencing older articles.fixFor highly current results, consider explicitly using `time_range` (e.g., 'day', 'week') or `start_date`/`end_date` parameters during instantiation or invocation, where supported, to narrow down the search window.
affects: All versions
Upgrade
Version history
0.2.18latest on PyPI · released Apr 16, 2026
Audit
Dependencies
langchain-corerequiredCore components for LangChain integrations
langchain-openaioptionalCommonly used with LLM agents (e.g., ChatOpenAI) for agent creation