tavily

A community node for n8n to integrate Tavily API for web search and content extraction.

Package Information

Released: 1 mo ago
Downloads: 14,645 weekly / 36,840 monthly
Latest Version: 0.7.0
Author: Tavily AI

Documentation

@tavily/n8n-nodes-tavily

@tavily/n8n-nodes-tavily is a node for n8n that integrates the Tavily API, enabling powerful web search and content extraction within your no-code automation workflows.

Features

Tavily Search

Tavily Search allows you to query the web with powerful filtering capabilities, including options to refine results by topic, time range, and specific domains to include or exclude. You can choose to retrieve a generated answer, raw content, or even related images, depending on your workflow needs. It also supports different search depths—basic or advanced.

Tavily Extract

Tavily Extract allows you to effortlessly retrieve raw content from a list of websites, making it ideal for data collection, content analysis, and research. You can also combine Tavily Extract with our Search method: first, obtain a list of relevant documents, then perform further processing on selected links to gather additional information and use it as context for your research tasks.

Tavily Crawl

Tavily Crawl allows you to intelligently crawl a website from a starting URL to discover and extract content across multiple pages. Control depth, breadth, and apply filters to tailor your crawl for comprehensive analysis and content aggregation.

Tavily Map

Tavily Map allows you to discover and map out all the URLs within a website starting from a root URL. Unlike Crawl, which extracts content, Map focuses on efficiently building a comprehensive sitemap of a website's structure. This is ideal for understanding site architecture, planning content extraction, or identifying specific pages for further processing.

Tavily Research

Tavily Research performs comprehensive research on a given topic by conducting multiple searches, analyzing sources, and generating a detailed research report. Choose between different models (Mini for targeted research, Pro for comprehensive multi-angle analysis) and customize the output format with citation styles and structured schemas.

Getting a Tavily API Key

  1. Go to the Tavily website and create an account
  2. Navigate to the Tavily dashboard to get your API key

Configuring Credentials in n8n

  1. In your n8n instance, go to the "Credentials" section
  2. Click "Create Credential"
  3. Search for or select "Tavily API"
  4. Enter your Tavily API key in the appropriate field
  5. Save the credential

Usage

Tavily Search

  1. Add the "Tavily" node to your n8n workflow
  2. Connect it to the preceding node in your workflow
  3. Click on 'Search'
  4. In the node's settings:
    • Select your Tavily API
    • Enter your search query
    • Configure any other desired search parameters (topic, search depth, etc.)
  5. Run the workflow to execute the search

Tavily Extract

  1. Add the "Tavily" node to your n8n workflow
  2. Connect it to the preceding node
  3. Click on 'Extract'
  4. In the node's settings:
    • Select your Tavily API credential
    • Enter the URLs you want to extract content from
    • Configure any other extraction parameters (include images, extract depth)
  5. Run the workflow to extract the content

Tavily Crawl

  1. Add the "Tavily" node to your n8n workflow
  2. Connect it to the preceding node
  3. Click on 'Crawl'
  4. In the node's settings:
    • Select your Tavily API credential
    • Enter the root URL to begin the crawl
    • Configure crawl parameters (max depth, limit, etc.)
  5. Run the workflow to crawl the website and extract content

Tavily Map

  1. Add the "Tavily" node to your n8n workflow
  2. Connect it to the preceding node
  3. Click on 'Map'
  4. In the node's settings:
    • Select your Tavily API credential
    • Enter the root URL to begin mapping
    • Configure map parameters (max depth, limit, filters, etc.)
  5. Run the workflow to map the website's URL structure

Tavily Research

Create Research Task

  1. Add the "Tavily" node to your n8n workflow
  2. Connect it to the preceding node
  3. Click on 'Research'
  4. Select 'Create Research Task' operation
  5. In the node's settings:
    • Select your Tavily API credential
    • Enter your research task or question
    • Configure model (Auto, Mini, or Pro) and other options
  6. Run the workflow to initiate the research task
  7. The response will include a request_id to check the status later

