Tavily’s Search API is a search engine built specifically for AI agents (LLMs), delivering real-time, accurate, and factual results at speed.Documentation Index
Fetch the complete documentation index at: https://langchain-5e9cc07a-preview-cbclea-1779438149-9d7c578.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Integration details
| Class | Package | PY support | Version |
|---|---|---|---|
TavilySearch | @langchain/tavily | ✅ |
Tool features
| Returns artifact | Native async | Return data | Pricing |
|---|---|---|---|
| ❌ | ✅ | title, URL, content snippet, raw_content, answer, images | 1,000 free searches / month |
Setup
The integration lives in the@langchain/tavily package, which you can install as shown below:
Credentials
Set up a Tavily API key and set it as an environment variable namedTAVILY_API_KEY.
Instantiation
The tool accepts various parameters during instantiation:maxResults(optional, number): Maximum number of search results to return. Default is5.topic(optional, string): Category of the search. Can be"general","news", or"finance". Default is"general".includeAnswer(optional, boolean): Include an answer to the original query in the results. Default isfalse.includeRawContent(optional, boolean |"markdown"|"text"): Include cleaned and parsed content of each search result. Default isfalse.includeImages(optional, boolean): Include a list of query-related images in the response. Default isfalse.includeImageDescriptions(optional, boolean): Include descriptive text for each image. Default isfalse.searchDepth(optional, string): Depth of the search, either"basic"or"advanced". Default is"basic".timeRange(optional, string): Time range from the current date to filter results —"day","week","month", or"year". Default isundefined.includeDomains(optional, string[]): Domains to specifically include. Default is[].excludeDomains(optional, string[]): Domains to specifically exclude. Default is[].
Invocation
Invoke directly with args
The Tavily search tool accepts the following arguments during invocation:query(required): A natural language search query.- The following arguments can also be set during invocation:
includeImages,searchDepth,timeRange,includeDomains,excludeDomains. - For reliability and performance reasons, certain parameters that affect response size cannot be modified during invocation:
includeAnswerandincludeRawContent. These limitations prevent unexpected context window issues and ensure consistent results.
Invoke with ToolCall
We can also invoke the tool with a model-generatedToolCall, in which case a ToolMessage will be returned:
Use within an agent
We can use the search tool directly with a LangChain agent by passing it tocreateAgent. The agent can dynamically set parameters like includeDomains, searchDepth, and timeRange as part of its tool call.
In the example below, when we ask the agent to find “What nation hosted Euro 2024? Include only wikipedia sources.” the agent will dynamically set the arguments and invoke the Tavily search tool with { query: "Euro 2024 host nation", includeDomains: ["wikipedia.org"] }.
API reference
For detailed documentation of all Tavily Search API features and configurations head to the API reference: docs.tavily.com/documentation/api-reference/endpoint/searchConnect these docs to Claude, VSCode, and more via MCP for real-time answers.