Get Research Status

  1. Add the "Tavily" node to your n8n workflow
  2. Connect it to the preceding node
  3. Click on 'Research'
  4. Select 'Get Research Status' operation
  5. In the node's settings:
    • Select your Tavily API credential
    • Enter the request_id from the create research task response
  6. Run the workflow to get the research status and results

Use with AI Agents

Tavily can be attached to an n8n AI Agent as a tool, so the agent decides when to search the web and writes its own queries.

  1. Add a When chat message received trigger and connect it to an AI Agent node
  2. Attach a chat model (for example OpenAI or Anthropic) to the agent's Chat Model input
  3. Click + under the agent's Tool input, search for Tavily, and choose Search the web
  4. Select your Tavily API credential
  5. Click Open chat and ask a question that needs current information

With the Tavily Tool (node version 2 and later), Search and Extract are ready for agents without extra setup.

Search

Field Default for agents
Query Written by the model
Topic Chosen by the model: general, news or finance
Time Range Chosen by the model: day, week, month, year, or no restriction
Search Depth Chosen by the model: basic, fast, ultra-fast or advanced. The model is told to prefer basic, because advanced costs 2 credits per search
Include Answer Chosen by the model: none, basic or advanced
Include Domains Written by the model, separated by commas, or left empty to search the whole web. Added to any domains set under Options
Exclude Domains Written by the model, separated by commas, or left empty. Added to any domains set under Options
Simplify On. Returns only the query, answer and each result's title, URL, content and score, without empty fields or IDs
Max Results 5, unless you set Max Results under Options

Extract

Field Default for agents
URLs Written by the model, separated by commas
Extract Depth Chosen by the model: basic or advanced. The model is told to prefer basic, because advanced costs twice as many credits

Dropdowns default to Let the Model Decide. To fix a value instead, pick it from the dropdown, and the model no longer gets that input. A value from the model that isn't one of the allowed choices is ignored, and Tavily's default is used. Other options, such as Max Results, can be added under Options.

In every node version, list fields such as domains, URLs and path patterns accept several values in one entry (domains and URLs separated by commas, path patterns by new lines), and empty entries are skipped.

Tips

  • Models don't know today's date. For questions about recent events, add it to the agent's System Message, for example: Today is {{ $now.toISODate() }}. Use Tavily Search for current information.
  • Every search result is sent back to the model on each step. Keep Max Results low and leave Include Raw Content off unless the agent needs full pages.
  • If the agent keeps searching without answering, raise Max Iterations in the agent's options or make the question more specific.

An example workflow with Search and Extract tools is in examples/ai-agent-search.json. Import it from the workflow menu (Import from File), then select your credentials.

Parameters

Tavily Search Parameters

Parameter Description
Query The search query to execute
Topic The category of the search (General, News, or Finance)
Search Depth The depth of the search (Basic, Advanced, Fast or Ultra-Fast)
Chunks Per Source Number of content chunks to retrieve from each source (1-3). Not available with Ultra-Fast search depth
Max Results Maximum number of search results to return (1-20)
Time Range Time range filter for results (day, week, month, year)
Include Answer Include an LLM-generated answer in the response (Basic or Advanced)
Include Raw Content Include cleaned and parsed HTML content of each search result
Include Images Perform an image search and include the results in the response
Include Image Descriptions When including images, also add a descriptive text for each image
Include Domains A list of domains to specifically include in the search results
Exclude Domains A list of domains to specifically exclude from the search results
Include Favicon Include the favicon URL for each result
Include Usage Whether to include credit usage information in the response.
Country Boost search results from a specific country. Available only for the General topic
Auto Parameters When enabled, Tavily automatically configures search parameters based on your query's content and intent
Start Date Will return all results after the specified start date (publish date). Required to be written in the format YYYY-MM-DD
End Date Will return all results before the specified end date (publish date). Required to be written in the format YYYY-MM-DD

Tavily Extract Parameters

Parameter Description
URLs One or more URLs to extract content from
Include Images Include a list of images extracted from each URL
Extract Depth How deeply to parse each URL (Basic or Advanced)
Format Format of the extracted web page content (Markdown or Text)
Include Favicon Include the favicon URL for each result
Include Usage Whether to include credit usage information in the response. NOTE:The value may be 0 if the total successful URL extractions has not yet reached 5 calls. See our Credits & Pricing documentation for details.

Tavily Crawl Parameters

Parameter Description
URL The root URL to begin the crawl
Instructions Natural language instructions for the crawler
Max Depth Maximum depth of the crawl (≥ 1)
Max Breadth Maximum number of links to follow per level (≥ 1)
Limit Maximum number of results to return (≥ 1)
Select Paths Regex patterns to select only URLs with specific path patterns
Select Domains Regex patterns to select crawling to specific domains or subdomains
Exclude Paths Regex patterns to exclude URLs with specific path patterns
Exclude Domains Regex patterns to exclude specific domains or subdomains from crawling
Allow External Whether to allow following links that go to external domains
Include Images Whether to include images in the crawl results
Extract Depth Extraction depth (Basic or Advanced)
Format Format of the extracted web page content (Markdown or Text)
Include Favicon Include the favicon URL for each result
Include Usage Whether to include credit usage information in the response. NOTE:The value may be 0 if the total use of /extract and /map calls has not yet reached minimum needed. See our Credits & Pricing documentation for details.

Tavily Map Parameters

Parameter Description
URL The root URL to begin mapping
Instructions Natural language instructions guiding the mapping process
Max Depth Defines how far from the base URL the crawler can explore (≥ 1)
Max Breadth Maximum number of links to follow per level of the tree (≥ 1)
Limit Total number of links the crawler will process before stopping (≥ 1)
Select Paths Regex patterns to select only URLs with specific path patterns
Select Domains Regex patterns to select crawling to specific domains or subdomains
Exclude Paths Regex patterns to exclude URLs with specific path patterns
Exclude Domains Regex patterns to exclude specific domains or subdomains from crawling
Allow External Whether to include external domain links in the final results list
Timeout Maximum time in seconds to wait for the map operation (10-150)

Tavily Research Parameters

Create Research Task

Parameter Description
Input The research task or question to investigate
Model The model used by the research agent (Auto, Mini, or Pro). Mini is optimized for targeted research, Pro provides comprehensive multi-angle research
Citation Format The format for citations in the research report (Numbered, MLA, APA, or Chicago)
Output Schema A JSON Schema object that defines the structure of the research output
Stream Whether to stream research results in real-time as Server-Sent Events (SSE) with progress updates and incremental results

Get Research Status

Parameter Description
Request ID The unique identifier of the research task returned from the Create Research Task operation

Development

This package uses n8n's n8n-node tool.

Command What it does
npm run dev Starts a local n8n with this node loaded and rebuilds on changes
npm run build Compiles the node to dist/
npm run lint Checks the code against n8n's community node rules
npm run lint:fix Fixes lint issues that can be fixed automatically

Troubleshooting

Error Codes

Error Code Description Solution
400 Bad Request Invalid request parameters or unsupported values Check all parameters and their formats
401 Unauthorized Missing or invalid API key Verify API key or generate a new one
429 Too Many Requests Rate limit exceeded Reduce request frequency or implement backoff
432 Plan Limit Exceeded Exceeds plan limits Upgrade your plan via Tavily Dashboard
433 Pay-As-You-Go Limit Exceeded Exceeds pay-as-you-go limit Increase limit via Tavily Dashboard
500 Internal Server Error Server-side issue Retry request after a few minutes

Cost

Head to the API Credits Overview in our documentation to learn more about how many API Credits each request costs.

License

This project is licensed under the terms of the MIT license.

Contact

If you are encountering issues while using Tavily, please email us at support@tavily.com. We'll be happy to help you.

If you want to stay updated on the latest Tavily news and releases, head to our Developer Community to learn more!

Discussion