# Agents Source: https://docs.tavily.com/agents The canonical setup guide for AI agents and the developers who build them: choose how to connect to Tavily, choose the right capability, and use agent-grade defaults. Tavily is the web layer for AI agents. Use Tavily when an agent needs live web **search**, page **extraction**, site **crawling**, site **mapping**, or cited **research**. This page answers three questions, in order: 1. [Which Tavily docs should an agent fetch?](#1-agent-readable-docs) 2. [How should I connect to Tavily?](#2-choose-how-to-connect) 3. [Which Tavily capability should I use?](#3-choose-a-capability) ## 1. Agent-readable docs Every Tavily docs page is also served as clean Markdown — append `.md` to any docs URL. **Start here.** Use [`https://docs.tavily.com/llms.txt`](https://docs.tavily.com/llms.txt) as the documentation index, this page ([`agents.md`](https://docs.tavily.com/agents.md)) as the canonical setup guide, and [`https://docs.tavily.com/llms-full.txt`](https://docs.tavily.com/llms-full.txt) for the full text of all docs. | Resource | What it is | When to fetch it | | -------------------------------------------------------- | ---------------------------------- | ------------------------------------------------ | | [`llms.txt`](https://docs.tavily.com/llms.txt) | Compact index of every Tavily doc. | First, to find the right page. | | [`agents.md`](https://docs.tavily.com/agents.md) | This setup guide. | When configuring Tavily or choosing a path. | | [`llms-full.txt`](https://docs.tavily.com/llms-full.txt) | Full text of all docs. | When you need broad context and have the budget. | | Page `.md` URLs | Markdown version of one page. | When you already know the page you need. | The whole site is indexed in [llms.txt](/llms.txt), with the full text in [llms-full.txt](/llms-full.txt). ## 2. Choose how to connect Choose based on what Tavily must **do**, not only where you happen to be running. Build Tavily into an application, backend, or agent runtime that calls it in production. Get a free API key at [app.tavily.com](https://app.tavily.com). Make Tavily available across a team or org — governed, shared, and reusable, including standardizing it for everyone's Cursor and Claude Code. Connect the remote server with OAuth or an API key. Add Tavily to your own local coding or research session — for a single developer, not a team-wide rollout. Install the CLI and run `tvly login`. | If you are… | Use | Why it fits | Start at | | ------------------------------------------------------------------------------------------------------------------------- | ---------------- | --------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ | | Building Tavily into an app, backend, or agent runtime that calls it in production | **SDK / API** | Your code calls Tavily directly at runtime. Get a free key at app.tavily.com. | [`/documentation/api-reference/introduction`](https://docs.tavily.com/documentation/api-reference/introduction.md) | | Setting Tavily up for a team or org, or standardizing it across many agent clients (e.g. everyone's Cursor / Claude Code) | **MCP** | Governed, shared, reusable access via the remote server (OAuth or API key). | [`/documentation/mcp`](https://docs.tavily.com/documentation/mcp.md) | | Adding Tavily to your own local coding or research session right now (single developer, not a team rollout) | **CLI + Skills** | Terminal access to search, extract, and research; install the CLI and run `tvly login`. | [`/documentation/agent-skills`](https://docs.tavily.com/documentation/agent-skills.md) | **Quick rules** * Production app or runtime → **SDK / API**. * Shared across a team or org — even in Cursor or Claude Code → **MCP**. * Just your own local session → **CLI + Skills**. * Terminal access alone doesn't make CLI the right fit — match the choice to where Tavily ultimately needs to run. **Developer resource — Agent Toolkit.** [Agent Toolkit](/examples/agent-toolkit/overview) is for developers *building* production research agents, not for agents configuring Tavily autonomously. Reach for it when you need deeper research flows, retrieval orchestration, deduplication, summarization, or structured outputs. ## No account? Connect without a key For autonomous agents that can't manage credentials, Tavily offers two no-key paths. Call Search and Extract with zero setup — send the `X-Tavily-Access-Mode: keyless` header, or connect the remote MCP with no key. No account required. Pay per request for Advanced Search in USDC on Base — no API key, no account, no human in the loop. | Path | What it is | Start at | | ----------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | | **Keyless** | Search and Extract with no account — send header `X-Tavily-Access-Mode: keyless`, or use the remote MCP with no key. | [`/documentation/keyless`](https://docs.tavily.com/documentation/keyless.md) | | **x402** | Pay-per-request Advanced Search in USDC on Base over the x402 protocol — no key, no account, no human. | [`/documentation/machine-payments/x402`](https://docs.tavily.com/documentation/machine-payments/x402.md) | ## 3. Choose a capability Lead with **Search** when sources are unknown; move to the others once you have URLs or a site to work through. Start here when sources are unknown or you need current web context. Pull clean content when you already have the URL, or one from Search. Discover a site's structure before crawling it. Read many pages across a site. Get cited synthesis — a report, comparison, or decision-ready answer. | Capability | Use it when | Reference | | ------------ | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ | | **Search** | Sources are unknown or current web context is needed — the default start. | [`/endpoint/search`](https://docs.tavily.com/documentation/api-reference/endpoint/search.md) | | **Extract** | You already have the URL, or picked one from Search. | [`/endpoint/extract`](https://docs.tavily.com/documentation/api-reference/endpoint/extract.md) | | **Map** | You need a site's structure before crawling it. | [`/endpoint/map`](https://docs.tavily.com/documentation/api-reference/endpoint/map.md) | | **Crawl** | Many pages on a site must be read. | [`/endpoint/crawl`](https://docs.tavily.com/documentation/api-reference/endpoint/crawl.md) | | **Research** | The output should be cited synthesis: a report, comparison, or decision-ready answer. | [`/endpoint/research`](https://docs.tavily.com/documentation/api-reference/endpoint/research.md) | ## Recommended defaults These favor quality, which is what most agent workflows need. See [Best Practices for Search](/documentation/best-practices/best-practices-search) for the full reference. * Prefer **`search_depth="advanced"`** for source discovery, comparisons, and high-confidence answers; use `"basic"` for quick lookups. * For latency-sensitive use cases, **`fast`** and **`ultra-fast`** trade some relevance for lower latency. * Add **`chunks_per_source=3`** with advanced Search for stronger evidence per source (chunks require advanced depth). * Use **`max_results=5`** for focused answers, **`10`** for broader research. * Use **`include_domains`** / **`exclude_domains`** when source trust matters. * Prefer **Search → Extract** for grounded answers: Search to find sources, then Extract for full content. * Avoid **`include_answer`** unless you need a quick answer seed — and still verify against sources. * Use **Research** for cited synthesis: a report, comparison, or decision-ready answer. A typical agent-grade Search call: ```python Python theme={null} from tavily import TavilyClient client = TavilyClient(api_key="tvly-YOUR_API_KEY") response = client.search( "your query", search_depth="advanced", chunks_per_source=3, max_results=5, ) ``` ```javascript JavaScript theme={null} const { tavily } = require("@tavily/core"); const tvly = tavily({ apiKey: "tvly-YOUR_API_KEY" }); const response = await tvly.search("your query", { searchDepth: "advanced", chunksPerSource: 3, maxResults: 5, }); ``` ```bash cURL theme={null} curl --request POST \ --url https://api.tavily.com/search \ --header 'Authorization: Bearer tvly-YOUR_API_KEY' \ --header 'Content-Type: application/json' \ --data '{ "query": "your query", "search_depth": "advanced", "chunks_per_source": 3, "max_results": 5 }' ``` ## Availability Some Tavily capabilities, limits, and defaults depend on your account, plan, or enterprise configuration. If a tool or parameter is unavailable, check the relevant endpoint docs and your account settings before retrying a different workflow. # Changelog Source: https://docs.tavily.com/changelog
Attach session and end-user identifiers to your API requests — see Session Tracking


[include\_domains](/documentation/api-reference/endpoint/research#body-include-domains), [exclude\_domains](/documentation/api-reference/endpoint/research#body-exclude-domains), and [output\_length](/documentation/api-reference/endpoint/research#body-output-length) parameters for [Research](/documentation/api-reference/endpoint/research)


Enterprise API key management — [Generate Keys](/documentation/enterprise/generate-keys), [Deactivate Keys](/documentation/enterprise/deactivate-keys), [Key Info](/documentation/enterprise/key-info)


exact\_match parameter for [Search](/documentation/api-reference/endpoint/search#body-exact-match)


Track API usage by project with the new X-Project-ID header


[search\_depth parameter](/documentation/api-reference/endpoint/search#body-search-depth) - New options: fast and ultra-fast


[query](/documentation/api-reference/endpoint/extract#body-query) and [chunks\_per\_source](/documentation/api-reference/endpoint/extract#body-chunks-per-source) parameters for Extract and Crawl


[include\_usage parameter](/documentation/api-reference/endpoint/search#body-include-usage)


[Tavily is now integrated with Vercel AI SDK v5](/documentation/integrations/vercel)


[timeout parameter for Crawl](/documentation/api-reference/endpoint/crawl#body-timeout) and [timeout parameter for Map](/documentation/api-reference/endpoint/map#body-timeout)

Role options: Owner, Admin, Member

You can now assign roles to team members, giving you more control over access and permissions. Each team has one owner, while there can be multiple admins and multiple members. The key distinction between roles is in their permissions for Billing and Settings:


[timeout parameter](/documentation/api-reference/endpoint/extract#body-timeout)


[start\_date parameter](/documentation/api-reference/endpoint/search#body-start_date),[end\_date parameter](/documentation/api-reference/endpoint/search#body-end-date)


[Login to your account to view the usage dashboard](https://www.tavily.com/)


The usage dashboard provides the following features to paid users/teams:

[include\_favicon parameter](/documentation/api-reference/endpoint/search#body-include-favicon)

Tavily Search
[auto\_parameters](/documentation/api-reference/endpoint/search#body-auto-parameters)

[/usage endpoint](/documentation/api-reference/endpoint/usage)
Tavily Search
[country parameter](/documentation/api-reference/endpoint/search#body-country)

Boost search results from a specific country.

Make & n8n Integrations
Tavily Extract
[format parameter](/documentation/api-reference/endpoint/extract#body-format)
Tavily Search
[search\_depth](/documentation/api-reference/endpoint/search#body-search-depth) and [chunks\_per\_source](/documentation/api-reference/endpoint/search#body-chunks-per-source)parameters
[Tavily Crawl](https://docs.tavily.com/documentation/api-reference/endpoint/crawl)
# About Source: https://docs.tavily.com/documentation/about Welcome to Tavily! Looking for a step-by-step tutorial to get started in under 5 minutes? Head to our [Quickstart guide](/guides/quickstart) and start coding! ## Who are we? We're a team of AI researchers and developers passionate about helping you build the next generation of AI assistants. Our mission is to empower individuals and organizations with accurate, unbiased, and factual information. ## What is the Tavily Search Engine? Building an AI agent that leverages realtime online information is not a simple task. Scraping doesn't scale and requires expertise to refine, current search engine APIs don't provide explicit information to queries but simply potential related articles (which are not always related), and are not very customziable for AI agent needs. This is why we're excited to introduce the first search engine for AI agents - [Tavily](https://app.tavily.com). Tavily is a search engine optimized for LLMs, aimed at efficient, quick and persistent search results. Unlike other search APIs such as Serp or Google, Tavily focuses on optimizing search for AI developers and autonomous AI agents. We take care of all the burden of searching, scraping, filtering and extracting the most relevant information from online sources. All in a single API call! To try the API in action, you can now use our hosted version on our [API Playground](https://app.tavily.com/playground). If you're an AI developer looking to integrate your application with our API, or seek increased API limits, [please reach out!](mailto:support@tavily.com) ## Why choose Tavily? Tavily shines where others fail, with a Search API optimized for LLMs. Tailored just for LLM Agents, we ensure the search results are optimized for [RAG](https://towardsdatascience.com/retrieval-augmented-generation-intuitively-and-exhaustively-explain-6a39d6fe6fc9). We take care of all the burden in searching, scraping, filtering and extracting information from online sources. All in a single API call! Simply pass the returned search results as context to your LLM. Beyond just fetching results, the Tavily Search API offers precision. With customizable search depths, domain management, and parsing HTML content controls, you're in the driver's seat. Committed to speed and efficiency, our API guarantees real-time and trusted information. Our team works hard to improve Tavily's performance over time. We appreciate the essence of adaptability. That's why integrating our API with your existing setup is a breeze. You can choose our [Python library](https://pypi.org/project/tavily-python/), [JavaScript package](https://www.npmjs.com/package/@tavily/core) or a simple API call. You can also use Tavily through any of our supported partners such as [LangChain](/integrations/langchain) and [LlamaIndex](/integrations/llamaindex). Our detailed documentation ensures you're never left in the dark. From setup basics to nuanced features, we've got you covered. ## How does the Search API work? Traditional search APIs such as Google, Serp and Bing retrieve search results based on a user query. However, the results are sometimes irrelevant to the goal of the search, and return simple URLs and snippets of content which are not always relevant. Because of this, any developer would need to then scrape the sites to extract relevant content, filter irrelevant information, optimize the content to fit LLM context limits, and more. This task is a burden and requires a lot of time and effort to complete. The Tavily Search API takes care of all of this for you in a single API call. The Tavily Search API aggregates up to 20 sites per a single API call, and uses proprietary AI to score, filter and rank the top most relevant sources and content to your task, query or goal. In addition, Tavily allows developers to add custom fields such as context and limit response tokens to enable the optimal search experience for LLMs. Tavily can also help your AI agent make better decisions by including a short answer for cross-agent communication. With LLM hallucinations, it's crucial to optimize for RAG with the right context and information. This is where Tavily comes in, delivering accurate and precise information for your RAG applications. ## Getting started [Sign up](https://app.tavily.com) for Tavily to get your API key. You get **1,000 free API Credits every month**. No credit card required. You get 1,000 free API Credits every month. **No credit card required.** Head to our [API Playground](https://app.tavily.com/playground) to familiarize yourself with our API. To get started with Tavily's APIs and SDKs using code, head to our [Quickstart Guide](/guides/quickstart) and follow the steps. Got questions? Stumbled upon an issue? Simply intrigued? Don't hesitate! Our support team is always on standby, eager to assist. Join us, dive deep, and redefine your search experience! [Contact us!](mailto:support@tavily.com) # Tavily Agent Skills Source: https://docs.tavily.com/documentation/agent-skills Official skills that define best practices, adding web search, extraction, crawling, and research to any AI coding agent. `/tavily-ai/skills` Sign up at tavily.com Agent Skills let you add Tavily's web capabilities to AI coding agents like Claude Code, Cursor, Cline, Codex, Windsurf, and others via the [Tavily CLI](https://docs.tavily.com/documentation/tavily-cli). ## Available Skills | Skill | Description | | ----------------------- | -------------------------------------------------------------------------------- | | `tavily-search` | Web search with agent-optimized results. | | `tavily-extract` | Extract clean markdown/text from URLs. | | `tavily-crawl` | Crawl a website and extract content from multiple pages with semantic filtering. | | `tavily-map` | Discover and list all URLs on a website. | | `tavily-research` | AI-powered research that produces a cited report. | | `tavily-best-practices` | Reference docs for building production-ready Tavily integrations. | ## Installation ### Step 1: Install the Tavily CLI: ```bash theme={null} curl -fsSL https://cli.tavily.com/install.sh | bash ``` See the [CLI docs](https://docs.tavily.com/documentation/tavily-cli) for other installation methods. ### Step 2: Install the skills: ```bash theme={null} npx skills add tavily-ai/skills --all ``` Or install a specific skill: ```bash theme={null} npx skills add tavily-ai/skills --skill tavily-search ``` After installation, restart your AI agent to load the skills. ## Usage Once installed, skills are automatically available to your agent. No additional configuration is needed — your agent will use them when appropriate based on your prompts. ### Automatic Invocation Simply describe what you need and your agent will use the right Tavily skill: ``` Search for the latest news on AI regulations ``` ``` Crawl the Stripe API docs and save them locally ``` ``` Research the competitive landscape for AI coding assistants ``` ### Explicit Skill Invocation You can also invoke skills directly using slash commands: ``` /tavily-search current React best practices ``` ``` /tavily-extract https://example.com/blog/post ``` ``` /tavily-crawl https://docs.example.com ``` ``` /tavily-research AI agent frameworks and save to report.json ``` ``` /tavily-best-practices ``` ## Skill Details Web search returning LLM-optimized results with content snippets and relevance scores. **Invoke explicitly:** ``` /tavily-search ``` **Example prompts:** * "Search for the latest news on AI regulations" * "/tavily-search current React best practices" * "Search for Python async patterns" **CLI usage:** ```bash theme={null} # Basic search tvly search "your query" --json # Advanced search with more results tvly search "quantum computing" --depth advanced --max-results 10 --json # Recent news tvly search "AI news" --time-range week --topic news --json # Domain-filtered tvly search "SEC filings" --include-domains sec.gov,reuters.com --json ``` **Key options:** `--depth` (ultra-fast/fast/basic/advanced), `--max-results`, `--topic`, `--time-range`, `--include-domains`, `--exclude-domains`, `--include-raw-content` Extract clean markdown or text content from one or more URLs. Handles JavaScript-rendered pages. **Invoke explicitly:** ``` /tavily-extract ``` **Example prompts:** * "Extract the content from this article URL" * "/tavily-extract [https://example.com/blog/post](https://example.com/blog/post)" * "Extract content from these three documentation pages" **CLI usage:** ```bash theme={null} # Single URL tvly extract "https://example.com/article" --json # Multiple URLs tvly extract "https://example.com/page1" "https://example.com/page2" --json # Query-focused extraction (returns relevant chunks only) tvly extract "https://example.com/docs" --query "authentication API" --chunks-per-source 3 --json ``` **Key options:** `--query`, `--chunks-per-source`, `--extract-depth` (basic/advanced), `--format` (markdown/text) Discover URLs on a website without extracting content. Faster than crawling — useful for finding the right page before extracting. **Invoke explicitly:** ``` /tavily-map ``` **Example prompts:** * "Map the site structure of docs.example.com" * "Find the authentication page on this site" * "List all URLs under the /api/ path" **CLI usage:** ```bash theme={null} # Discover all URLs tvly map "https://docs.example.com" --json # With natural language filtering tvly map "https://docs.example.com" --instructions "Find API docs and guides" --json # Filter by path tvly map "https://example.com" --select-paths "/blog/.*" --limit 500 --json ``` **Key options:** `--max-depth`, `--limit`, `--instructions`, `--select-paths`, `--exclude-paths` Use the **map + extract** pattern: map to find the right page, then extract its content. This is often more efficient than crawling an entire site. Crawl websites and extract content from multiple pages. Save each page as a local markdown file or get structured JSON output. **Invoke explicitly:** ``` /tavily-crawl ``` **Example prompts:** * "Crawl the Stripe API docs and save them locally" * "/tavily-crawl [https://docs.example.com](https://docs.example.com)" * "Download the Next.js documentation for offline reference" **CLI usage:** ```bash theme={null} # Save each page as a markdown file tvly crawl "https://docs.example.com" --output-dir ./docs/ # Semantic focus (returns relevant chunks, not full pages) tvly crawl "https://docs.example.com" --instructions "Find authentication docs" --chunks-per-source 3 --json # Filter to specific paths tvly crawl "https://example.com" --select-paths "/api/.*,/guides/.*" --exclude-paths "/blog/.*" --json ``` **Key options:** `--max-depth`, `--limit`, `--instructions`, `--chunks-per-source`, `--output-dir`, `--select-paths`, `--exclude-paths` AI-powered deep research that gathers sources, analyzes them, and produces a cited report. Takes 30–120 seconds. **Invoke explicitly:** ``` /tavily-research ``` **Example prompts:** * "Research the latest developments in quantum computing" * "/tavily-research AI agent frameworks and save to report.json" * "Research the competitive landscape for AI coding assistants" **CLI usage:** ```bash theme={null} # Basic research tvly research "competitive landscape of AI code assistants" # Pro model for comprehensive analysis tvly research "electric vehicle market analysis" --model pro # Stream results in real-time tvly research "AI agent frameworks comparison" --stream # Save report to file tvly research "fintech trends 2025" --model pro -o report.md ``` **Key options:** `--model` (mini/pro/auto), `--stream`, `--citation-format`, `--output-schema`, `-o` Build production-ready Tavily integrations with best practices baked in. Reference documentation for implementing web search, content extraction, crawling, and research in agentic workflows, RAG systems, or autonomous agents. **Invoke explicitly:** ``` /tavily-best-practices ``` **Example prompts:** * "Add Tavily search to my internal company chatbot so it can answer questions about our competitors" * "Build a lead enrichment tool that uses Tavily to find company information from their website" * "Create a news monitoring agent that tracks mentions of our brand using Tavily search" * "Implement a RAG pipeline that uses Tavily extract to pull content from industry reports" ## What You Can Build Copy-paste these prompts into your AI agent and start building: Build a chatbot that can answer questions about current events and up-to-date information. **Try these prompts:** ``` /tavily-best-practices Build a chatbot that integrates Tavily search to answer questions with up-to-date web information ``` ``` /tavily-best-practices Add Tavily search to my internal company chatbot so it can answer questions about our competitors ``` Create a live news dashboard that tracks topics and analyzes sentiment. **Try these prompts:** ``` /tavily-best-practices Build a website that refreshes daily with Tesla news and gives a sentiment score on each article ``` ``` /tavily-best-practices Create a news monitoring dashboard that tracks AI industry news and sends daily Slack summaries ``` Build tools that automatically enrich leads with company data from the web. **Try these prompts:** ``` /tavily-best-practices Build a lead enrichment tool that uses Tavily to find company information from their website ``` ``` /tavily-best-practices Create a script that takes a list of company URLs and extracts key business information ``` Build an autonomous agent that monitors competitors and surfaces insights. **Try these prompts:** ``` /tavily-best-practices Build a market research tool that crawls competitor documentation and pricing pages ``` ``` /tavily-best-practices Create an agent that monitors competitor product launches and generates weekly reports ``` The `/tavily-best-practices` skill is your fastest path to production. Describe what you want to build and your agent generates working code with best practices baked in. # Credits & Pricing Source: https://docs.tavily.com/documentation/api-credits Learn how to get and manage your Tavily API Credits. ## Free API Credits You get 1,000 free API Credits every month. **No credit card required.** ## Pricing Overview Tavily operates on a simple, credit-based model: * **Free**: 1,000 credits/month * **Pay-as-you-go**: \$0.008 per credit (allows you to be charged per credit once your plan’s credit limit is reached). * **Monthly plans**: \$0.0075 - \$0.005 per credit * **Enterprise**: Custom pricing and volume | **Plan** | **Credits per month** | **Monthly price** | **Price per credit** | | ----------------- | --------------------- | ----------------- | -------------------- | | **Researcher** | 1,000 | Free | - | | **Project** | 4,000 | \$30 | \$0.0075 | | **Bootstrap** | 15,000 | \$100 | \$0.0067 | | **Startup** | 38,000 | \$220 | \$0.0058 | | **Growth** | 100,000 | \$500 | \$0.005 | | **Pay as you go** | Per usage | \$0.008 / Credit | \$0.008 | | **Enterprise** | Custom | Custom | Custom | Head to [billing](https://app.tavily.com/billing) to explore our different options and manage your plan. ## API Credits Costs ### Tavily Search Your [search depth](/api-reference/endpoint/search#body-search-depth) determines the cost of your request. * **Basic Search (`basic`):** Each request costs **1 API credit**. * **Advanced Search (`advanced`):** Each request costs **2 API credits**. ### Tavily Extract The number of successful URL extractions and your [extraction depth](/api-reference/endpoint/extract#body-extract-depth) determines the cost of your request. You never get charged if a URL extraction fails. * **Basic Extract (`basic`):** Every 5 successful URL extractions cost **1 API credit** * **Advanced Extract (`advanced`):** Every 5 successful URL extractions cost **2 API credits** ### Tavily Map The number of pages mapped and whether or not natural-language [instructions](/documentation/api-reference/endpoint/map#instructions) are specified determines the cost of your request. You never get charged if a map request fails. * **Regular Mapping:** Every 10 successful pages returned cost **1 API credit** * **Map with (`instructions`):** Every 10 successful pages returned cost **2 API credits** ### Tavily Crawl Tavily Crawl combines both mapping and extraction operations, so the cost is the sum of both: * **Crawl Cost = Mapping Cost + Extraction Cost** For example: * If you crawl 10 pages with basic extraction depth, you'll be charged **1 credit for mapping** (10 pages) + **2 credits for extraction** (10 successful extractions ÷ 5) = **3 total credits** * If you crawl 10 pages with advanced extraction depth, you'll be charged **1 credit for mapping** + **4 credits for extraction** = **5 total credits** ### Tavily Research Tavily Research follows a dynamic pricing model with minimum and maximum credit consumption boundaries associated with each request. The minimum and maximum boundaries differ based on if the request uses `model=mini` or `model=pro`. | Request Cost Boundaries | model=pro | model=mini | | ----------------------- | ----------- | ----------- | | Per-request minimum | 15 credits | 4 credits | | Per-request maximum | 250 credits | 110 credits | # Tavily Crawl Source: https://docs.tavily.com/documentation/api-reference/endpoint/crawl POST /crawl Tavily Crawl is a graph-based website traversal tool that can explore hundreds of paths in parallel with built-in extraction and intelligent discovery. # Tavily Extract Source: https://docs.tavily.com/documentation/api-reference/endpoint/extract POST /extract Extract web page content from one or more specified URLs using Tavily Extract. # Tavily Map Source: https://docs.tavily.com/documentation/api-reference/endpoint/map POST /map Tavily Map traverses websites like a graph and can explore hundreds of paths in parallel with intelligent discovery to generate comprehensive site maps. # Create Research Task Source: https://docs.tavily.com/documentation/api-reference/endpoint/research POST /research Tavily Research performs comprehensive research on a given topic by conducting multiple searches, analyzing sources, and generating a detailed research report. ## Files Attach files to a research request and the agent uses their contents as a source alongside the web. Add a `files` array to the request body, where each entry carries a filename and its base64-encoded contents. The agent reads the relevant parts of each file, grounds its answer in them, and cites any file it draws from. **Supported file types:** `.txt`, `.md`, `.json` Up to 5 files per request. ### Full Request ```json theme={null} { "input": "Summarize the key risks in the attached report and compare them to recent industry coverage.", "files": [ { "name": "q1-report.md", "data": "", "type": "base64" } ] } ``` ### Limits | Limit | Value | | ----------------------------------------------- | ------------ | | Max files per request | 5 | | Max size per text file (`.txt`, `.md`, `.json`) | 80,000 words | | Max combined size of all files | 80,000 words | # Get Research Task Status Source: https://docs.tavily.com/documentation/api-reference/endpoint/research-get GET /research/{request_id} Retrieve the status and results of a research task using its request ID. # Streaming Source: https://docs.tavily.com/documentation/api-reference/endpoint/research-streaming Stream real-time research progress and results from Tavily Research API ## Overview When using the Tavily Research API, you can stream responses in real-time by setting `stream: true` in your request. This allows you to receive research progress updates, tool calls, and final results as they're generated, providing a better user experience for long-running research tasks. Streaming is particularly useful for: * Displaying research progress to users in real-time * Monitoring tool calls and search queries as they execute * Receiving incremental updates during lengthy research operations * Building interactive research interfaces ## Enabling Streaming To enable streaming, set the `stream` parameter to `true` when making a request to the Research endpoint: ```json theme={null} { "input": "What are the latest developments in AI?", "stream": true } ``` The API will respond with a `text/event-stream` content type, sending Server-Sent Events (SSE) as the research progresses. ## Event Structure Each streaming event follows a consistent structure compatible with the OpenAI chat completions format: ```json theme={null} { "id": "123e4567-e89b-12d3-a456-426614174111", "object": "chat.completion.chunk", "model": "mini", "created": 1705329000, "choices": [ { "delta": { // Event-specific data here } } ] } ``` ### Core Fields | Field | Type | Description | | --------- | ------- | ----------------------------------------------------- | | `id` | string | Unique identifier for the stream event | | `object` | string | Always `"chat.completion.chunk"` for streaming events | | `model` | string | The research model being used (`"mini"` or `"pro"`) | | `created` | integer | Unix timestamp when the event was created | | `choices` | array | Array containing the delta with event details | ## Event Types The streaming response includes different types of events in the `delta` object. Here are the main event types you'll encounter: ### 1. Tool Call Events When the research agent performs actions like web searches, you'll receive tool call events: ```json theme={null} { "id": "evt_002", "object": "chat.completion.chunk", "model": "mini", "created": 1705329005, "choices": [ { "delta": { "role": "assistant", "tool_calls": { "type": "tool_call", "tool_call": [ { "name": "WebSearch", "id": "fc_633b5932-e66c-4523-931a-04a7b79f2578", "arguments": "Executing 5 search queries", "queries": ["latest AI developments 2024", "machine learning breakthroughs", "..."] } ] } } } ] } ``` **Tool Call Delta Fields:** | Field | Type | Description | | --------------------- | ------ | ------------------------------------------------------------------ | | `type` | string | Either `"tool_call"` or `"tool_response"` | | `tool_call` | array | Details about the tool being invoked | | `name` | string | Name of the tool (see [Tool Types](#tool-types) below) | | `id` | string | Unique identifier for the tool call | | `arguments` | string | Description of the action being performed | | `queries` | array | *(WebSearch only)* The search queries being executed | | `parent_tool_call_id` | string | *(Pro mode only)* ID of the parent tool call for nested operations | ### 2. Tool Response Events After a tool executes, you'll receive response events with discovered sources: ```json theme={null} { "id": "evt_003", "object": "chat.completion.chunk", "model": "mini", "created": 1705329010, "choices": [ { "delta": { "role": "assistant", "tool_calls": { "type": "tool_response", "tool_response": [ { "name": "WebSearch", "id": "fc_633b5932-e66c-4523-931a-04a7b79f2578", "arguments": "Completed executing search tool call", "sources": [ { "url": "https://example.com/article", "title": "Example Article", "favicon": "https://example.com/favicon.ico" } ] } ] } } } ] } ``` **Tool Response Fields:** | Field | Type | Description | | --------------------- | ------ | --------------------------------------------------------------- | | `name` | string | Name of the tool that completed | | `id` | string | Unique identifier matching the original tool call | | `arguments` | string | Completion status message | | `sources` | array | Sources discovered by the tool (with `url`, `title`, `favicon`) | | `parent_tool_call_id` | string | *(Pro mode only)* ID of the parent tool call | ### 3. Content Events The final research report is streamed as content chunks: ```json theme={null} { "id": "evt_004", "object": "chat.completion.chunk", "model": "mini", "created": 1705329015, "choices": [ { "delta": { "role": "assistant", "content": "# Research Report\n\nBased on the latest sources..." } } ] } ``` **Content Field:** * Can be a **string** (markdown-formatted report chunks) when no `output_schema` is provided * Can be an **object** (structured data) when an `output_schema` is specified ### 4. Sources Event After the content is streamed, a sources event is emitted containing all sources used in the research: ```json theme={null} { "id": "evt_005", "object": "chat.completion.chunk", "model": "mini", "created": 1705329020, "choices": [ { "delta": { "role": "assistant", "sources": [ { "url": "https://example.com/article", "title": "Example Article Title", "favicon": "https://example.com/favicon.ico" } ] } } ] } ``` **Source Object Fields:** | Field | Type | Description | | --------- | ------ | ---------------------------- | | `url` | string | The URL of the source | | `title` | string | The title of the source page | | `favicon` | string | URL to the source's favicon | ### 5. Done Event Signals the completion of the streaming response: ``` event: done ``` ## Tool Types During research, you'll encounter the following tool types in streaming events: | Tool Name | Description | Model | | ------------------ | -------------------------------------------------------------- | -------- | | `Planning` | Initializes the research plan based on the input query | Both | | `Generating` | Generates the final research report from collected information | Both | | `WebSearch` | Executes web searches to gather information | Both | | `ResearchSubtopic` | Conducts deep research on specific subtopics | Pro only | ### Research Flow Example A typical streaming session follows this sequence: 1. **Planning** tool\_call → Initializing research plan 2. **Planning** tool\_response → Research plan initialized 3. **WebSearch** tool\_call → Executing search queries (with `queries` array) 4. **WebSearch** tool\_response → Search completed (with `sources` array) 5. *(Pro mode)* **ResearchSubtopic** tool\_call/response cycles for deeper research 6. **Generating** tool\_call → Generating final report 7. **Generating** tool\_response → Report generated 8. **Content** events → Streamed report chunks 9. **Sources** event → Complete list of all sources used 10. **Done** event → Stream complete ## Handling Streaming Responses ### Python Example ```python theme={null} from tavily import TavilyClient # Step 1. Instantiating your TavilyClient tavily_client = TavilyClient(api_key="tvly-YOUR_API_KEY") # Step 2. Creating a streaming research task stream = tavily_client.research( input="Research the latest developments in AI", model="pro", stream=True ) for chunk in stream: print(chunk.decode('utf-8')) ``` ### JavaScript Example ```javascript theme={null} const { tavily } = require("@tavily/core"); const tvly = tavily({ apiKey: "tvly-YOUR_API_KEY" }); const stream = await tvly.research("Research the latest developments in AI", { model: "pro", stream: true, }); for await (const chunk of result as AsyncGenerator) { console.log(chunk.toString('utf-8')); } ``` ## Structured Output with Streaming When using `output_schema` to request structured data, the `content` field will contain an object instead of a string: ```json theme={null} { "delta": { "role": "assistant", "content": { "company": "Acme Corp", "key_metrics": ["Revenue: $1M", "Growth: 50%"], "summary": "Company showing strong growth..." } } } ``` ## Error Handling If an error occurs during streaming, you may receive an error event: ```json theme={null} { "id": "1d77bdf5-38a4-46c1-87a6-663dbc4528ec", "object": "error", "error": "An error occurred while streaming the research task" } ``` Always implement proper error handling in your streaming client to gracefully handle these cases. ## Non-Streaming Alternative If you don't need real-time updates, set `stream: false` (or omit the parameter) to receive a single complete response: ```json theme={null} { "request_id": "123e4567-e89b-12d3-a456-426614174111", "created_at": "2025-01-15T10:30:00Z", "status": "pending", "input": "What are the latest developments in AI?", "model": "mini", "response_time": 1.23 } ``` You can then poll the status endpoint to check when the research is complete. # Tavily Search Source: https://docs.tavily.com/documentation/api-reference/endpoint/search POST /search Execute a search query using Tavily Search. # Usage Source: https://docs.tavily.com/documentation/api-reference/endpoint/usage GET /usage Get API key and account usage details # Introduction Source: https://docs.tavily.com/documentation/api-reference/introduction Easily integrate our APIs with your services. ## Base URL The base URL for all requests to the Tavily API is: ```plaintext theme={null} https://api.tavily.com ``` ## Authentication All Tavily endpoints are authenticated using API keys. [Get your free API key](https://app.tavily.com). ```bash theme={null} curl -X POST https://api.tavily.com/search \ -H "Content-Type: application/json" \ -H "Authorization: Bearer tvly-YOUR_API_KEY" \ -d '{"query": "Who is Leo Messi?"}' ``` ## Endpoints **`/search`** Tavily's powerful web search API. **`/extract`** Tavily's powerful content extraction API. `/crawl` , `/map` Tavily's intelligent sitegraph navigation and extraction tools. **`/research`** Tavily's comprehensive research API for in-depth analysis. ## Project Tracking You can optionally attach a Project ID to your API requests to organize and track usage by project. This is useful when a single API key is used across multiple projects or applications. To attach a project to your request, add the `X-Project-ID` header: ```bash theme={null} curl -X POST https://api.tavily.com/search \ -H "Content-Type: application/json" \ -H "Authorization: Bearer tvly-YOUR_API_KEY" \ -H "X-Project-ID: your-project-id" \ -d '{"query": "Who is Leo Messi?"}' ``` **Key features:** * An API key can be associated with multiple projects * Filter requests by project in the [/logs endpoint](/documentation/api-reference/endpoint/usage) and platform usage dashboard * Helps organize and track where requests originate from When using the SDKs, you can specify a project using the `project_id` parameter when instantiating the client, or by setting the `TAVILY_PROJECT` environment variable. ## Session Tracking You can optionally include session and anonymized user identifiers in your API requests as HTTP headers. Tavily uses these identifiers for attribution and analytics across multi-step user interactions and agent workflows. ```bash theme={null} curl -X POST https://api.tavily.com/search \ -H "Content-Type: application/json" \ -H "Authorization: Bearer tvly-YOUR_API_KEY" \ -H "X-Session-Id: 5874812a-2e9b-43ea-8978-6cc9225b587b" \ -H "X-Human-Id: h_4f9ac" \ -d '{"query": "Who is Leo Messi?"}' ``` **Headers:** * `X-Session-Id` — opaque identifier for a session of related requests. Lets you group multiple calls together (e.g. all requests from one user task or conversation). * `X-Human-Id` — opaque identifier for the end-user behind the request. Useful when a single API key serves many human users — it helps Tavily better understand multi-step interactions and improve response quality. For security, Tavily hashes human IDs before processing or storing them. When you use the Tavily MCP server or remote MCP server, `X-Session-Id` is populated automatically — you don't need to set it yourself. `X-Human-Id` can't be generated by the MCP server on its own, so it's only forwarded if your agent or developer provides it. See the [MCP documentation](/documentation/mcp) for details. # API Key Management Source: https://docs.tavily.com/documentation/best-practices/api-key-management Learn how to handle API key leaks and best practices for key rotation. ## What to do if your API key leaks If you suspect or know that your API key has been leaked (e.g., committed to a public repository, shared in a screenshot, or exposed in client-side code), **immediate action is required** to protect your account and quota. Follow these steps immediately: 1. **Log in to your account**: Go to the [Tavily Dashboard](https://app.tavily.com). 2. **Revoke the leaked key**: Navigate to the API Keys section. Identify the compromised key and delete or revoke it immediately. This will stop any unauthorized usage. 3. **Generate a new key**: Create a new API key to replace the compromised one. 4. **Update your applications**: Replace the old key with the new one in your environment variables, secrets management systems, and application code. If you notice any unusual activity or usage spikes associated with the leaked key before you revoked it, please contact [support@tavily.com](mailto:support@tavily.com) for assistance. ## Rotating your API keys As a general security best practice, we recommend rotating your API keys periodically (e.g., every 90 days). This minimizes the impact if a key is ever compromised without your knowledge. ### How to rotate your keys safely To rotate your keys without downtime: 1. **Generate a new key**: Create a new API key in the [Tavily Dashboard](https://app.tavily.com) while keeping the old one active. 2. **Update your application**: Deploy your application with the new API key. 3. **Verify functionality**: Ensure your application is working correctly with the new key. 4. **Revoke the old key**: Once you are confirmed that the new key is in use and everything is functioning as expected, delete the old API key from the dashboard. Never hardcode API keys in your source code. Always use environment variables or a secure secrets manager to store your credentials. # Best Practices for Crawl Source: https://docs.tavily.com/documentation/best-practices/best-practices-crawl Learn how to optimize crawl parameters, focus your crawls, and efficiently extract content from websites. ## Crawl vs Map Understanding when to use each API: | Feature | Crawl | Map | | ---------------------- | ---------------------------- | ------------------------ | | **Content extraction** | Full content | URLs only | | **Use case** | Deep content analysis | Site structure discovery | | **Speed** | Slower (extracts content) | Faster (URLs only) | | **Best for** | RAG, analysis, documentation | Sitemap generation | ### Use Crawl when you need: * Full content extraction from pages * Deep content analysis * Processing of paginated or nested content * Extraction of specific content patterns * Integration with RAG systems ### Use Map when you need: * Quick site structure discovery * URL collection without content extraction * Sitemap generation * Path pattern matching * Domain structure analysis ## Crawl Parameters ### Instructions Guide the crawl with natural language to focus on relevant content: ```json theme={null} { "url": "example.com", "max_depth": 2, "instructions": "Find all documentation pages about Python" } ``` **When to use instructions:** * To focus crawling on specific topics or content types * When you need semantic filtering of pages * For agentic use cases where relevance is critical ### Chunks per Source Control the amount of content returned per page to prevent context window explosion: ```json theme={null} { "url": "example.com", "instructions": "Find all documentation about authentication", "chunks_per_source": 3 } ``` **Key benefits:** * Returns only relevant content snippets (max 500 characters each) instead of full page content * Prevents context window from exploding in agentic use cases * Chunks appear in `raw_content` as: ` [...] [...] ` > `chunks_per_source` is only available when instructions are provided. ### Depth and breadth | Parameter | Description | Impact | | ------------- | ----------------------------------------------- | -------------------------- | | `max_depth` | How many levels deep to crawl from starting URL | Exponential latency growth | | `max_breadth` | Maximum links to follow per page | Horizontal spread | | `limit` | Total maximum pages to crawl | Hard cap on pages | **Performance tip:** Each level of depth increases crawl time exponentially. Start with `max_depth=1` and increase as needed. ```json theme={null} // Conservative crawl { "url": "example.com", "max_depth": 1, "max_breadth": 20, "limit": 20 } // Comprehensive crawl { "url": "example.com", "max_depth": 3, "max_breadth": 100, "limit": 500 } ``` ## Filtering and Focusing ### Path patterns Use regex patterns to include or exclude specific paths: ```json theme={null} // Target specific sections { "url": "example.com", "select_paths": ["/blog/.*", "/docs/.*", "/guides/.*"], "exclude_paths": ["/private/.*", "/admin/.*", "/test/.*"] } // Paginated content { "url": "example.com/blog", "max_depth": 2, "select_paths": ["/blog/.*", "/blog/page/.*"], "exclude_paths": ["/blog/tag/.*"] } ``` ### Domain filtering Control which domains to crawl: ```json theme={null} // Stay within subdomain { "url": "docs.example.com", "select_domains": ["^docs.example.com$"], "max_depth": 2 } // Exclude specific domains { "url": "example.com", "exclude_domains": ["^ads.example.com$", "^tracking.example.com$"], "max_depth": 2 } ``` ### Extract depth Controls extraction quality vs. speed. | Depth | When to use | | ----------------- | -------------------------------------- | | `basic` (default) | Simple content, faster processing | | `advanced` | Complex pages, tables, structured data | ```json theme={null} { "url": "docs.example.com", "max_depth": 2, "extract_depth": "advanced", "select_paths": ["/docs/.*"] } ``` ## Use Cases ### 1. Deep or Unlinked Content Many sites have content that's difficult to access through standard means: * Deeply nested pages not in main navigation * Paginated archives (old blog posts, changelogs) * Internal search-only content **Best Practice:** ```json theme={null} { "url": "example.com", "max_depth": 3, "max_breadth": 50, "limit": 200, "select_paths": ["/blog/.*", "/changelog/.*"], "exclude_paths": ["/private/.*", "/admin/.*"] } ``` ### 2. Structured but Nonstandard Layouts For content that's structured but not marked up in schema.org: * Documentation * Changelogs * FAQs **Best Practice:** ```json theme={null} { "url": "docs.example.com", "max_depth": 2, "extract_depth": "advanced", "select_paths": ["/docs/.*"] } ``` ### 3. Multi-modal Information Needs When you need to combine information from multiple sections: * Cross-referencing content * Finding related information * Building comprehensive knowledge bases **Best Practice:** ```json theme={null} { "url": "example.com", "max_depth": 2, "instructions": "Find all documentation pages that link to API reference docs", "extract_depth": "advanced" } ``` ### 4. Rapidly Changing Content For content that updates frequently: * API documentation * Product announcements * News sections **Best Practice:** ```json theme={null} { "url": "api.example.com", "max_depth": 1, "max_breadth": 100 } ``` ### 5. Behind Auth / Paywalls For content requiring authentication: * Internal knowledge bases * Customer help centers * Gated documentation **Best Practice:** ```json theme={null} { "url": "help.example.com", "max_depth": 2, "select_domains": ["^help.example.com$"], "exclude_domains": ["^public.example.com$"] } ``` ### 6. Complete Coverage / Auditing For comprehensive content analysis: * Legal compliance checks * Security audits * Policy verification **Best Practice:** ```json theme={null} { "url": "example.com", "max_depth": 3, "max_breadth": 100, "limit": 1000, "extract_depth": "advanced", "instructions": "Find all mentions of GDPR and data protection policies" } ``` ### 7. Semantic Search or RAG Integration For feeding content into LLMs or search systems: * RAG systems * Enterprise search * Knowledge bases **Best Practice:** ```json theme={null} { "url": "docs.example.com", "max_depth": 2, "extract_depth": "advanced", "include_images": true } ``` ### 8. Known URL Patterns When you have specific paths to crawl: * Sitemap-based crawling * Section-specific extraction * Pattern-based content collection **Best Practice:** ```json theme={null} { "url": "example.com", "max_depth": 1, "select_paths": ["/docs/.*", "/api/.*", "/guides/.*"], "exclude_paths": ["/private/.*", "/admin/.*"] } ``` ## Performance Optimization ### Depth vs. Performance * Each level of depth increases crawl time exponentially * Start with max\_depth: 1 and increase as needed * Use max\_breadth to control horizontal expansion * Set appropriate limit to prevent excessive crawling ### Rate Limiting * Respect site's robots.txt * Implement appropriate delays between requests * Monitor API usage and limits * Use appropriate error handling for rate limits ## Integration with Map Consider using Map before Crawl to: 1. Discover site structure 2. Identify relevant paths 3. Plan crawl strategy 4. Validate URL patterns **Example workflow:** 1. Use Map to get site structure 2. Analyze paths and patterns 3. Configure Crawl with discovered paths 4. Execute focused crawl **Benefits:** * Discover site structure before crawling * Identify relevant path patterns * Avoid unnecessary crawling * Validate URL patterns work correctly ## Common Pitfalls ### Excessive depth * **Problem:** Setting `max_depth=4` or higher * **Impact:** Exponential crawl time, unnecessary pages * **Solution:** Start with 1-2 levels, increase only if needed ### Unfocused crawling * **Problem:** No `instructions` provided, crawling entire site * **Impact:** Wasted resources, irrelevant content, context explosion * **Solution:** Use instructions to focus the crawl semantically ### Missing limits * **Problem:** No `limit` parameter set * **Impact:** Runaway crawls, unexpected costs * **Solution:** Always set a reasonable `limit` value ### Ignoring failed results * **Problem:** Not checking which pages failed extraction * **Impact:** Incomplete data, missed content * **Solution:** Monitor failed results and adjust parameters ## Use Session Tracking for Multi-Step Workflows When an agent issues several Tavily calls to answer a single user task — for example, retrieving sources, then extracting full content from a subset, then running follow-up searches — pass a **consistent `session_id` across all related calls**. If your agent serves multiple end-users behind a single API key, also pass a stable `human_id` per user. For security, Tavily hashes human IDs before processing or storing them. See the [SDK references](/sdk/python/reference#session-tracking) or the [API HTTP headers](/documentation/api-reference/introduction#session--user-tracking) for how to set these. ## Summary * Use instructions and chunks\_per\_source for focused, relevant results in agentic use cases * Start with conservative parameters (`max_depth=1, max_breadth=20`) * Use path patterns to focus crawling on relevant content * Choose appropriate extract\_depth based on content complexity * Set reasonable limits to prevent excessive crawling * Monitor failed results and adjust patterns accordingly * Use Map first to understand site structure * Implement error handling for rate limits and failures * Respect robots.txt and site policies * Optimize for your use case (speed vs. completeness) * Process results incrementally rather than waiting for full crawl * Use `session_id` and `human_id` to link related calls across multi-step agent workflows > Crawling is powerful but resource-intensive. Focus your crawls, start small, monitor results, and scale gradually based on actual needs. # Best Practices for Extract Source: https://docs.tavily.com/documentation/best-practices/best-practices-extract Learn how to optimize content extraction, choose the right approach, and configure parameters for better performance. ## Extract Parameters ### Query Use query to rerank extracted content chunks based on relevance: ```python theme={null} await tavily_client.extract( urls=["https://example.com/article"], query="machine learning applications in healthcare" ) ``` **When to use query:** * To extract only relevant portions of long documents * When you need focused content instead of full page extraction * For targeted information retrieval from specific URLs > When `query` is provided, chunks are reranked based on relevance to the query. ### Chunks Per Source Control the amount of content returned per URL to prevent context window explosion: ```python theme={null} await tavily_client.extract( urls=["https://example.com/article"], query="machine learning applications in healthcare", chunks_per_source=3 ) ``` **Key benefits:** * Returns only relevant content snippets (max 500 characters each) instead of full page content * Prevents context window from exploding * Chunks appear in `raw_content` as: ` [...] [...] ` * Must be between 1 and 5 chunks per source > `chunks_per_source` is only available when `query` is provided. **Example with multiple URLs:** ```python theme={null} await tavily_client.extract( urls=[ "https://example.com/ml-healthcare", "https://example.com/ai-diagnostics", "https://example.com/medical-ai" ], query="AI diagnostic tools accuracy", chunks_per_source=2 ) ``` This returns the 2 most relevant chunks from each URL, giving you focused, relevant content without overwhelming your context window. ## Extraction Approaches ### Search with include\_raw\_content Enable include\_raw\_content=true in Search API calls to retrieve both search results and extracted content simultaneously. ```python theme={null} response = await tavily_client.search( query="AI healthcare applications", include_raw_content=True, max_results=5 ) ``` **When to use:** * Quick prototyping * Simple queries where search results are likely relevant * Single API call convenience ### Direct Extract API Use the Extract API when you want control over which specific URLs to extract from. ```python theme={null} await tavily_client.extract( urls=["https://example.com/article1", "https://example.com/article2"], query="machine learning applications", chunks_per_source=3 ) ``` **When to use:** * You already have specific URLs to extract from * You want to filter or curate URLs before extraction * You need targeted extraction with query and chunks\_per\_source **Key difference:** The main distinction is control, with Extract you choose exactly which URLs to extract from, while Search with `include_raw_content` extracts from all search results. ## Extract Depth The `extract_depth` parameter controls extraction comprehensiveness: | Depth | Use case | | ----------------- | --------------------------------------------- | | `basic` (default) | Simple text extraction, faster processing | | `advanced` | Complex pages, tables, structured data, media | ### Using `extract_depth=advanced` Best for content requiring detailed extraction: ```python theme={null} await tavily_client.extract( url="https://example.com/complex-page", extract_depth="advanced" ) ``` **When to use advanced:** * Dynamic content or JavaScript-rendered pages * Tables and structured information * Embedded media and rich content * Higher extraction success rates needed `extract_depth=advanced` provides better accuracy but increases latency and cost. Use `basic` for simple content. ## Advanced Filtering Strategies Beyond query-based filtering, consider these approaches for curating URLs before extraction: | Strategy | When to use | | ------------ | ---------------------------------------------- | | Re-ranking | Use dedicated re-ranking models for precision | | LLM-based | Let an LLM assess relevance before extraction | | Clustering | Group similar documents, extract from clusters | | Domain-based | Filter by trusted domains before extracting | | Score-based | Filter search results by relevance score | ### Example: Score-based filtering ```python theme={null} import asyncio from tavily import AsyncTavilyClient tavily_client = AsyncTavilyClient(api_key="tvly-YOUR_API_KEY") async def filtered_extraction(): # Search first response = await tavily_client.search( query="AI healthcare applications", search_depth="advanced", max_results=20 ) # Filter by relevance score (>0.5) relevant_urls = [ result['url'] for result in response.get('results', []) if result.get('score', 0) > 0.5 ] # Extract from filtered URLs with targeted query extracted_data = await tavily_client.extract( urls=relevant_urls, query="machine learning diagnostic tools", chunks_per_source=3, extract_depth="advanced" ) return extracted_data asyncio.run(filtered_extraction()) ``` ## Integration with Search ### Optimal workflow * **Search** to discover relevant URLs * **Filter** by relevance score, domain, or content snippet * **Re-rank** if needed using specialized models * **Extract** from top-ranked sources with query and chunks\_per\_source * **Validate** extracted content quality * **Process** for your RAG or AI application ### Example end-to-end pipeline ```python theme={null} async def content_pipeline(topic): # 1. Search with sub-queries queries = generate_subqueries(topic) responses = await asyncio.gather( *[tavily_client.search(**q) for q in queries] ) # 2. Filter and aggregate urls = [] for response in responses: urls.extend([ r['url'] for r in response['results'] if r['score'] > 0.5 ]) # 3. Deduplicate urls = list(set(urls))[:20] # Top 20 unique URLs # 4. Extract with error handling extracted = await asyncio.gather( *(tavily_client.extract(url, extract_depth="advanced") for url in urls), return_exceptions=True ) # 5. Filter successful extractions return [e for e in extracted if not isinstance(e, Exception)] ``` ## Use Session Tracking for Multi-Step Workflows When an agent issues several Tavily calls to answer a single user task — for example, retrieving sources, then extracting full content from a subset, then running follow-up searches — pass a **consistent `session_id` across all related calls**. If your agent serves multiple end-users behind a single API key, also pass a stable `human_id` per user. For security, Tavily hashes human IDs before processing or storing them. See the [SDK references](/sdk/python/reference#session-tracking) or the [API HTTP headers](/documentation/api-reference/introduction#session--user-tracking) for how to set these. ## Summary 1. **Use query and chunks\_per\_source** for targeted, focused extraction 2. **Choose Extract API** when you need control over which URLs to extract from 3. **Filter URLs** before extraction using scores, re-ranking, or domain trust 4. **Choose appropriate extract\_depth** based on content complexity 5. **Process URLs concurrently** with async operations for better performance 6. **Implement error handling** to manage failed extractions gracefully 7. **Validate extracted content** before downstream processing 8. **Optimize costs** by extracting only necessary content with chunks\_per\_source 9. **Use `session_id` and `human_id`** to link related calls across multi-step agent workflows > Start with query and chunks\_per\_source for targeted extraction. Filter URLs strategically, extract with appropriate depth, and handle errors gracefully for production-ready pipelines. # Best Practices for Research Source: https://docs.tavily.com/documentation/best-practices/best-practices-research Learn how to write effective prompts, choose the right model, and configure output formats for better research results. ## Prompting Define a **clear goal** with all **details** and **direction**. * **Be specific when you can.** If you already know important details, include them (e.g., target market or industry, key competitors, customer segments, geography, or constraints). * **Only stay open-ended if you don't know details and want discovery.** If you're exploring broadly, make that explicit (e.g., "tell me about the most impactful AI innovations in healthcare in 2025"). * **Avoid contradictions.** Don't include conflicting information, constraints, or goals in your prompt. * **Share what's already known.** Include prior assumptions, existing decisions, or baseline knowledge—so the research doesn't repeat what you already have. * **Keep the prompt clean and directed.** Use a clear task statement + essential context + desired output format. Avoid messy background dumps. ### Example Queries ```text theme={null} "Research the company ____ and it's 2026 outlook. Provide a brief overview of the company, its products, services, and market position." ``` ```text theme={null} "Conduct a competitive analysis of ____ in 2026. Identify their main competitors, compare market positioning, and analyze key differentiators." ``` ```text theme={null} "We're evaluating Notion as a potential partner. We already know they primarily serve SMB and mid-market teams, expanded their AI features significantly in 2025, and most often compete with Confluence and ClickUp. Research Notion's 2026 outlook, including market position, growth risks, and where a partnership could be most valuable. Include citations." ``` ## Model | Model | Best For | | ------ | -------------------------------------------------------------------- | | `pro` | Comprehensive, multi-agent research for complex, multi-domain topics | | `mini` | Targeted, efficient research for narrow or well-scoped questions | | `auto` | When you're unsure how complex research will be | ### Pro Provides comprehensive, multi-agent research suited for complex topics that span multiple subtopics or domains. Use when you want deeper analysis, more thorough reports, or maximum accuracy. ```json theme={null} { "input": "Analyze the competitive landscape for ____ in the SMB market, including key competitors, positioning, pricing models, customer segments, recent product moves, and where ____ has defensible advantages or risks over the next 2–3 years.", "model": "pro" } ``` ### Mini Optimized for targeted, efficient research. Works best for narrow or well-scoped questions where you still benefit from agentic searching and synthesis, but don't need extensive depth. ```json theme={null} { "input": "What are the top 5 competitors to ____ in the SMB market, and how do they differentiate?", "model": "mini" } ``` ## Structured Output vs. Report * **Structured Output** - Best for data enrichment, pipelines, or powering UIs with specific fields. * **Report** — Best for reading, sharing, or displaying verbatim (e.g., chat interfaces, briefs, newsletters). ### Formatting Your Schema * **Write clear field descriptions.** In 1–3 sentences, say exactly what the field should contain and what to look for. This makes it easier for our models to interpret what you're looking for. * **Match the structure you actually need.** Use the right types (arrays, objects, enums) instead of packing multiple values into one string (e.g., `competitors: string[]`, not `"A, B, C"`). * **Avoid duplicate or overlapping fields.** Keep each field unique and specific - contradictions or redundancy can confuse our models. ## Streaming vs. Polling Best for user interfaces where you want real-time updates. Best for background processes where you check status periodically. See streaming in action with the [live demo](https://chat-research.tavily.com/). ## Use Session Tracking for Multi-Step Workflows When an agent issues several Tavily calls to answer a single user task — for example, retrieving sources, then extracting full content from a subset, then running follow-up searches — pass a **consistent `session_id` across all related calls**. If your agent serves multiple end-users behind a single API key, also pass a stable `human_id` per user. For security, Tavily hashes human IDs before processing or storing them. See the [SDK references](/sdk/python/reference#session-tracking) or the [API HTTP headers](/documentation/api-reference/introduction#session--user-tracking) for how to set these. # Best Practices for Search Source: https://docs.tavily.com/documentation/best-practices/best-practices-search Learn how to optimize your queries, refine search filters, and leverage advanced parameters for better performance. ## Query Optimization ### Keep your query under 400 characters Keep queries concise—under **400 characters**. Think of it as a query for an agent performing web search, not long-form prompts. ### Break complex queries into sub-queries For complex or multi-topic queries, send separate focused requests: ```json theme={null} // Instead of one massive query, break it down: { "query": "Competitors of company ABC." } { "query": "Financial performance of company ABC." } { "query": "Recent developments of company ABC." } ``` ## Search Depth The `search_depth` parameter controls the tradeoff between latency and relevance: Latency vs Relevance by Search Depth *This chart is a heuristic and is not to scale.* | Depth | Latency | Relevance | Content Type | | ------------ | ------- | --------- | ------------ | | `ultra-fast` | Lowest | Lower | Content | | `fast` | Low | Good | Chunks | | `basic` | Medium | High | Content | | `advanced` | Higher | Highest | Chunks | ### Content types | Type | Description | | ----------- | --------------------------------------------------------- | | **Content** | NLP-based summary of the page, providing general context | | **Chunks** | Short snippets reranked by relevance to your search query | Use **chunks** when you need highly targeted information aligned with your query. Use **content** when a general page summary is sufficient. ### Fast + Ultra-Fast | Depth | When to use | | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `ultra-fast` | When latency is absolutely crucial. Delivers near-instant results, prioritizing speed over relevance. Ideal for real-time applications where response time is critical. | | `fast` | When latency is more important than relevance, but you want results in reranked chunks format. Good for applications that need quick, targeted snippets. | | `basic` | A solid balance between relevance and latency. Best for general-purpose searches where you need quality results without the overhead of advanced processing. | | `advanced` | When you need the highest relevance and are willing to trade off latency. Best for queries seeking specific, detailed information. | ### Using `search_depth=advanced` Best for queries seeking specific information: ```json theme={null} { "query": "How many countries use Monday.com?", "search_depth": "advanced", "chunks_per_source": 3, "include_raw_content": true } ``` ## Filtering Results ### By date | Parameter | Description | | ------------------------- | ------------------------------------------------------- | | `time_range` | Filter by relative time: `day`, `week`, `month`, `year` | | `start_date` / `end_date` | Filter by specific date range (format: `YYYY-MM-DD`) | ```json theme={null} { "query": "latest ML trends", "time_range": "month" } { "query": "AI news", "start_date": "2025-01-01", "end_date": "2025-02-01" } ``` ### By topic Use `topic` to filter by content type. Set to `news` for news sources (includes `published_date` metadata): ```json theme={null} { "query": "What happened today in NY?", "topic": "news" } ``` ### By domain | Parameter | Description | | ----------------- | ------------------------------------- | | `include_domains` | Limit to specific domains | | `exclude_domains` | Filter out specific domains | | `country` | Boost results from a specific country | ```json theme={null} // Restrict to LinkedIn profiles { "query": "CEO background at Google", "include_domains": ["linkedin.com/in"] } // Exclude irrelevant domains { "query": "US economy trends", "exclude_domains": ["espn.com", "vogue.com"] } // Boost results from a country { "query": "tech startup funding", "country": "united states" } // Wildcard: limit to .com, exclude specific site { "query": "AI news", "include_domains": ["*.com"], "exclude_domains": ["example.com"] } ``` Keep domain lists short and relevant for best results. ## Response Content ### `max_results` Limits results returned (default: `5`). Setting too high may return lower-quality results. ### `include_raw_content` Returns full extracted page content. For comprehensive extraction, consider a two-step process: 1. Search to retrieve relevant URLs 2. Use [Extract API](/documentation/best-practices/best-practices-extract#2-two-step-process-search-then-extract) to get content ### `auto_parameters` Tavily automatically configures parameters based on query intent. Your explicit values override automatic ones. ```json theme={null} { "query": "impact of AI in education policy", "auto_parameters": true, "search_depth": "basic" // Override to control cost } ``` `auto_parameters` may set `search_depth` to `advanced` (2 credits). Set it manually to control cost. ## Exact Match Use `exact_match` only when searching for a specific name or phrase that must appear verbatim in the source content. Wrap the phrase in quotes within your query: ```json theme={null} { "query": "\"John Smith\" CEO Acme Corp", "exact_match": true } ``` Because this narrows retrieval, it may return fewer results or empty result fields when no exact matches are found. Best suited for: * **Due diligence** — finding information on a specific person or entity * **Data enrichment** — retrieving details about a known company or individual * **Legal/compliance** — locating exact names or phrases in public records ## Async & Performance Use async calls for concurrent requests: ```python theme={null} import asyncio from tavily import AsyncTavilyClient tavily_client = AsyncTavilyClient("tvly-YOUR_API_KEY") async def fetch_and_gather(): queries = ["latest AI trends", "future of quantum computing"] responses = await asyncio.gather( *(tavily_client.search(q) for q in queries), return_exceptions=True ) for response in responses: if isinstance(response, Exception): print(f"Failed: {response}") else: print(response) asyncio.run(fetch_and_gather()) ``` ## Post-Processing ### Using metadata Leverage response metadata to refine results: | Field | Use case | | ------------- | ---------------------------------- | | `score` | Filter/rank by relevance score | | `title` | Keyword filtering on headlines | | `content` | Quick relevance check | | `raw_content` | Deep analysis and regex extraction | ### Score-based filtering The `score` indicates relevance between query and content. Higher is better, but the ideal threshold depends on your use case. ```python theme={null} # Filter results with score > 0.7 filtered = [r for r in results if r['score'] > 0.7] ``` ### Regex extraction Extract structured data from `raw_content`: ```python theme={null} import re # Extract location text = "Company: Tavily, Location: New York" match = re.search(r"Location: (\w+)", text) location = match.group(1) if match else None # "New York" # Extract all emails text = "Contact: john@example.com, support@tavily.com" emails = re.findall(r"[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}", text) ``` ## Use Session Tracking for Multi-Step Workflows When an agent issues several Tavily calls to answer a single user task — for example, retrieving sources, then extracting full content from a subset, then running follow-up searches — pass a **consistent `session_id` across all related calls**. If your agent serves multiple end-users behind a single API key, also pass a stable `human_id` per user. For security, Tavily hashes human IDs before processing or storing them. See the [SDK references](/sdk/python/reference#session-tracking) or the [API HTTP headers](/documentation/api-reference/introduction#session--user-tracking) for how to set these. # Deactivate Keys Source: https://docs.tavily.com/documentation/enterprise/deactivate-keys POST /deactivate-keys Deactivate API keys either in bulk by `request_id` or individually. **Option A — Deactivate by request ID:** Pass a `request_id` in the request body to deactivate all keys from that generation request. **Option B — Deactivate individual key:** Set the key you want to deactivate in the `Authorization` header. No request body is required. **Who can use this feature?** This feature is available on the Enterprise plan. [Talk to an expert](https://tavily.com/enterprise) to learn more. # Generate Keys Source: https://docs.tavily.com/documentation/enterprise/generate-keys POST /generate-keys Generate one or more API keys with custom configuration. **Who can use this feature?** This feature is available on the Enterprise plan. [Talk to an expert](https://tavily.com/enterprise) to learn more. # Key Info Source: https://docs.tavily.com/documentation/enterprise/key-info GET /key-info Get information about an API key. The key to query is specified in the `Authorization` header. **Who can use this feature?** This feature is available on the Enterprise plan. [Talk to an expert](https://tavily.com/enterprise) to learn more. # Organization Usage Source: https://docs.tavily.com/documentation/enterprise/org-usage POST /org-usage Retrieve usage (credits), pay-as-you-go USD cost, and request counts for **every API key under an organization you own**, mirroring the platform's Usage analytics page. Identify the organization by **name** in the request body. Authenticate with the organization owner's **personal API key** — the key from the owner's own personal account, **not** an organization or enterprise API key. Supports date-range, project, and depth filtering. **Access to this API is an enterprise feature only.** [Talk to an expert](https://tavily.com/enterprise) to learn more. Authenticate with the organization **owner's personal API key** — the key from the owner's own **personal account**, *not* an organization or enterprise API key. Identify the organization by **name** in the request body. # Help Center Source: https://docs.tavily.com/documentation/help # OpenAI Agent Builder Source: https://docs.tavily.com/documentation/integrations/agent-builder Integrate OpenAI’s Agent Builder with Tavily’s MCP server to empower your AI agents with real-time web access. ## Getting Started Before you begin, make sure you have: * A [Tavily API key](https://app.tavily.com/home) (sign up for free if you don't have one) * An OpenAI account with [organization verification](https://help.openai.com/en/articles/10910291-api-organization-verification) Navigate to [Agent Builder](https://platform.openai.com/agent-builder) and click **Create New Workflow** to begin building your AI agent. Create New Workflow Click on the agent node in your workflow canvas to open the configuration panel. Agent Block In the configuration panel, locate and click on **Tools** in the sidebar to add external capabilities to your agent. Tools Panel In the MCP configuration section, paste the Tavily MCP server URL: ```bash theme={null} https://mcp.tavily.com/mcp/?tavilyApiKey=YOUR_API_KEY ``` Remember to replace `YOUR_API_KEY` with your actual Tavily API key. Need an API key? Get one instantly from your [Tavily dashboard](https://app.tavily.com/home) Click **Connect** to establish the connection to Tavily. Tavily MCP Configuration Once connected, you'll see Tavily's suite of tools available: * **tavily\_search** - Execute a search query. * **tavily\_extract** - Extract web page content from one or more specified URLs. * **tavily\_map** - Traverses websites like a graph and can explore hundreds of paths in parallel with intelligent discovery to generate comprehensive site maps. * **tavily\_crawl** - Traversal tool that can explore hundreds of paths in parallel with built-in extraction and intelligent discovery. Select the tools you want to activate for this agent, then click **Add** to integrate them. Tavily Tools Available Now configure your agent: * **Name**: Choose a descriptive name for your agent * **Instructions**: Define the agent's role and how it should use Tavily's tools * **Reasoning**: Set the appropriate reasoning effort level * Click **Preview** to test the configuration **Sample instructions:** ``` You are a research assistant that uses Tavily to search the web for up-to-date information. When the user asks questions that require current information, use Tavily to find relevant and recent sources. ``` Agent Configuration Panel Test your agent with queries that require real-time information to verify everything is working as expected. Agent Testing Interface ## Real-World Applications ### Market Research Agents Build agents that continuously monitor industry trends, competitor activities, and market sentiment by searching for and analyzing relevant business information. ### Content Curation Systems Create agents that automatically find, extract, and summarize content from multiple sources based on your specific criteria and preferences. ### Competitive Intelligence Develop agents that crawl competitor websites, map their content strategies, and extract pricing, features, and positioning information. ### News & Event Monitors Build agents that track breaking news on specific topics by leveraging Tavily's news search mode, providing real-time updates with citations. # Agno Source: https://docs.tavily.com/documentation/integrations/agno Tavily is now available for integration through Agno. ## Introduction Integrate [Tavily with Agno](https://docs.agno.com/tools/toolkits/search/tavily#tavily) to enhance your AI agents with powerful web search capabilities. Agno provides a lightweight library for building agents with memory, knowledge, tools, and reasoning, making it easy to incorporate real-time web search and data extraction into your AI applications. ## Step-by-Step Integration Guide ### Step 1: Install Required Packages Install the necessary Python packages: ```bash theme={null} pip install agno tavily-python ``` ### Step 2: Set Up API Keys * **Tavily API Key:** [Get your Tavily API key here](https://app.tavily.com/home) * **OpenAI API Key:** [Get your OpenAI API key here](https://platform.openai.com/account/api-keys) Set these as environment variables in your terminal or add them to your environment configuration file: ```bash theme={null} export TAVILY_API_KEY=your_tavily_api_key export OPENAI_API_KEY=your_openai_api_key ``` ### Step 3: Initialize Agno Agent with Tavily Tools ```python theme={null} from agno.agent import Agent from agno.tools.tavily import TavilyTools import os # Initialize the agent with Tavily tools agent = Agent( tools=[TavilyTools( search=True, # Enable search functionality max_tokens=8000, # Increase max tokens for more detailed results search_depth="advanced", # Use advanced search for comprehensive results format="markdown" # Format results as markdown )], show_tool_calls=True ) ``` ### Step 4: Example Use Cases ```python theme={null} # Example 1: Basic search with default parameters agent.print_response("Latest developments in quantum computing", markdown=True) # Example 2: Market research with multiple parameters agent.print_response( "Analyze the competitive landscape of AI-powered customer service solutions in 2024, " "focusing on market leaders and emerging trends", markdown=True ) # Example 3: Technical documentation search agent.print_response( "Find the latest documentation and tutorials about Python async programming, " "focusing on asyncio and FastAPI", markdown=True ) # Example 4: News aggregation agent.print_response( "Gather the latest news about artificial intelligence from tech news websites " "published in the last week", markdown=True ) ``` ## Additional Use Cases 1. **Content Curation**: Gather and organize information from multiple sources 2. **Real-time Data Integration**: Keep your AI agents up-to-date with the latest information 3. **Technical Documentation**: Search and analyze technical documentation 4. **Market Analysis**: Conduct comprehensive market research and analysis # Anthropic Source: https://docs.tavily.com/documentation/integrations/anthropic Integrate Tavily with Anthropic Claude to enhance your AI applications with real-time web search capabilities. ## Installation Install the required packages: ```bash theme={null} pip install anthropic tavily-python ``` ## Setup Set up your API keys: ```python theme={null} import os # Set your API keys os.environ["OPENAI_API_KEY"] = "your-openai-api-key" os.environ["TAVILY_API_KEY"] = "your-tavily-api-key" ``` ## Using Tavily with Anthropic tool calling ```python theme={null} import json from anthropic import Anthropic from tavily import TavilyClient # Initialize clients client = Anthropic(api_key=os.environ["ANTHROPIC_API_KEY"]) tavily_client = TavilyClient(api_key=os.environ["TAVILY_API_KEY"]) MODEL_NAME = "claude-sonnet-4-20250514" ``` ## Implementation ### System prompt Define a system prompt to guide Claude's behavior: ```python theme={null} SYSTEM_PROMPT = ( "You are a research assistant. Use the tavily_search tool when needed. " "After tools run and tool results are provided back to you, produce a concise, well-structured summary " "with a short bullet list of key points and a 'Sources' section listing the URLs. " ) ``` ### Tool schema Define the Tavily search tool for Claude with enhanced parameters: ```python theme={null} tools = [ { "name": "tavily_search", "description": "Search the web using Tavily. Return relevant links & summaries.", "input_schema": { "type": "object", "properties": { "query": {"type": "string", "description": "Search query string."}, "max_results": {"type": "integer", "default": 5}, "search_depth": {"type": "string", "enum": ["basic", "advanced"]}, }, "required": ["query"] } } ] ``` [Scroll to the bottom to find the full json schema for search, extract, map and crawl](#tavily-endpoints-schema-for-anthropic-tool-definition) ### Tool execution Create optimized functions to handle Tavily searches: ```python theme={null} def tavily_search(**kwargs): return tavily_client.search(**kwargs) def process_tool_call(name, args): if name == "tavily_search": return tavily_search(**args) raise ValueError(f"Unknown tool: {name}") ``` ### Main chat function The main function that handles the two-step conversation with Claude: ```python theme={null} def chat_with_claude(user_message: str): print(f"\n{'='*50}\nUser Message: {user_message}\n{'='*50}") # ---- Call 1: allow tools so Claude can ask for searches ---- initial_response = client.messages.create( model=MODEL_NAME, max_tokens=4096, system=SYSTEM_PROMPT, messages=[{"role": "user", "content": [{"type": "text", "text": user_message}]}], tools=tools, ) print("\nInitial Response stop_reason:", initial_response.stop_reason) print("Initial content:", initial_response.content) # If Claude already answered in text, return it if initial_response.stop_reason != "tool_use": final_text = next((b.text for b in initial_response.content if getattr(b, "type", None) == "text"), None) print("\nFinal Response:", final_text) return final_text # ---- Execute ALL tool_use blocks from Call 1 ---- tool_result_blocks = [] for block in initial_response.content: if getattr(block, "type", None) == "tool_use": result = process_tool_call(block.name, block.input) tool_result_blocks.append({ "type": "tool_result", "tool_use_id": block.id, "content": [{"type": "text", "text": json.dumps(result)}], }) # ---- Call 2: NO tools; ask for the final summary from tool results ---- final_response = client.messages.create( model=MODEL_NAME, max_tokens=4096, system=SYSTEM_PROMPT, messages=[ {"role": "user", "content": [{"type": "text", "text": user_message}]}, {"role": "assistant", "content": initial_response.content}, # Claude's tool requests {"role": "user", "content": tool_result_blocks}, # Your tool results {"role": "user", "content": [{"type": "text", "text": "Please synthesize the final answer now based on the tool results above. " "Include 3–7 bullets and a 'Sources' section with URLs."}]}, ], ) final_text = next((b.text for b in final_response.content if getattr(b, "type", None) == "text"), None) print("\nFinal Response:", final_text) return final_text ``` ### Usage example ```python theme={null} # Example usage chat_with_claude("What is trending now in the agents space in 2025?") ``` ```python theme={null} import os import json from anthropic import Anthropic from tavily import TavilyClient client = Anthropic(api_key=os.environ["ANTHROPIC_API_KEY"]) tavily_client = TavilyClient(api_key=os.environ["TAVILY_API_KEY"]) MODEL_NAME = "claude-sonnet-4-20250514" SYSTEM_PROMPT = ( "You are a research assistant. Use the tavily_search tool when needed. " "After tools run and tool results are provided back to you, produce a concise, well-structured summary " "with a short bullet list of key points and a 'Sources' section listing the URLs. " ) # ---- Define your client-side tool schema for Anthropic ---- tools = [ { "name": "tavily_search", "description": "Search the web using Tavily. Return relevant links & summaries.", "input_schema": { "type": "object", "properties": { "query": {"type": "string", "description": "Search query string."}, "max_results": {"type": "integer", "default": 5}, "search_depth": {"type": "string", "enum": ["basic", "advanced"]}, }, "required": ["query"] } } ] # ---- Your local tool executor ---- def tavily_search(**kwargs): return tavily_client.search(**kwargs) def process_tool_call(name, args): if name == "tavily_search": return tavily_search(**args) raise ValueError(f"Unknown tool: {name}") def chat_with_claude(user_message: str): print(f"\n{'='*50}\nUser Message: {user_message}\n{'='*50}") # ---- Call 1: allow tools so Claude can ask for searches ---- initial_response = client.messages.create( model=MODEL_NAME, max_tokens=4096, system=SYSTEM_PROMPT, messages=[{"role": "user", "content": [{"type": "text", "text": user_message}]}], tools=tools, ) print("\nInitial Response stop_reason:", initial_response.stop_reason) print("Initial content:", initial_response.content) # If Claude already answered in text, return it if initial_response.stop_reason != "tool_use": final_text = next((b.text for b in initial_response.content if getattr(b, "type", None) == "text"), None) print("\nFinal Response:", final_text) return final_text # ---- Execute ALL tool_use blocks from Call 1 ---- tool_result_blocks = [] for block in initial_response.content: if getattr(block, "type", None) == "tool_use": result = process_tool_call(block.name, block.input) tool_result_blocks.append({ "type": "tool_result", "tool_use_id": block.id, "content": [{"type": "text", "text": json.dumps(result)}], }) # ---- Call 2: NO tools; ask for the final summary from tool results ---- final_response = client.messages.create( model=MODEL_NAME, max_tokens=4096, system=SYSTEM_PROMPT, messages=[ {"role": "user", "content": [{"type": "text", "text": user_message}]}, {"role": "assistant", "content": initial_response.content}, # Claude's tool requests {"role": "user", "content": tool_result_blocks}, # Your tool results {"role": "user", "content": [{"type": "text", "text": "Please synthesize the final answer now based on the tool results above. " "Include 3–7 bullets and a 'Sources' section with URLs."}]}, ], ) final_text = next((b.text for b in final_response.content if getattr(b, "type", None) == "text"), None) print("\nFinal Response:", final_text) return final_text # Example usage chat_with_claude("What is trending now in the agents space in 2025?") ``` ## Tavily endpoints schema for Anthropic tool definition > **Note:** When using these schemas, you can customize which parameters are exposed to the model based on your specific use case. For example, if you are building a finance application, you might set `topic`: `"finance"` for all queries without exposing the `topic` parameter. This way, the LLM can focus on deciding other parameters, such as `time_range`, `country`, and so on, based on the user's request. Feel free to modify these schemas as needed and only pass the parameters that are relevant to your application. > **API Format:** The schemas below are for Anthropic's tool format. Each tool uses the `input_schema` structure with `type`, `properties`, and `required` fields. ```python theme={null} tools = [ { "name": "tavily_search", "description": "A powerful web search tool that provides comprehensive, real-time results using Tavily's AI search engine. Returns relevant web content with customizable parameters for result count, content type, and domain filtering. Ideal for gathering current information, news, and detailed web content analysis.", "input_schema": { "type": "object", "required": ["query"], "properties": { "query": { "type": "string", "description": "Search query" }, "auto_parameters": { "type": "boolean", "default": False, "description": "Auto-tune parameters based on the query. Explicit values you pass still win." }, "topic": { "type": "string", "enum": ["general", "news","finance"], "default": "general", "description": "The category of the search. This will determine which of our agents will be used for the search" }, "search_depth": { "type": "string", "enum": ["basic", "advanced"], "default": "basic", "description": "The depth of the search. It can be 'basic' or 'advanced'" }, "chunks_per_source": { "type": "integer", "minimum": 1, "maximum": 3, "default": 3, "description": "Chunks are short content snippets (maximum 500 characters each) pulled directly from the source." }, "max_results": { "type": "integer", "minimum": 0, "maximum": 20, "default": 5, "description": "The maximum number of search results to return" }, "time_range": { "type": "string", "enum": ["day", "week", "month", "year"], "description": "The time range back from the current date to include in the search results. This feature is available for both 'general' and 'news' search topics" }, "start_date": { "type": "string", "format": "date", "description": "Will return all results after the specified start date. Required to be written in the format YYYY-MM-DD." }, "end_date": { "type": "string", "format": "date", "description": "Will return all results before the specified end date. Required to be written in the format YYYY-MM-DD" }, "include_answer": { "description": "Include an LLM-generated answer. 'basic' is brief; 'advanced' is more detailed.", "oneOf": [ {"type": "boolean"}, {"type": "string", "enum": ["basic", "advanced"]} ], "default": False }, "include_raw_content": { "description": "Include the cleaned and parsed HTML content of each search result", "oneOf": [ {"type": "boolean"}, {"type": "string", "enum": ["markdown", "text"]} ], "default": False }, "include_images": { "type": "boolean", "default": False, "description": "Include a list of query-related images in the response" }, "include_image_descriptions": { "type": "boolean", "default": False, "description": "Include a list of query-related images and their descriptions in the response" }, "include_favicon": { "type": "boolean", "default": False, "description": "Whether to include the favicon URL for each result" }, "include_usage": { "type": "boolean", "default": False, "description": "Whether to include credit usage information in the response" }, "include_domains": { "type": "array", "items": {"type": "string"}, "maxItems": 300, "description": "A list of domains to specifically include in the search results, if the user asks to search on specific sites set this to the domain of the site" }, "exclude_domains": { "type": "array", "items": {"type": "string"}, "maxItems": 150, "description": "List of domains to specifically exclude, if the user asks to exclude a domain set this to the domain of the site" }, "country": { "type": "string", "enum": ["afghanistan", "albania", "algeria", "andorra", "angola", "argentina", "armenia", "australia", "austria", "azerbaijan", "bahamas", "bahrain", "bangladesh", "barbados", "belarus", "belgium", "belize", "benin", "bhutan", "bolivia", "bosnia and herzegovina", "botswana", "brazil", "brunei", "bulgaria", "burkina faso", "burundi", "cambodia", "cameroon", "canada", "cape verde", "central african republic", "chad", "chile", "china", "colombia", "comoros", "congo", "costa rica", "croatia", "cuba", "cyprus", "czech republic", "denmark", "djibouti", "dominican republic", "ecuador", "egypt", "el salvador", "equatorial guinea", "eritrea", "estonia", "ethiopia", "fiji", "finland", "france", "gabon", "gambia", "georgia", "germany", "ghana", "greece", "guatemala", "guinea", "haiti", "honduras", "hungary", "iceland", "india", "indonesia", "iran", "iraq", "ireland", "israel", "italy", "jamaica", "japan", "jordan", "kazakhstan", "kenya", "kuwait", "kyrgyzstan", "latvia", "lebanon", "lesotho", "liberia", "libya", "liechtenstein", "lithuania", "luxembourg", "madagascar", "malawi", "malaysia", "maldives", "mali", "malta", "mauritania", "mauritius", "mexico", "moldova", "monaco", "mongolia", "montenegro", "morocco", "mozambique", "myanmar", "namibia", "nepal", "netherlands", "new zealand", "nicaragua", "niger", "nigeria", "north korea", "north macedonia", "norway", "oman", "pakistan", "panama", "papua new guinea", "paraguay", "peru", "philippines", "poland", "portugal", "qatar", "romania", "russia", "rwanda", "saudi arabia", "senegal", "serbia", "singapore", "slovakia", "slovenia", "somalia", "south africa", "south korea", "south sudan", "spain", "sri lanka", "sudan", "sweden", "switzerland", "syria", "taiwan", "tajikistan", "tanzania", "thailand", "togo", "trinidad and tobago", "tunisia", "turkey", "turkmenistan", "uganda", "ukraine", "united arab emirates", "united kingdom", "united states", "uruguay", "uzbekistan", "venezuela", "vietnam", "yemen", "zambia", "zimbabwe"], "description": "Boost search results from a specific country. This will prioritize content from the selected country in the search results. Available only if topic is general. Country names MUST be written in lowercase, plain English, with spaces and no underscores." } } } } ] ``` ```python theme={null} tools = [ { "name": "tavily_extract", "description": "A powerful web content extraction tool that retrieves and processes raw content from specified URLs, ideal for data collection, content analysis, and research tasks.", "input_schema": { "type": "object", "required": ["urls"], "properties": { "urls": { "type": "string", "description": "List of URLs to extract content from" }, "include_images": { "type": "boolean", "default": False, "description": "Include a list of images extracted from the urls in the response" }, "include_favicon": { "type": "boolean", "default": False, "description": "Whether to include the favicon URL for each result" }, "include_usage": { "type": "boolean", "default": False, "description": "Whether to include credit usage information in the response" }, "extract_depth": { "type": "string", "enum": ["basic", "advanced"], "default": "basic", "description": "Depth of extraction - 'basic' or 'advanced', if urls are linkedin use 'advanced' or if explicitly told to use advanced" }, "timeout": { "type": "number", "enum": ["basic", "advanced"], "minimum": 0, "maximum": 60, "default": None, "description": "Maximum time in seconds to wait for the URL extraction before timing out. Must be between 1.0 and 60.0 seconds. If not specified, default timeouts are applied based on extract_depth: 10 seconds for basic extraction and 30 seconds for advanced extraction" }, "format": { "type": "string", "enum": ["markdown", "text"], "default": "markdown", "description": "The format of the extracted web page content. markdown returns content in markdown format. text returns plain text and may increase latency." } } } } ] ``` ```python theme={null} tools = [ { "name": "tavily_map", "description": "A powerful web mapping tool that creates a structured map of website URLs, allowing you to discover and analyze site structure, content organization, and navigation paths. Perfect for site audits, content discovery, and understanding website architecture.", "input_schema": { "type": "object", "required": ["url"], "properties": { "url": { "type": "string", "description": "The root URL to begin the mapping" }, "instructions": { "type": "string", "description": "Natural language instructions for the crawler" }, "max_depth": { "type": "integer", "minimum": 1, "maximum": 5, "default": 1, "description": "Max depth of the mapping. Defines how far from the base URL the crawler can explore" }, "max_breadth": { "type": "integer", "minimum": 1, "default": 20, "description": "Max number of links to follow per level of the tree (i.e., per page)" }, "limit": { "type": "integer", "minimum": 1, "default": 50, "description": "Total number of links the crawler will process before stopping" }, "select_paths": { "type": "array", "items": {"type": "string"}, "description": "Regex patterns to select only URLs with specific path patterns (e.g., /docs/.*, /api/v1.*)" }, "select_domains": { "type": "array", "items": {"type": "string"}, "description": "Regex patterns to select crawling to specific domains or subdomains (e.g., ^docs\\.example\\.com$)" }, "exclude_paths": { "type": "array", "items": {"type": "string"}, "description": "Regex patterns to exclude URLs with specific path patterns (e.g., /admin/.*)." }, "exclude_domains": { "type": "array", "items": {"type": "string"}, "description": "Regex patterns to exclude specific domains or subdomains" }, "allow_external": { "type": "boolean", "default": True, "description": "Whether to allow following links that go to external domains" }, "categories": { "type": "array", "items": { "type": "string", "enum": ["Documentation", "Blog", "Careers","About","Pricing","Community","Developers","Contact","Media"] }, "description": "Filter URLs using predefined categories like documentation, blog, api, etc" }, "include_usage": { "type": "boolean", "default": False, "description": "Whether to include credit usage information in the response" } } } } ] ``` ```python theme={null} tools = [ { "name": "tavily_crawl", "description": "A powerful web crawler that initiates a structured web crawl starting from a specified base URL. The crawler expands from that point like a tree, following internal links across pages. You can control how deep and wide it goes, and guide it to focus on specific sections of the site.", "input_schema": { "type": "object", "required": ["url"], "properties": { "url": { "type": "string", "description": "The root URL to begin the crawl" }, "instructions": { "type": "string", "description": "Natural language instructions for the crawler" }, "max_depth": { "type": "integer", "minimum": 1, "maximum: 5, "default": 1, "description": "Max depth of the crawl. Defines how far from the base URL the crawler can explore." }, "max_breadth": { "type": "integer", "minimum": 1, "default": 20, "description": "Max number of links to follow per level of the tree (i.e., per page)" }, "limit": { "type": "integer", "minimum": 1, "default": 50, "description": "Total number of links the crawler will process before stopping" }, "select_paths": { "type": "array", "items": {"type": "string"}, "description": "Regex patterns to select only URLs with specific path patterns (e.g., /docs/.*, /api/v1.*)" }, "select_domains": { "type": "array", "items": {"type": "string"}, "description": "Regex patterns to select crawling to specific domains or subdomains (e.g., ^docs\\.example\\.com$)" }, "exclude_paths": { "type": "array", "items": {"type": "string"}, "description": "Regex patterns to exclude paths (e.g., /private/.*, /admin/.*)" }, "exclude_domains": { "type": "array", "items": {"type": "string"}, "description": "Regex patterns to exclude domains/subdomains (e.g., ^private\\.example\\.com$)" }, "allow_external": { "type": "boolean", "default": True, "description": "Whether to allow following links that go to external domains" }, "include_images": { "type": "boolean", "default": False, "description": "Include images discovered during the crawl" }, "categories": { "type": "array", "items": { "type": "string", "enum": ["Careers", "Blog", "Documentation", "About", "Pricing", "Community", "Developers", "Contact", "Media"] }, "description": "Filter URLs using predefined categories like documentation, blog, api, etc" }, "extract_depth": { "type": "string", "enum": ["basic", "advanced"], "default": "basic", "description": "Advanced extraction retrieves more data, including tables and embedded content, with higher success but may increase latency" }, "format": { "type": "string", "enum": ["markdown", "text"], "default": "markdown", "description": "The format of the extracted web page content. markdown returns content in markdown format. text returns plain text and may increase latency." }, "include_favicon": { "type": "boolean", "default": False, "description": "Whether to include the favicon URL for each result" }, "include_usage": { "type": "boolean", "default": False, "description": "Whether to include credit usage information in the response" } } } } ] ``` For more information about Tavily's capabilities, check out our [API documentation](/documentation/api-reference/introduction) and [best practices](/documentation/best-practices/best-practices-search). # Arcade.dev Source: https://docs.tavily.com/documentation/integrations/arcade-dev Connect Tavily to Arcade.dev MCP Gateway for governed web search, extraction, crawling, mapping, and research. Tavily on Arcade ## Overview [Arcade.dev](https://www.arcade.dev/) is an MCP runtime platform for connecting agents to MCP servers through a managed **MCP Gateway**. Tavily is available as a [verified partner MCP server on Arcade](https://www.arcade.dev/tools/tavily), so you can register Tavily's remote MCP server once and expose its web intelligence tools through Arcade.dev to all of your agents. Use this integration when you want Tavily behind the same Arcade gateway as your other tools. Your agent connects to Arcade, Arcade routes Tavily tool calls to the Tavily MCP server, and Arcade applies its gateway controls across the full tool stack. ## How it works 1. Generate a Tavily MCP server URL with your Tavily API key. 2. Add that URL to Arcade as a **Remote MCP** server. 3. Add Tavily to an Arcade **MCP Gateway** with any other servers your agent needs. 4. Connect your MCP client or agent framework to the Arcade gateway URL. This gives your agent one MCP endpoint for Tavily, plus other tools such as Google Docs, Slack, GitHub, etc., while Arcade handles gateway-level authorization, access control, and audit logging. ## Available Tools After Tavily is registered in Arcade, your agent can call these tools through the gateway: | Tool | Description | | ----------------- | -------------------------------------------------- | | `Tavily.Search` | Real-time web search with agent-optimized ranking. | | `Tavily.Extract` | Extract structured content from specific URLs. | | `Tavily.Crawl` | Crawl a site and return content across pages. | | `Tavily.Map` | Map the structure of a site or domain. | | `Tavily.Research` | Multi-source deep research across the web. | ## Prerequisites * An [Arcade.dev account](https://www.arcade.dev/) with access to the Dashboard. * A [Tavily API key](https://app.tavily.com/home). ## Setup In the [Tavily dashboard](https://app.tavily.com/home), go to **Overview** → **Remote MCP** and copy the generated URL. It should use this format: ``` https://mcp.tavily.com/mcp/?tavilyApiKey=YOUR_API_KEY ``` Treat this URL as a secret because it contains your Tavily API key. See the [Tavily MCP documentation](/documentation/mcp) for additional configuration options. In the [Arcade Dashboard](https://api.arcade.dev/dashboard), go to **Servers** → **Add Server** → **Remote MCP**. Paste the Tavily MCP URL from the previous step and save. Refer to the [Arcade Tavily integration documentation](https://docs.arcade.dev/en/resources/integrations/search/tavily) for the full walkthrough and to [Add remote MCP servers](https://docs.arcade.dev/guides/mcp-gateways/add-remote-servers) for advanced settings such as retries, OAuth, and custom headers. Arcade discovers the Tavily tools automatically after registration. Confirm that `Tavily.Search`, `Tavily.Extract`, `Tavily.Crawl`, `Tavily.Map`, and `Tavily.Research` appear in the Arcade Playground and in the MCP Gateway tool picker. Go to **MCP Gateways** → **Create Gateway** and select Tavily plus any other MCP servers your agent needs, such as Google Docs, Slack, Salesforce, or GitHub. Set the authentication mode to **Arcade Auth** when you want users to authenticate with their Arcade account and have Arcade apply gateway-level controls at runtime. Once the gateway is published, Arcade gives you a single Streamable HTTP URL of the form: ``` https://api.arcade.dev/mcp/ ``` Point any MCP-compatible client at this URL, including **Cursor**, **Claude Desktop**, **Codex**, **VS Code**, or any other application. ## Example workflow An agent connected to your Arcade gateway can use Tavily to research a topic, extract source content, and then call other Arcade tools to turn that research into action. For example, the agent can: * Call `Tavily.Search` to find current sources. * Call `Tavily.Extract` to read the most relevant pages. * Draft findings into Google Docs or send a summary to Slack through the same Arcade gateway. ## Benefits of Tavily + Arcade * **Centralized governance:** Authorization, user authentication, access control, and audit logging are handled uniformly by Arcade's runtime across Tavily and every other server in the gateway. * **Composable tool stacks:** Pair Tavily's web research tools with Arcade's productivity, communications, and CRM integrations behind one MCP endpoint. * **Simple client configuration:** MCP-compatible clients connect to the Arcade gateway URL instead of configuring Tavily separately in every client. ## Resources * [Arcade Tavily integration docs](https://docs.arcade.dev/en/resources/integrations/search/tavily) * [Tavily on Arcade Tools](https://www.arcade.dev/tools/tavily) * [Tavily MCP Documentation](/documentation/mcp) # Cartesia Source: https://docs.tavily.com/documentation/integrations/cartesia Build real-time voice agents that search and extract web content with Tavily and the Cartesia Line SDK. ## Introduction [Cartesia Line](https://docs.cartesia.ai/line/introduction) is an SDK for building low-latency voice agents. Pairing Line with Tavily gives your voice agent live web access — use [Tavily Search](https://docs.tavily.com/documentation/api-reference/endpoint/search) for fast, voice-friendly lookups and [Tavily Extract](https://docs.tavily.com/documentation/api-reference/endpoint/extract) for deep-dives into specific pages. A complete reference implementation lives in the [Cartesia Line repo](https://github.com/cartesia-ai/line/tree/main/example_integrations/tavily). ## Step-by-Step Integration Guide ### Step 1: Install Required Packages ```bash theme={null} uv venv uv add cartesia-line tavily-python loguru python-dotenv ``` ### Step 2: Set Up API Keys * **Tavily API Key:** [Get your Tavily API key here](https://app.tavily.com/home) * **OpenAI API Key:** [Get your OpenAI API key here](https://platform.openai.com/account/api-keys) Create a `.env` file: ```bash theme={null} TAVILY_API_KEY=tvly-your-api-key OPENAI_API_KEY=your-openai-api-key ``` ### Step 3: Define Tavily Tools Wrap Tavily's `AsyncTavilyClient` in two `@loopback_tool` functions so the voice agent can call them mid-conversation. Reusing a single `AsyncTavilyClient` across calls keeps the underlying HTTP session warm, which matters for latency on a live call. ```python theme={null} from typing import Annotated, Optional from loguru import logger from tavily import AsyncTavilyClient from line.llm_agent import ToolEnv, loopback_tool EXTRACT_MAX_CHARS = 3000 class TavilyTools: def __init__(self, api_key: str): self._client = AsyncTavilyClient( api_key=api_key, client_source="cartesia-line-agent", ) @loopback_tool async def web_search( self, ctx: ToolEnv, query: Annotated[str, "The search query. Be specific and include key terms."], time_range: Annotated[ Optional[str], "Optional time filter: 'day', 'week', 'month', or 'year'.", ] = None, ) -> str: """Search the web for current information.""" kwargs: dict = {"query": query, "search_depth": "fast", "max_results": 5} if time_range is not None: kwargs["time_range"] = time_range response = await self._client.search(**kwargs) results = response.get("results", []) if not results: return "No relevant information found." parts = [f"Search Results for: '{query}'\n"] for i, result in enumerate(results): score = result.get("score", 0) parts.append(f"\n--- Source {i + 1}: {result['title']} (relevance: {score:.2f}) ---\n") if result.get("content"): parts.append(f"{result['content']}\n") parts.append(f"URL: {result['url']}\n") return "".join(parts) @loopback_tool async def web_extract( self, ctx: ToolEnv, url: Annotated[str, "The URL to extract content from."], ) -> str: """Extract the full content of a webpage given its URL.""" response = await self._client.extract(urls=[url]) results = response.get("results", []) if not results: failed = response.get("failed_results", []) if failed: return f"Extraction failed for {url}: {failed[0].get('error', 'unknown error')}" return "No content could be extracted from that URL." raw_content = results[0].get("raw_content", "") if not raw_content: return "The page was reached but no readable content was found." if len(raw_content) > EXTRACT_MAX_CHARS: raw_content = raw_content[:EXTRACT_MAX_CHARS] + "\n\n[Content truncated]" return f"Extracted content from {url}:\n\n{raw_content}" ``` ### Step 4: Wire the Tools into a Voice Agent ```python theme={null} import os from datetime import datetime from line.llm_agent import LlmAgent, LlmConfig, end_call from line.voice_agent_app import AgentEnv, CallRequest, VoiceAgentApp SYSTEM_PROMPT = """Today is {today}. You are a fast research assistant on a live voice call. Use `web_search` for current events, facts, prices, or anything that needs fresh data. Use `web_extract` only when a search snippet is too thin — pass it a URL from a prior search. Lead with the answer. Keep replies to two or three sentences unless asked for more. This is a voice call: speak in plain sentences, no markdown, no lists, no special characters.""" async def get_agent(env: AgentEnv, call_request: CallRequest): api_key = os.environ["TAVILY_API_KEY"] tavily = TavilyTools(api_key=api_key) return LlmAgent( model="openai/gpt-5.4-mini", api_key=os.environ["OPENAI_API_KEY"], tools=[tavily.web_search, tavily.web_extract, end_call], config=LlmConfig( system_prompt=SYSTEM_PROMPT.format(today=datetime.now().strftime("%Y-%m-%d")), introduction="Hey! I'm your research assistant. Ask me anything.", max_tokens=600, temperature=0.7, ), ) app = VoiceAgentApp(get_agent=get_agent) if __name__ == "__main__": app.run() ``` Ensure you have the Cartesia CLI installed. Please refer to the [Cartesia CLI documentation](https://docs.cartesia.ai/line/cli) for more information. Run the agent and connect to it: ```bash theme={null} uv run main.py # in another terminal cartesia chat 8000 ``` ## Choosing a Search Depth Voice agents are latency-sensitive. Tavily exposes four search depths — for live calls, we recommend using `fast` or `ultra-fast`. | Depth | Latency | Content Type | Cost | Best For | | ------------ | ------- | ----------------------- | --------- | ------------------------------------ | | `ultra-fast` | Lowest | NLP summary per URL | 1 credit | Voice agents, real-time chat | | `fast` | Low | Reranked chunks per URL | 1 credit | Chunk-based results with low latency | | `basic` | Medium | NLP summary per URL | 1 credit | General-purpose search | | `advanced` | Higher | Reranked chunks per URL | 2 credits | Precision-critical queries | ## Additional Parameters Extend `web_search` with any of Tavily's search parameters: * `time_range` — `"day"`, `"week"`, `"month"`, or `"year"` for recency filtering * `include_domains` / `exclude_domains` — restrict or block specific sources * `include_answer` — `"basic"` or `"advanced"` for an LLM-generated answer alongside results See the [Search API reference](https://docs.tavily.com/documentation/api-reference/endpoint/search) and the [Python SDK reference](https://docs.tavily.com/sdk/python/reference) for the full parameter list. For `web_extract`, the most useful knobs are: * `extract_depth` — `"basic"` (default) or `"advanced"` for tables and embedded content * `format` — `"markdown"` (default) or `"text"` See the [Extract API reference](https://docs.tavily.com/documentation/api-reference/endpoint/extract) for more. ## Benefits of Tavily + Cartesia * **Voice-optimized latency:** `fast` and `ultra-fast` search depths keep round-trips short enough for live conversation. * **Fresh context:** Voice agents can answer questions about today's news, prices, and events without retraining. * **Targeted deep-dives:** Providing URLs to `web_extract` allows the agent to pull full-page content when a snippet isn't enough. # Claude Source: https://docs.tavily.com/documentation/integrations/claude Use Tavily across the Claude ecosystem as a Connector or as a Plugin to enable real-time web search, extraction, crawling, and research. ## Introduction [Claude](https://claude.ai/) is Anthropic's AI assistant designed for reasoning, coding, and research workflows across multiple environments like Claude Desktop, claude.ai, Claude Code, and Claude Cowork. Tavily integrates with the Claude ecosystem in **two main ways**: * **As a Connector** — a one-click, OAuth-based integration available in Claude Desktop, claude.ai, and Claude Cowork. Built on top of [MCP](https://modelcontextprotocol.io/docs/getting-started/intro) (Model Context Protocol). * **As a Plugin** — a packaged installation for Claude Code that bundles Tavily's tools and slash commands directly into your terminal workflow. ### Connector vs. Plugin | | **Connector** | **Plugin** | | ------------------ | --------------------------------------------- | ----------------------------------------------------------------- | | **Where it runs** | Claude Desktop, claude.ai, Claude Cowork | Claude Code (terminal), Claude Cowork (desktop) | | **Install method** | One-click + OAuth in Claude Settings | `/plugin install tavily` (CLI) or **Add Plugins** in Cowork | | **Auth** | OAuth flow | `TAVILY_API_KEY` in `~/.claude/settings.json` | | **Best for** | Chat-based research, everyday Claude usage | Developer workflows, scripted research, slash-command power users | | **Invocation** | Automatic — Claude picks the tool when needed | Automatic or via slash commands (e.g., `/tavily:search`) | Pick whichever matches where you use Claude — or use both. *** # Connector ## Tavily + Claude Tavily integrates with Claude as an official connector, giving Claude access to: * Real-time web search * Content extraction from URLs * Website crawling and mapping * Deep research workflows Once connected, Claude can automatically use Tavily whenever external information is required. *** ## Supported Claude surfaces Tavily works across the Claude ecosystem: * [Claude Cowork](https://www.anthropic.com/product/claude-cowork) * Claude Code - Through Claude Desktop, Alternatively if you want to use Tavily through Claude Code terminal, follow [this](https://docs.tavily.com/documentation/mcp#connect-to-claude-code). * [claude.ai](https://claude.ai/) * [Claude Desktop](https://support.claude.com/en/articles/10065433-installing-claude-desktop) *** ## Installation Onboarding Tavily Connector on Claude Go to **Settings** inside Claude. Click on the **Connectors** tab. Search for **Tavily** and click the **+ (Connect)** button. Complete the OAuth flow to connect Tavily. After connecting, go to **Configure** and enable **Allow always** (recommended). This allows Claude to automatically use Tavily whenever web search or external data is needed. *** ## Tavily tools available | Tool | Description | | ---------------- | ------------------------------------- | | tavily\_search | Real-time web search | | tavily\_extract | Extract clean content from URLs | | tavily\_crawl | Crawl multiple pages from a site | | tavily\_map | Discover site structure and URLs | | tavily\_research | Multi-step deep research workflows | | tavily\_skill | Search the best skills for your agent | *** ## How Tavily works inside Claude Once connected, Tavily runs automatically inside Claude: * Claude detects when external data or web search is needed * Tavily tools are invoked automatically * Results are returned and used in Claude's response If **Allow always** is enabled, everything works seamlessly without the need of manually accepting it. *** ## Example use cases ### tavily\_search **Query:** "What are the latest updates in AI this week?" **What happens:** Claude identifies this as a real-time information request and calls `tavily_search`. * Tavily fetches recent news, blogs, and updates * Claude selects the most relevant sources * Results are synthesized into a concise summary **Outcome:** A current, source-backed overview of the latest AI developments. *** ### tavily\_extract **Query:** "Summarize this article: [https://example.com/ai-report](https://example.com/ai-report)" **What happens:** Claude detects a URL and calls `tavily_extract`. * Tavily extracts clean content from the page * Removes boilerplate (ads, navigation, etc.) * Returns structured text Claude then summarizes or analyzes the extracted content. **Outcome:** A clean, accurate summary of the article without noise. *** ### tavily\_crawl **Query:** "Go through Stripe's documentation and explain how subscriptions work" **What happens:** Claude needs multiple pages to answer this. * Calls `tavily_crawl` on the documentation root * Tavily traverses linked pages * Relevant pages are collected and processed Claude aggregates information across pages and generates a unified explanation. **Outcome:** A complete answer built from multiple documentation pages. *** ### tavily\_research **Query:** "Do a deep analysis of the AI chip market and key players" **What happens:** Claude recognizes this as a complex, multi-step research task. * Calls `tavily_research` (deep research agent) * Tavily performs multi-source search, extraction, and synthesis * Iteratively refines findings across sources Claude then compiles a structured, high-quality research report. **Outcome:** A comprehensive, multi-source analysis rather than a simple summary. *** # Plugin The Tavily Plugin brings Tavily's tools directly into Claude's developer surfaces — **Claude Code** (terminal) and **Cowork** (desktop). Install it once and use Tavily via slash commands or let Claude invoke the right skill automatically. ## Install ### Prereq: Tavily API key Add to `~/.claude/settings.json`: ```json theme={null} { "env": { "TAVILY_API_KEY": "tvly-your-key-here" } } ``` Get a key at [tavily.com](https://tavily.com). ### Option A — Claude Code (CLI) ``` /plugin install tavily ``` Then `/clear` and `Ctrl+C` to restart. ### Option B — Cowork (desktop) 1. Click the **+** icon 2. **Add Plugins** → **Anthropic and Partners** 3. Search **Tavily** → **Add** 4. (Optional) Customize via settings ### Use (both surfaces) ``` /tavily:search latest news on EU AI Act /tavily:research electric vehicle market 2026 /tavily:crawl https://docs.tavily.com /tavily:extract https://example.com/article ``` Or just ask Claude naturally — it'll pick the right skill automatically. *** ## Learn more * Claude Connectors Directory - [https://claude.com/connectors](https://claude.com/connectors) * Use Tavily with Anthropic SDK - [https://docs.tavily.com/documentation/integrations/anthropic](https://docs.tavily.com/documentation/integrations/anthropic) # Composio Source: https://docs.tavily.com/documentation/integrations/composio Tavily is now available for integration through Composio. ## Introduction Integrate Tavily with Composio to enhance your AI workflows with powerful web search capabilities. Composio provides a platform to connect your AI agents to external tools like Tavily, making it easy to incorporate real-time web search and data extraction into your applications. ## Step-by-Step Integration Guide ### Step 1: Install Required Packages Install the necessary Python packages: ```bash theme={null} pip install composio composio-openai openai python-dotenv ``` ### Step 2: Set Up API Keys * **OpenAI API Key:** [Get your OpenAI API key here](https://platform.openai.com/account/api-keys) * **Composio API Key:** [Get your Composio API key here](https://app.composio.dev/dashboard) Set these as environment variables in your terminal or add them to your environment configuration file: ```bash theme={null} export OPENAI_API_KEY=your_openai_api_key export COMPOSIO_API_KEY=your_composio_api_key ``` ### Step 3: Connect Tavily to Composio ```python theme={null} from composio import Composio from dotenv import load_dotenv load_dotenv() composio = Composio() # Use composio managed auth auth_config = composio.auth_configs.create( toolkit="tavily", options={ "type": "use_custom_auth", "auth_scheme": "API_KEY", "credentials": {} } ) print(auth_config) auth_config_id = auth_config.id user_id = "your-user-id" connection_request = composio.connected_accounts.link(user_id, auth_config_id) print(connection_request.redirect_url) ``` ### Step 4: Example Use Case ```python theme={null} from composio import Composio from composio_openai import OpenAIProvider from openai import OpenAI import os from dotenv import load_dotenv load_dotenv() # Initialize OpenAI client with API key client = OpenAI() # Initialize Composio toolset composio = Composio( api_key=os.getenv("COMPOSIO_API_KEY"), provider=OpenAIProvider() ) user_id = "your-user-id" # Get the Tavily tool with all available parameters tools = composio.tools.get(user_id, toolkits=['TAVILY'] ) # Define the market research task with specific parameters task = { "query": "Analyze the competitive landscape of AI-powered customer service solutions in 2024", "search_depth": "advanced", "include_answer": True, "max_results": 10, # Focus on relevant industry sources "include_domains": [ "techcrunch.com", "venturebeat.com", "forbes.com", "gartner.com", "marketsandmarkets.com" ], } # Send request to LLM messages = [{"role": "user", "content": str(task)}] response = client.chat.completions.create( model="gpt-4.1", messages=messages, tools=tools, tool_choice="auto" ) # Handle tool call via Composio execution_result = None response_message = response.choices[0].message if response_message.tool_calls: execution_result = composio.provider.handle_tool_calls(user_id,response) print("Execution Result:", execution_result) messages.append(response_message) # Add tool response messages for tool_call, result in zip(response_message.tool_calls, execution_result): messages.append({ "role": "tool", "content": str(result["data"]), "tool_call_id": tool_call.id }) # Get final response from LLM final_response = client.chat.completions.create( model="gpt-4.1", messages=messages ) print("\nMarket Research Summary:") print(final_response.choices[0].message.content) else: print("LLM responded directly (no tool used):", response_message.content) ``` ## Additional Use Cases 1. **Research Automation**: Automate the collection and summarization of research data 2. **Content Curation**: Gather and organize information from multiple sources 3. **Real-time Data Integration**: Keeping your AI models up-to-date with the latest information. # CrewAI Source: https://docs.tavily.com/documentation/integrations/crewai Integrate Tavily with CrewAI to build powerful AI agents that can search the web. ## Introduction This guide shows you how to integrate Tavily with CrewAI to create sophisticated AI agents that can search the web and extract content. By combining CrewAI's multi-agent framework with Tavily's real-time web search capabilities, you can build AI systems that research, analyze, and process web information autonomously. ## Prerequisites Before you begin, make sure you have: * An OpenAI API key from [OpenAI Platform](https://platform.openai.com/) * A Tavily API key from [Tavily Dashboard](https://app.tavily.com/sign-in) ## Installation Install the required packages: > **Note:** The stable python versions to use with CrewAI are `Python >=3.10 and Python <3.13` . ```bash theme={null} pip install 'crewai[tools]' pip install pydantic ``` ## Setup Set up your API keys: ```python theme={null} import os # Set your API keys os.environ["OPENAI_API_KEY"] = "your-openai-api-key" os.environ["TAVILY_API_KEY"] = "your-tavily-api-key" ``` ## Using Tavily Search with CrewAI CrewAI provides built-in Tavily tools that make it easy to integrate web search capabilities into your AI agents. The `TavilySearchTool` allows your agents to search the web for real-time information. ```python theme={null} import os from crewai import Agent, Task, Crew from crewai_tools import TavilySearchTool ``` ```python theme={null} # Initialize the Tavily search tool tavily_tool = TavilySearchTool() ``` ```python theme={null} # Create an agent that uses the tool researcher = Agent( role='News Researcher', goal='Find trending information about AI agents', backstory='An expert News researcher specializing in technology, focused on AI.', tools=[tavily_tool], verbose=True ) ``` ```python theme={null} # Create a task for the agent research_task = Task( description='Search for the top 3 Agentic AI trends in 2025.', expected_output='A JSON report summarizing the top 3 AI trends found.', agent=researcher ) ``` ```python theme={null} # Form the crew and execute the task crew = Crew( agents=[researcher], tasks=[research_task], verbose=True ) result = crew.kickoff() print(result) ``` ### Customizing search tool parameters **Example:** ```python theme={null} from crewai_tools import TavilySearchTool # You can configure the tool with specific parameters tavily_search_tool = TavilySearchTool( search_depth="advanced", max_results=10, include_answer=True ) ``` You can customize the search tool by passing parameters to configure its behavior.Below are available parameters in crewai integration: **Available Parameters:** * `query` (str): Required. The search query string. * `search_depth` (Literal\["basic", "advanced"], optional): The depth of the search. Defaults to "basic". * `topic` (Literal\["general", "news", "finance"], optional): The topic to focus the search on. Defaults to "general". * `time_range` (Literal\["day", "week", "month", "year"], optional): The time range for the search. Defaults to None. * `max_results` (int, optional): The maximum number of search results to return. Defaults to 5. * `include_domains` (Sequence\[str], optional): A list of domains to prioritize in the search. Defaults to None. * `exclude_domains` (Sequence\[str], optional): A list of domains to exclude from the search. Defaults to None. * `include_answer` (Union\[bool, Literal\["basic", "advanced"]], optional): Whether to include a direct answer synthesized from the search results. Defaults to False. * `include_raw_content` (bool, optional): Whether to include the raw HTML content of the searched pages. Defaults to False. * `include_images` (bool, optional): Whether to include image results. Defaults to False. * `timeout` (int, optional): The request timeout in seconds. Defaults to 60. > **Explore More Parameters**: For a complete list of available parameters and their descriptions, visit our [API documentation](/documentation/api-reference/endpoint/search) to discover all the customization options available for search operations. ```python theme={null} import os from crewai import Agent, Task, Crew from crewai_tools import TavilySearchTool # Set up environment variables os.environ["OPENAI_API_KEY"] = "your-openai-api-key" os.environ["TAVILY_API_KEY"] = "your-tavily-api-key" # Initialize the tool tavily_tool = TavilySearchTool() # Create an agent that uses the tool researcher = Agent( role='News Researcher', goal='Find trending information about AI agents', backstory='An expert News researcher specializing in technology, focused on AI.', tools=[tavily_tool], verbose=True ) # Create a task for the agent research_task = Task( description='Search for the top 3 Agentic AI trends in 2025.', expected_output='A JSON report summarizing the top 3 AI trends found.', agent=researcher ) # Form the crew and kick it off crew = Crew( agents=[researcher], tasks=[research_task], verbose=True ) result = crew.kickoff() print(result) ``` ## Using Tavily Extract with CrewAI The `TavilyExtractorTool` allows your CrewAI agents to extract and process content from specific web pages. This is particularly useful for content analysis, data collection, and research tasks. ```python theme={null} import os from crewai import Agent, Task, Crew from crewai_tools import TavilyExtractorTool ``` ```python theme={null} # Initialize the Tavily extractor tool tavily_tool = TavilyExtractorTool() ``` ```python theme={null} # Create an agent that uses the tool extractor_agent = Agent( role='Web Page Content Extractor', goal='Extract key information from the given web pages', backstory='You are an expert at extracting relevant content from websites using the Tavily Extract.', tools=[tavily_tool], verbose=True ) ``` ```python theme={null} # Define a task for the agent extract_task = Task( description='Extract the main content from the URL https://en.wikipedia.org/wiki/Lionel_Messi .', expected_output='A JSON string containing the extracted content from the URL.', agent=extractor_agent ) ``` ```python theme={null} # Create and run the crew crew = Crew( agents=[extractor_agent], tasks=[extract_task], verbose=False ) result = crew.kickoff() print(result) ``` ### Customizing extract tool parameters **Example:** ```python theme={null} from crewai_tools import TavilyExtractorTool # You can configure the tool with specific parameters tavily_extract_tool = TavilyExtractorTool( extract_depth="advanced", include_images=True, timeout=45 ) ``` You can customize the extract tool by passing parameters to configure its behavior. Below are available parameters in crewai integration: **Available Parameters:** * `urls` (Union\[List\[str], str]): Required. A single URL string or a list of URL strings to extract data from. * `include_images` (Optional\[bool]): Whether to include images in the extraction results. Defaults to False. * `extract_depth` (Literal\["basic", "advanced"]): The depth of extraction. Use "basic" for faster, surface-level extraction or "advanced" for more comprehensive extraction. Defaults to "basic". * `timeout` (int): The maximum time in seconds to wait for the extraction request to complete. Defaults to 60. > **Explore More Parameters**: For a complete list of available parameters and their descriptions, visit our [API documentation](/documentation/api-reference/endpoint/extract) to discover all the customization options available for extract operations. ```python theme={null} import os from crewai import Agent, Task, Crew from crewai_tools import TavilyExtractorTool # Set up environment variables os.environ["OPENAI_API_KEY"] = "your-openai-api-key" os.environ["TAVILY_API_KEY"] = "your-tavily-api-key" # Initialize the Tavily extractor tool tavily_tool = TavilyExtractorTool() # Create an agent that uses the tool extractor_agent = Agent( role='Web Page Content Extractor', goal='Extract key information from the given web pages', backstory='You are an expert at extracting relevant content from websites using the Tavily Extract.', tools=[tavily_tool], verbose=True ) # Define a task for the agent extract_task = Task( description='Extract the main content from the URL https://en.wikipedia.org/wiki/Lionel_Messi .', expected_output='A JSON string containing the extracted content from the URL.', agent=extractor_agent ) # Create and execute the crew crew = Crew( agents=[extractor_agent], tasks=[extract_task], verbose=True ) # Run the extraction result = crew.kickoff() print("Extraction Results:") print(result) ``` ## Using Tavily Research with CrewAI The `TavilyResearchTool` lets your CrewAI agents kick off Tavily research tasks, returning a synthesized, cited report (or a stream of progress events) instead of raw search results. Use it when an agent needs an investigative answer rather than a single web search. > **Note:** Using the `TavilyResearchTool` requires the `tavily-python` library in addition to `crewai-tools`. Install it alongside CrewAI tools: > > ```bash theme={null} > uv add 'crewai[tools]' tavily-python > ``` ```python theme={null} import os from crewai import Agent, Task, Crew from crewai_tools import TavilyResearchTool ``` ```python theme={null} # Initialize the Tavily research tool tavily_tool = TavilyResearchTool() ``` ```python theme={null} # Create an agent that uses the tool researcher = Agent( role="Research Analyst", goal="Investigate questions and produce concise, well-cited briefings.", backstory=( "You are a meticulous analyst who delegates web research to the Tavily " "Research tool, then synthesizes the findings into short briefings." ), tools=[tavily_tool], verbose=True, ) ``` ```python theme={null} # Create a task for the agent research_task = Task( description=( "Investigate notable open-source agent orchestration frameworks released " "in the last six months and summarize their differentiators." ), expected_output="A bulleted briefing with citations.", agent=researcher, ) ``` ```python theme={null} # Form the crew and execute the task crew = Crew(agents=[researcher], tasks=[research_task]) print(crew.kickoff()) ``` ### Customizing research tool parameters **Example:** ```python theme={null} from crewai_tools import TavilyResearchTool # You can configure the tool with specific defaults for every call tavily_research_tool = TavilyResearchTool( model="pro", # use Tavily's most capable research model citation_format="apa", # APA-style citations ) ``` You can customize the research tool by passing parameters to configure its behavior. Defaults set on the tool instance apply to every call, and any parameter can also be overridden per-call via the agent's tool input. Below are available parameters in the crewai integration: **Available Parameters:** * `input` (str): Required. The research task or question to investigate. * `model` (Literal\["mini", "pro", "auto"], optional): The Tavily research model. `"auto"` lets Tavily pick; `"mini"` is faster and cheaper; `"pro"` is the most capable. Defaults to `"auto"`. * `output_schema` (dict, optional): Optional JSON Schema that structures the research output. Useful when you want strictly typed results. Defaults to None. * `stream` (bool, optional): When `True`, the tool returns an iterator of SSE chunks emitting research progress and the final result instead of a single string. Defaults to False. * `citation_format` (Literal\["numbered", "mla", "apa", "chicago"], optional): Citation format for the report. Defaults to `"numbered"`. #### Stream research progress When `stream=True`, the tool returns a generator (or async generator from `_arun`) of SSE chunks so your application can surface incremental progress: ```python theme={null} tavily_tool = TavilyResearchTool(stream=True) for chunk in tavily_tool.run(input="Summarize recent advances in retrieval-augmented generation."): print(chunk) ``` #### Structured output via JSON Schema Pass an `output_schema` when you need a typed result instead of a free-form report: ```python theme={null} output_schema = { "type": "object", "properties": { "summary": {"type": "string"}, "key_points": {"type": "array", "items": {"type": "string"}}, "sources": {"type": "array", "items": {"type": "string"}}, }, "required": ["summary", "key_points", "sources"], } tavily_tool = TavilyResearchTool(output_schema=output_schema) ``` > **Explore More Parameters**: For a complete list of available parameters and their descriptions, visit our [API documentation](/documentation/api-reference/endpoint/research) to discover all the customization options available for research operations. ```python theme={null} import os from crewai import Agent, Task, Crew from crewai_tools import TavilyResearchTool # Set up environment variables os.environ["OPENAI_API_KEY"] = "your-openai-api-key" os.environ["TAVILY_API_KEY"] = "your-tavily-api-key" # Initialize the Tavily research tool tavily_tool = TavilyResearchTool() # Create an agent that uses the tool researcher = Agent( role="Research Analyst", goal="Investigate questions and produce concise, well-cited briefings.", backstory=( "You are a meticulous analyst who delegates web research to the Tavily " "Research tool, then synthesizes the findings into short briefings." ), tools=[tavily_tool], verbose=True, ) # Create a task for the agent research_task = Task( description=( "Investigate notable open-source agent orchestration frameworks released " "in the last six months and summarize their differentiators." ), expected_output="A bulleted briefing with citations.", agent=researcher, ) # Form the crew and execute the task crew = Crew( agents=[researcher], tasks=[research_task], verbose=True, ) result = crew.kickoff() print("Research Results:") print(result) ``` For more information about Tavily's capabilities, check out our [API documentation](/documentation/api-reference/introduction) and [best practices](/documentation/best-practices/best-practices-search). # Devin Source: https://docs.tavily.com/documentation/integrations/devin Connect Tavily to Devin through the MCP Marketplace so Devin can search the web, read docs, and ground coding tasks with live web context. ## Introduction [Devin](https://app.devin.ai/) is an AI software engineering agent that can take a development task, work through multiple steps, use tools, and help build or update applications inside its workspace. ## Why use Tavily with Devin? Tavily helps Devin go beyond its built-in knowledge when a task depends on the current web. * **Research before coding** — Compare libraries, frameworks, and services before implementation. * **Read docs faster** — Pull clean content from relevant pages instead of relying on noisy web pages. * **Ground implementation choices** — Use live sources when picking packages, SDKs, or workflows. * **Handle multi-step engineering tasks** — Search, extract, and research can all happen in the same coding flow. ### Example use case Ask Devin to add email support to a product using the best current provider for your stack. With Tavily enabled, Devin can search for recent comparisons of Resend, Postmark, and SendGrid, read the latest integration docs, choose an option that fits your app, implement the flow, and document the setup in your README. ## Full walkthrough Installing and using Tavily in Devin through the MCP Marketplace ## Setup Follow this flow in Devin: Go to [app.devin.ai](https://app.devin.ai/). Click your **username** and open the **Settings** dropdown from the left panel. In Settings, click **Connectors**. Inside Connectors, open **MCP Marketplace**. Search for **Tavily**, then click **Add**, **Install**, and **Enable**. Click **Test tools** if you want to verify the integration before using it in a task. After installation, Devin can use Tavily's web research capabilities during coding tasks whenever live external context is helpful. ## Usage Once Tavily is enabled: 1. Go back to the main Devin app. 2. Start a new task. 3. Ask Devin to use Tavily MCP as part of the workflow. Example prompt: ```text theme={null} Create a Next.js app called `qr-maker`. Use Tavily MCP to pick a QR-code package, build a text-to-QR page, add a README, and commit it. ``` From there, Devin can use Tavily to research package options, inspect relevant documentation, choose a suitable library, and then build the app with the requested deliverables. ## Good tasks for Devin + Tavily * choosing between actively maintained packages * implementing against the latest API or SDK docs * reading framework migration guides * comparing current tooling options before coding * gathering source material before writing code or documentation ## Learn more * [Tavily MCP Documentation](/documentation/mcp) * [Tavily API Reference](/documentation/api-reference/introduction) # Dify Source: https://docs.tavily.com/documentation/integrations/dify Tavily is now available for no-code integration through Dify. ## Introduction Integrate Tavily with Dify to enhance your AI workflows without writing any code. Dify is a no-code platform that allows you to build and deploy AI applications using various tools, including the **Tavily Search API** and **Tavily Extract API**. This integration enables access to real-time web data, improving the capabilities of your AI applications. ## How to set up Tavily with Dify Follow these steps to integrate Tavily with Dify: Go to [Dify](https://dify.ai/) and log in to your account. Go to the [Tavily Dashboard](https://app.tavily.com/home) to obtain your **API key**. Install the **Tavily tool** from the [Plugin Marketplace](https://marketplace.dify.ai/plugins/langgenius/tavily) to enable integration with your Dify workflows. In **Dify**, navigate to **Tools > Tavily > To Authorize** and enter your **Tavily API key** to connect your Dify instance to Tavily. ## Using the Tavily tool in Dify Tavily can be utilized in various Dify application types: ### Chatflow / Workflow Applications Dify’s Chatflow and Workflow applications support Tavily tool nodes, which include: * **Tavily Search API** – Perform dynamic web searches and retrieve up-to-date information. * **Tavily Extract API** – Extract raw content from web pages. These nodes allow you to automate tasks such as research, content curation, and real-time data integration into your workflows. ### Agent Applications In Agent applications, you can integrate the Tavily tool to access web data in real time. Use this to: * Retrieve structured and relevant search results. * Extract raw content for further processing. * Provide accurate, context-aware answers to user queries. defy ## Example use case: automated deep research Use **Tavily Search API** within **Dify** to conduct automated, multi-step searches, iterating through multiple queries to gather, refine, and summarize insights for comprehensive reports. For a detailed walkthrough, check out this blog post: [DeepResearch: Building a Research Automation App with Dify](https://dify.ai/blog/deepresearch-building-a-research-automation-app-with-dify) ## Best practices for using Tavily in Dify * **Design Concise Queries** – Use focused queries to maximize the relevance of search results. * **Utilize Domain Filtering** – Use the `include_domains` parameter to narrow search results to specific domains. * **Enable an Agentic Workflow** – Leverage an LLM to dynamically generate and refine queries for Tavily. *** # ElevenLabs Source: https://docs.tavily.com/documentation/integrations/elevenlabs Connect Tavily to ElevenLabs ElevenAgents so your agents can use live web search. ## Introduction Integrate [Tavily](https://tavily.com/) with [ElevenLabs](https://elevenlabs.io/) through **ElevenAgents** to give your agents access to real-time web search. In ElevenLabs, Tavily is available under **ElevenAgents → Integrations**. > The Tavily integration in ElevenLabs currently exposes the **`search`** tool only. ## Full setup walkthrough ElevenLabs Tavily integration walkthrough ## Setup instructions 1. Open **ElevenAgents** in ElevenLabs. 2. Click **Integrations**. 3. Click **Add Integration**. 4. In the **Configure** tab: * Enter an **API key name**. * Enter your [Tavily API key](https://app.tavily.com/home). * Click **Connect**. ElevenLabs integration configuration Once connected, Tavily will be available for use inside your ElevenAgents workflows. ## Testing flow 1. Go to **Agents**. 2. Click **New Agent**. 3. Choose a template or start with a **Blank Agent**. 4. Decide your agent's use case. 5. Add details such as **Name** and **Goal**. 6. Click **Create Agent**. 7. Configure the agent settings, such as: * **Voice** * **First Message** * **LLM** * any other relevant options ElevenLabs agent configuration 8. Open the **Tools** section. 9. Add **Tavily search**. 10. **Publish** the agent or use **Preview**. 11. Test the agent end to end. ElevenLabs Tools section with Tavily search ## Why use Tavily with ElevenLabs? * Give voice and conversational agents access to up-to-date information. * Add live web search without building a custom retrieval layer. * Quickly prototype research, support, and assistant workflows inside ElevenAgents. # FlowiseAI Source: https://docs.tavily.com/documentation/integrations/flowise Tavily is now available for integration through Flowise. ## Introduction Integrate [Tavily with FlowiseAI](https://docs.flowiseai.com/integrations/langchain/tools/tavily-ai) to enhance your AI workflows with powerful web search capabilities. Flowise provides a no-code platform for building AI applications, and the Tavily integration offers real-time, accurate search results tailored for LLMs and RAG (Retrieval-Augmented Generation) systems. Set up Tavily in Flowise to create chatflows or agent flows that can automate research, track news, or feed relevant data into your connected applications. ## How to set up Tavily with Flowise Follow these steps to integrate Tavily with Flowise: [Login](https://flowiseai.com/) to your Flowise account. Create a new flow in Flowise: 1. Click "Create New Flow" 2. Select either "Chat Flow" or "Agent Flow" as the type 3. Name your flow (e.g., "Research Assistant") Add the Tavily node to your flow: **For Chat Flow:** 1. Click on the (+) button 2. Navigate to **LangChain > Tools > Tavily API** 3. Drag the Tavily node into your flow **For Agent Flow:** 1. Click on the (+) button 2. Navigate to **Tools > Tavily API** 3. Drag the Tavily node into your flow Configure the Tavily node with your credentials and parameters: 1. Enter your Tavily API key in the credentials section 2. Configure additional parameters, for example: * **Search Depth:** Choose between 'basic' or 'advanced' * **Max Results:** Set the number of results to return * **Include Domains:** Specify domains to include in search * **Exclude Domains:** Specify domains to exclude from search Connect the Tavily node to other nodes in your flow: 1. Connect to any node that accepts tool inputs 2. Connect to an LLM node for query processing 3. Connect to a Response node to format results ## Using Tavily in Flowise Tavily can be utilized in various Flowise application types: ### Chatflow Applications Flowise's Chatflow applications support Tavily tool node. This node allows you to automate tasks such as research, content curation, and real-time data integration into your workflows. ### Agent Applications In Agent applications, you can integrate the Tavily tool to access web data in real time. Use this to: * Retrieve structured and relevant search results * Extract raw content for further processing * Provide accurate, context-aware answers to user queries Flowise Tavily Integration # Google ADK Source: https://docs.tavily.com/documentation/integrations/google-adk Connect your Google ADK agent to Tavily's AI-focused search, extraction, and crawling platform for real-time web intelligence. ## Introduction The Tavily MCP Server connects your ADK agent to Tavily's AI-focused search, extraction, and crawling platform. This gives your agent the ability to perform real-time web searches, intelligently extract specific data from web pages, and crawl or create structured maps of websites. ## Prerequisites Before you begin, make sure you have: * Python 3.9 or later * pip for installing packages * A [Tavily API key](https://app.tavily.com/home) (sign up for free if you don't have one) * A [Gemini API key](https://aistudio.google.com/app/apikey) for Google AI Studio ## Installation Install ADK by running: ```bash theme={null} pip install google-adk mcp ``` ## Building Your Agent ### Step 1: Create an Agent Project Run the `adk create` command to start a new agent project: ```bash theme={null} adk create my_agent ``` This creates a new directory with the following structure: ``` my_agent/ agent.py # main agent code .env # API keys or project IDs __init__.py ``` ### Step 2: Update Your Agent Code Edit the `my_agent/agent.py` file to integrate Tavily. Choose either **Remote MCP Server** or **Local MCP Server**: ```python Remote MCP Server theme={null} from google.adk.agents import Agent from google.adk.tools.mcp_tool.mcp_session_manager import StreamableHTTPServerParams from google.adk.tools.mcp_tool.mcp_toolset import MCPToolset import os # Get API key from environment TAVILY_API_KEY = os.getenv("TAVILY_API_KEY") root_agent = Agent( model="gemini-2.5-pro", name="tavily_agent", instruction="You are a helpful assistant that uses Tavily to search the web, extract content, and explore websites. Use Tavily's tools to provide up-to-date information to users.", tools=[ MCPToolset( connection_params=StreamableHTTPServerParams( url="https://mcp.tavily.com/mcp/", headers={ "Authorization": f"Bearer {TAVILY_API_KEY}", }, ), ) ], ) ``` ```python Local MCP Server theme={null} from google.adk.agents import Agent from google.adk.tools.mcp_tool.mcp_session_manager import StdioConnectionParams from google.adk.tools.mcp_tool.mcp_toolset import MCPToolset from mcp import StdioServerParameters import os # Get API key from environment TAVILY_API_KEY = os.getenv("TAVILY_API_KEY") root_agent = Agent( model="gemini-2.5-pro", name="tavily_agent", instruction="You are a helpful assistant that uses Tavily to search the web, extract content, and explore websites.", tools=[ MCPToolset( connection_params=StdioConnectionParams( server_params=StdioServerParameters( command="npx", args=[ "-y", "tavily-mcp@latest", ], env={ "TAVILY_API_KEY": TAVILY_API_KEY, } ), timeout=30, ), ) ], ) ``` ### Step 3: Set Your API Keys Update the `my_agent/.env` file with your API keys: ```bash theme={null} echo 'GOOGLE_API_KEY="YOUR_GEMINI_API_KEY"' >> my_agent/.env echo 'TAVILY_API_KEY="YOUR_TAVILY_API_KEY"' >> my_agent/.env ``` Or manually edit the `.env` file: ``` GOOGLE_API_KEY="your_gemini_api_key_here" TAVILY_API_KEY="your_tavily_api_key_here" ``` ### Step 4: Run Your Agent You can run your ADK agent in two ways: #### Run with Command-Line Interface Run your agent using the `adk run` command: ```bash theme={null} adk run my_agent ``` This starts an interactive command-line interface where you can chat with your agent and test Tavily's capabilities. #### Run with Web Interface Start the ADK web interface for a visual testing experience: ```bash theme={null} adk web --port 8000 ``` **Note:** Run this command from the parent directory that contains your `my_agent/` folder. For example, if your agent is inside `agents/my_agent/`, run `adk web` from the `agents/` directory. This starts a web server with a chat interface. Access it at `http://localhost:8000`, select your agent from the dropdown, and start chatting. ## Example Usage Once your agent is set up and running, you can interact with it through the command-line interface or web interface. Here's a simple example: **User Query:** ``` Find all documentation pages on tavily.com and provide instructions on how to get started with Tavily ``` The agent automatically combines multiple Tavily tools to provide comprehensive answers, making it easy to explore websites and gather information without manual navigation. Tavily-ADK ## Available Tools Once connected, your agent gains access to Tavily's powerful web intelligence tools: ### tavily-search Execute a search query to find relevant information across the web. ### tavily-extract Extract structured data from any web page. Extract text, links, and images from single pages or batch process multiple URLs efficiently. ### tavily-map Traverses websites like a graph and can explore hundreds of paths in parallel with intelligent discovery to generate comprehensive site maps. ### tavily-crawl Traversal tool that can explore hundreds of paths in parallel with built-in extraction and intelligent discovery. # Gradium Source: https://docs.tavily.com/documentation/integrations/gradium Use Tavily web search with Gradium voice AI agents. ## Introduction [Gradium](https://gradium.ai/) is a voice AI platform for building live speech agents. Pairing Gradium with [Tavily](https://tavily.com/) gives your agent access to real-time web search, extraction, research, and crawling. In a Gradium voice agent, Tavily acts as the web context layer: the user speaks a request, the agent turns it into a structured search, Tavily returns current web results, and Gradium speaks the answer back. Explore Tavily's web search and research APIs. See a Gradbot demo that uses voice AI to search for Paris rentals. ## Voice-controlled web search A voice search agent usually follows this loop: 1. The user asks a spoken question, such as "Find two-bedroom rentals near Canal Saint-Martin under 2,500 euros." 2. Gradium Speech-to-Text transcribes the request in real time. 3. Your agent decides whether it needs fresh web context and calls Tavily with a focused query. 4. Tavily returns search results and source content for the agent to inspect. 5. The agent filters, compares, and summarizes the results. 6. Gradium Text-to-Speech streams the answer back to the user. This pattern lets users control web search without typing. They can refine the search conversationally, ask for tradeoffs, compare sources, or narrow results by criteria like budget, neighborhood, date, availability, or ranking. ## Core wiring The Gradbot demo exposes search as a voice-agent tool. Gradium handles the live STT and TTS session, while the agent decides when to call `run_apartment_search`. ### Agent session config ```python theme={null} def on_start(msg: dict) -> gradbot.SessionConfig: return gradbot.SessionConfig( voice_id="ubuXFxVQwVYnZQhy", instructions=SYSTEM_PROMPT, language=gradbot.LANGUAGES["en"], tools=build_tools(), silence_timeout_s=0.0, **config.session_kwargs, ) await gradbot.websocket.handle_session( websocket, config=config, on_start=on_start, on_tool_call=on_tool_call, ) ``` ### Search tool definition ```python theme={null} gradbot.ToolDef( name="run_apartment_search", description=( "Run a fresh apartment search and return top matches. " "Call only when the user explicitly asks to search." ), parameters_json=json.dumps({ "type": "object", "properties": { "max_results": {"type": "integer"}, "allow_unconfirmed_profile": {"type": "boolean"}, }, "required": [], }), ) ``` When the model calls the tool, the voice handler routes it into the same search logic used by the REST API and sends a compact result back to the agent before it speaks. ```python theme={null} async def on_tool_call(handle, input_handle, websocket): if handle.name == "run_apartment_search": result = await assistant_tools.run_apartment_search( db, user_id, max_results=int((handle.args or {}).get("max_results") or 10), allow_unconfirmed_profile=bool( (handle.args or {}).get("allow_unconfirmed_profile") ), ) await handle.send_json(_voice_summarize_search(result)) ``` The shared search logic eventually calls Tavily with the focused query built from the user's confirmed profile. ```python theme={null} response = await httpx.AsyncClient().post( "https://api.tavily.com/search", json={ "api_key": tavily_api_key, "query": "location appartement Paris 2 chambres 2500 euros", "search_depth": "basic", "max_results": 5, "include_raw_content": True, }, timeout=20.0, ) results = response.json()["results"] ``` ## When to use Tavily with Gradium * **Live search assistants:** Answer questions that depend on current web results. * **Research agents:** Collect, compare, and summarize web sources while keeping the conversation hands-free. * **Shopping, travel, and real estate workflows:** Let users narrow options by speaking constraints naturally. * **Customer support agents:** Fetch public documentation or status information while the caller stays in a voice conversation. ## Resources * [Gradium documentation index](https://docs.gradium.ai/llms.txt) * [Paris rental voice agent demo](https://github.com/gradium-ai/gradbot/tree/main/demos/paris_rental_agent) * [Tavily Search API reference](https://docs.tavily.com/documentation/api-reference/endpoint/search) ## Demo The [Paris rental voice agent](https://github.com/gradium-ai/gradbot/tree/main/demos/paris_rental_agent) shows how a Gradbot application can combine a spoken interface with web search. Use it as a reference for the agent loop: listen to the user, call a web search tool, reason over the results, and respond with speech. # Haystack Source: https://docs.tavily.com/documentation/integrations/haystack Use Tavily inside Haystack pipelines with the `tavily-haystack` integration. ## Introduction [Haystack](https://haystack.deepset.ai/) is an open-source framework for building production-ready LLM applications and RAG pipelines in Python. Tavily integrates with Haystack through the [`tavily-haystack`](https://pypi.org/project/tavily-haystack/) package maintained by deepset. It exposes a `TavilyWebSearch` component that queries Tavily Search and returns Haystack `Document` objects alongside the source URLs. You can also review the upstream integration page in the [Haystack integrations directory](https://haystack.deepset.ai/integrations/tavily). ## Installation Install the integration package: ```bash theme={null} pip install tavily-haystack ``` ## Credentials Set your Tavily API key as an environment variable: ```bash theme={null} export TAVILY_API_KEY="tvly-your-api-key" ``` By default, `TavilyWebSearch` reads from `TAVILY_API_KEY`, but you can also pass the key explicitly with `Secret.from_token(...)`. ## Basic Usage Use `TavilyWebSearch` to fetch web results as Haystack `Document` objects: ```python theme={null} from haystack_integrations.components.websearch.tavily import TavilyWebSearch web_search = TavilyWebSearch(top_k=5) result = web_search.run(query="What is Haystack by deepset?") documents = result["documents"] links = result["links"] ``` If you want to configure Tavily directly inside the component, pass an API key and `search_params`: ```python theme={null} from haystack.utils import Secret from haystack_integrations.components.websearch.tavily import TavilyWebSearch web_search = TavilyWebSearch( api_key=Secret.from_token("tvly-your-api-key"), top_k=5, search_params={"search_depth": "advanced"}, ) ``` ## Using Tavily in a Haystack Pipeline Here is a simple RAG-style pipeline that searches the web with Tavily, builds a prompt from the returned documents, and sends the prompt to a chat model: ```python theme={null} from haystack import Pipeline from haystack.utils import Secret from haystack.components.builders.chat_prompt_builder import ChatPromptBuilder from haystack.components.generators.chat import OpenAIChatGenerator from haystack.dataclasses import ChatMessage from haystack_integrations.components.websearch.tavily import TavilyWebSearch web_search = TavilyWebSearch(top_k=3) prompt_template = [ ChatMessage.from_system("You are a helpful assistant."), ChatMessage.from_user( "Given the information below:\n" "{% for document in documents %}{{ document.content }}\n{% endfor %}\n" "Answer the following question: {{ query }}\n" "Answer:" ), ] prompt_builder = ChatPromptBuilder( template=prompt_template, required_variables={"query", "documents"}, ) llm = OpenAIChatGenerator( api_key=Secret.from_env_var("OPENAI_API_KEY"), model="gpt-4o-mini", ) pipe = Pipeline() pipe.add_component("search", web_search) pipe.add_component("prompt_builder", prompt_builder) pipe.add_component("llm", llm) pipe.connect("search.documents", "prompt_builder.documents") pipe.connect("prompt_builder.prompt", "llm.messages") query = "What is Haystack by deepset?" result = pipe.run( data={ "search": {"query": query}, "prompt_builder": {"query": query}, } ) print(result["llm"]["replies"][0].content) ``` > **Note:** This example uses `OpenAIChatGenerator`, so you will also need to set `OPENAI_API_KEY`. ## Async Usage `TavilyWebSearch` also supports asynchronous execution with `run_async`: ```python theme={null} import asyncio from haystack_integrations.components.websearch.tavily import TavilyWebSearch async def main(): web_search = TavilyWebSearch(top_k=3) result = await web_search.run_async(query="What is Haystack by deepset?") print(f"Found {len(result['documents'])} documents") asyncio.run(main()) ``` ## Key Parameters * `api_key`: Tavily API key. Defaults to the `TAVILY_API_KEY` environment variable. * `top_k`: Maximum number of search results to return. Defaults to `10`. * `search_params`: Additional parameters forwarded to Tavily Search, including `search_depth`, `include_answer`, `include_raw_content`, `include_domains`, and `exclude_domains`. For the full set of supported Tavily search options, see the [Tavily Search API reference](https://docs.tavily.com/documentation/api-reference/endpoint/search). # LangChain Source: https://docs.tavily.com/documentation/integrations/langchain We're excited to partner with Langchain as their recommended search tool! > **Warning**: The [`langchain_community.tools.tavily_search.tool`](https://python.langchain.com/docs/integrations/tools/tavily_search/) is deprecated. While it remains functional for now, we strongly recommend migrating to the new `langchain-tavily` Python package which supports [Search](#tavily-search), [Extract](#tavily-extract), [Map](#tavily-mapcrawl), [Crawl](#tavily-mapcrawl), [Research](#tavily_research) functionality and receives continuous updates with the latest features. The [langchain-tavily](https://pypi.org/project/langchain-tavily/) Python package is the official LangChain integration of Tavily, including [Search](#tavily-search), [Extract](#tavily-extract), [Map](#tavily-mapcrawl), [Crawl](#tavily-mapcrawl), [Research](#tavily_research) functionality. ## Installation ```bash theme={null} pip install -U langchain-tavily ``` ### Credentials We also need to set our Tavily API key. You can get an API key by visiting [this site](https://app.tavily.com/sign-in) and creating an account. ```bash theme={null} import getpass import os if not os.environ.get("TAVILY_API_KEY"): os.environ["TAVILY_API_KEY"] = getpass.getpass("Tavily API key:\n") ``` ## Tavily Search Here we show how to instantiate the Tavily search tool. This tool allows you to complete search queries using Tavily's Search API endpoint. ### Available Parameters The Tavily Search API accepts various parameters to customize the search: * `max_results` (optional, int): Maximum number of search results to return. Default is 5. * `topic` (optional, str): Category of the search. Can be "general", "news", or "finance". Default is "general". * `include_answer` (optional, bool): Include an answer to original query in results. Default is False. * `include_raw_content` (optional, bool): Include cleaned and parsed HTML of each search result. Default is False. * `include_images` (optional, bool): Include a list of query related images in the response. Default is False. * `include_image_descriptions` (optional, bool): Include descriptive text for each image. Default is False. * `search_depth` (optional, str): Depth of the search, either "basic" or "advanced". Default is "basic". * `time_range` (optional, str): The time range back from the current date ( publish date ) to filter results - "day", "week", "month", or "year". Default is None. * `start_date` (optional, str): Will return all results after the specified start date ( publish date ). Required to be written in the format YYYY-MM-DD. Default is None. * `end_date` (optional, str): Will return all results before the specified end date. Required to be written in the format YYYY-MM-DD. Default is None. * `include_domains` (optional, List\[str]): List of domains to specifically include. Maximum 300 domains. Default is None. * `exclude_domains` (optional, List\[str]): List of domains to specifically exclude. Maximum 150 domains. Default is None. * `include_usage` (optional, bool): Whether to include credit usage information in the response. Default is False. For a comprehensive overview of the available parameters, refer to the [Tavily Search API documentation](https://docs.tavily.com/documentation/api-reference/endpoint/search) ### Instantiation ```python theme={null} from langchain_tavily import TavilySearch tool = TavilySearch( max_results=5, topic="general", # include_answer=False, # include_raw_content=False, # include_images=False, # include_image_descriptions=False, # search_depth="basic", # time_range="day", # start_date=None, # end_date=None, # include_domains=None, # exclude_domains=None, # include_usage= False ) ``` ### 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: `include_images`, `search_depth`, `time_range`, `include_domains`, `exclude_domains`, `start_date`, `end_date` * For reliability and performance reasons, certain parameters that affect response size cannot be modified during invocation: `include_answer` and `include_raw_content`. These limitations prevent unexpected context window issues and ensure consistent results. NOTE: The optional arguments are available for agents to dynamically set. If you set an argument during instantiation and then invoke the tool with a different value, the tool will use the value you passed during invocation. ### Direct Tool Invocation ```python theme={null} # Basic usage result = tavily_search.invoke({"query": "What happened at the last wimbledon"}) ``` Example output: ```python theme={null} { 'query': 'What happened at the last wimbledon', 'follow_up_questions': None, 'answer': None, 'images': [], 'results': [ {'url': 'https://en.wikipedia.org/wiki/Wimbledon_Championships', 'title': 'Wimbledon Championships - Wikipedia', 'content': 'Due to the COVID-19 pandemic, Wimbledon 2020 was cancelled ...', 'score': 0.62365627198, 'raw_content': None}, {'url': 'https://www.cbsnews.com/news/wimbledon-men-final-carlos-alcaraz-novak-djokovic/', 'title': "Carlos Alcaraz beats Novak Djokovic at Wimbledon men's final to ...", 'content': 'In attendance on Sunday was Catherine, the Princess of Wales ...', 'score': 0.5154731446, 'raw_content': None} ], 'response_time': 2.3 } ``` ### Use with Agent ```python theme={null} # !pip install -qU langchain langchain-openai langchain-tavily from langchain.agents import create_agent from langchain_openai import ChatOpenAI from langchain_tavily import TavilySearch # Initialize the Tavily Search tool tavily_search = TavilySearch(max_results=5, topic="general") # Initialize the agent with the search tool agent = create_agent( model=ChatOpenAI(model="gpt-5"), tools=[tavily_search], system_prompt="You are a helpful research assistant. Use web search to find accurate, up-to-date information." ) # Use the agent response = agent.invoke({ "messages": [{"role": "user", "content": "What is the most popular sport in the world? Include only Wikipedia sources."}] }) ``` > **Tip**: For more relevant and time-aware results, inject today's date into your system prompt. This helps the agent understand the current context when searching for recent information. For example: `f"You are a helpful research assistant. Today's date is {datetime.today().strftime('%B %d, %Y')}. Use web search to find accurate, up-to-date information."` ## Tavily Extract Here we show how to instantiate the Tavily extract tool. This tool allows you to extract content from URLs using Tavily's Extract API endpoint. ### Available Parameters The Tavily Extract API accepts various parameters: * `extract_depth` (optional, str): The depth of the extraction, either "basic" or "advanced". Default is "basic". * `include_images` (optional, bool): Whether to include images in the extraction. Default is False. For a comprehensive overview of the available parameters, refer to the [Tavily Extract API documentation](https://docs.tavily.com/documentation/api-reference/endpoint/extract) ### Instantiation ```python theme={null} from langchain_tavily import TavilyExtract tool = TavilyExtract( extract_depth="basic", # include_images=False ) ``` ### Invoke directly with args The Tavily extract tool accepts the following arguments during invocation: * `urls` (required): A list of URLs to extract content from. * Both `extract_depth` and `include_images` can also be set during invocation NOTE: The optional arguments are available for agents to dynamically set. If you set an argument during instantiation and then invoke the tool with a different value, the tool will use the value you passed during invocation. ### Direct Tool Invocation ```python theme={null} # Extract content from a URL result = tavily_extract.invoke({ "urls": ["https://en.wikipedia.org/wiki/Lionel_Messi"] }) ``` Example output: ```python theme={null} { 'results': [{ 'url': 'https://en.wikipedia.org/wiki/Lionel_Messi', 'raw_content': 'Lionel Messi\nLionel Andrés "Leo" Messi...', 'images': [] }], 'failed_results': [], 'response_time': 0.79 } ``` ## Tavily Map/Crawl Tavily provides two complementary tools for website exploration: **Map** and **Crawl**. The `map` tool discovers and lists URLs from a website, providing a structural overview without extracting content. The `crawl` tool then extracts the full content from these discovered URLs, making it ideal for data extraction, documentation indexing, and building knowledge bases. ### Tavily Map The Map tool discovers all internal links starting from a base URL, perfect for understanding site structure or planning content extraction. #### Available Parameters * `url` (required, str): The root URL to begin mapping. * `instructions` (optional, str): Natural language instructions guiding the mapping process. For a comprehensive overview, refer to the [Tavily Map API documentation](https://docs.tavily.com/documentation/api-reference/endpoint/map) #### Instantiation ```python theme={null} from langchain_tavily import TavilyMap tool = TavilyMap() ``` #### Direct Tool Invocation ```python theme={null} # Map a website structure result = tavily_map.invoke({ "url": "https://docs.example.com", "instructions": "Find all documentation and tutorial pages" }) ``` Example output: ```python theme={null} { 'base_url': 'https://docs.example.com', 'results': [ 'https://docs.example.com', 'https://docs.example.com/api', 'https://docs.example.com/tutorials', 'https://docs.example.com/api/endpoints', 'https://docs.example.com/tutorials/getting-started' ], 'request_id': 'req_abc123', 'response_time': 2.1 } ``` ### Tavily Crawl The Crawl tool extracts full content from URLs. It works perfectly with mapped URLs or can be used standalone to crawl from a starting point. #### Available Parameters * `url` (required, str): The root URL to begin the crawl. * `instructions` (optional, str): Natural language instructions guiding content extraction. For a comprehensive overview, refer to the [Tavily Crawl API documentation](https://docs.tavily.com/documentation/api-reference/endpoint/crawl) #### Instantiation ```python theme={null} from langchain_tavily import TavilyCrawl tool = TavilyCrawl() ``` #### Direct Tool Invocation ```python theme={null} # Crawl and extract content result = tavily_crawl.invoke({ "url": "https://docs.example.com", "instructions": "Extract API documentation and code examples" }) ``` Example output: ```python theme={null} { 'base_url': 'https://docs.example.com', 'results': [ { 'url': 'https://docs.example.com', 'raw_content': '# Documentation\nWelcome to our API documentation...' }, { 'url': 'https://docs.example.com/api', 'raw_content': '# API Reference\nComplete API reference guide...' } ], 'response_time': 4.5, 'request_id': 'req_abc123' } ``` ## Tavily Research Here we show how to instantiate the Tavily research tool. This tool allows you to create comprehensive research tasks using Tavily's Research API endpoint, with optional structured output. ### Available Parameters * `input` (required, str): The research task or question to investigate. * `model` (optional, str): The research model to use, one of `"mini"`, `"pro"`, or `"auto"`. Default is `"auto"`. * `output_schema` (optional, dict): A JSON Schema object that defines the structure of the research output. Must include a `properties` field and may optionally include a `required` field. * `stream` (optional, bool): Whether to stream the research results as they are generated. When `True`, returns a streaming response. Default is `False`. * `citation_format` (optional, str): The format for citations in the research report, one of `"numbered"`, `"mla"`, `"apa"`, or `"chicago"`. Default is `"numbered"`. ### Instantiation ```python theme={null} from langchain_tavily import TavilyResearch tavily_research = TavilyResearch( # model="auto", # citation_format="numbered", # stream=False, ) ``` ### Invoke directly with args The Tavily research tool accepts the following arguments during invocation: * `input` (required): A natural language research task or question. * The following arguments can also be set during invocation: `model`, `output_schema`, `stream`, and `citation_format`. NOTE: The optional arguments are available for agents to dynamically set. If you set an argument during instantiation and then invoke the tool with a different value, the tool will use the value you passed during invocation. ### Direct Tool Invocation ```python theme={null} # Create a research task with a structured output schema result = tavily_research.invoke({ "input": "Research the latest developments in AI and summarize key trends.", "model": "mini", "citation_format": "apa", }) ``` Example non-streaming response: ```python theme={null} { "request_id": "test-request-123", "created_at": "2024-01-01T00:00:00Z", "status": "pending", "input": "Research the latest developments in AI and summarize key trends.", "model": "mini" } ``` If `stream=True` is set (either in the constructor or at invocation time), `invoke` returns a generator (for sync clients) or async generator (for async clients) that yields the research output as it is generated. ## Tavily Get Research The Tavily Get Research tool retrieves the results of a previously created research task using its `request_id`. ### Available Parameters * `request_id` (required, str): The unique identifier of the research task to retrieve. ### Instantiation ```python theme={null} from langchain_tavily import TavilyGetResearch tavily_get_research = TavilyGetResearch() ``` ### Direct Tool Invocation ```python theme={null} # Retrieve results for a completed research task result = tavily_get_research.invoke({ "request_id": "test-request-123" }) ``` Example response: ```python theme={null} { "request_id": "test-request-123", "created_at": "2024-01-01T00:00:00Z", "completed_at": "2024-01-01T00:05:00Z", "status": "completed", "content": "This is a comprehensive research report on AI developments...", "sources": [ { "title": "AI Research Paper", "url": "https://example.com/ai-paper", } ] } ``` # Langflow Source: https://docs.tavily.com/documentation/integrations/langflow Integrate Tavily with Langflow, an open-source visual framework for building multi-agent and RAG applications. ## Introduction Integrate [Tavily with Langflow](https://blog.langflow.org/web-search-in-your-ai-agents-a-langflow-tutorial/) to create powerful AI workflows using a visual interface. Langflow is an open-source tool that provides a visual builder for creating AI agents and workflows, making it easy to incorporate Tavily's search and extraction capabilities into your applications. ## Installation Langflow works with Python 3.10 to 3.13. You can install it using either UV (recommended) or pip: ```bash theme={null} # Using UV (recommended) uv pip install langflow # Using pip pip install langflow ``` ## Setting Up Tavily Components in Langflow ### Step 1: Launch Langflow After installation, start Langflow: ```bash theme={null} langflow run ``` This will start the Langflow server locally at `http://localhost:7860`. ### Step 2: Using Tavily Components Langflow provides two main Tavily components in the **Tools** section of the components library: 1. **Tavily Search API**: Perform web searches and retrieve relevant information * Located under Tools > Tavily Search API * **Configuration Options**: Select the component and go to "Controls" to access all available settings. Here are some key examples: * Max Results: Number of results to return * Search Depth: "basic" or "advanced" * *Note: Additional parameters are available in the Controls panel* 2. **Tavily Extract API**: Extract content from web pages * Located under Tools > Tavily Extract API * **Configuration Options**: Select the component and go to "Controls" to access all available settings. Here are some key examples: * Extract Depth: "basic" or "advanced" * *Note: Additional parameters are available in the Controls panel* ### Step 3: Configure Your Tavily API Key To use Tavily components, you need to enter your [Tavily API key](https://app.tavily.com/home) under "Tavily API Key" ## Example Workflows ### Basic Search Workflow 1. Add a Tavily Search component to your flow 2. Connect it to a prompt template 3. Configure the search parameters 4. Add an LLM component to process the results 5. Connect to an output component ### Content Extraction Workflow 1. Add a Tavily Extract component 2. Connect it to a URL input 3. Configure extraction parameters 4. Add processing components as needed 5. Connect to your desired output ## Example Use Cases 1. **Research Assistant** * Combine Tavily Search with LLMs for comprehensive research * Extract and summarize information from multiple sources 2. **Content Aggregation** * Use Tavily Extract to gather content from specific websites * Process and format the extracted content 3. **Market Intelligence** * Create workflows for competitive analysis * Monitor industry trends and news 4. **Documentation Search** * Build custom documentation search interfaces * Extract and format technical documentation ## Additional Resources * [Langflow GitHub Repository](https://github.com/langflow-ai/langflow) * [Langflow Documentation](https://docs.langflow.org) # LibreChat Source: https://docs.tavily.com/documentation/integrations/librechat Use Tavily inside LibreChat for web search, content extraction, and as a built-in agent tool. Tavily on LibreChat ## Introduction [LibreChat](https://www.librechat.ai/) is an open-source chat platform that supports multiple AI providers, agents, and a configurable web search system. Tavily integrates with LibreChat in three ways: * **Web search provider** for the built-in `Web Search` feature. * **Scraper / extract provider** for fetching page contents alongside search. * **Built-in agent tool** (`Tavily Search`) inside the LibreChat Agent Builder. This lets your LibreChat conversations and custom agents access real-time, agent-optimized web data without any custom integration code. ## Prerequisites * A running LibreChat instance (self-hosted or cloud-based). See the [LibreChat docs](https://www.librechat.ai/docs) for installation. * A [Tavily API key](https://app.tavily.com/home). ## Web search in LibreChat LibreChat's [Web Search feature](https://www.librechat.ai/docs/features/web_search#tavily) uses a pluggable pipeline of **search provider → scraper → reranker**. Tavily can power both the search and scrape stages. ### Configure Tavily as a provider Set the environment variable in your LibreChat `.env` file: ```bash theme={null} TAVILY_API_KEY=your_tavily_api_key ``` LibreChat picks this up automatically for both the search and extract roles. If you prefer to manage configuration centrally, reference the environment variable in your `librechat.yaml`: ```yaml theme={null} webSearch: tavilyApiKey: "${TAVILY_API_KEY}" ``` Only reference environment variable names in YAML - for best practices, never embed your API key directly. Restart LibreChat, then ensure **Web Search** is enabled in the settings. LibreChat will route queries through Tavily Search, fetch the most relevant pages with Tavily Extract, and feed the results back to the model. ### Why use Tavily for both stages Tavily can serve as the search provider and the scraper provider simultaneously, so you can run the full web search pipeline with a single API key: | Stage | Tavily capability | | ------- | --------------------------------------------------------------------------------------------------------- | | Search | Agent-optimized results with configurable search depth, time-based filtering, and domain include/exclude. | | Extract | Clean page content with configurable extract depth, plus image and favicon extraction. | Pair Tavily with a supported reranker in `librechat.yaml` if you want an additional ranking stage on top of Tavily's results. ## Tavily as a built-in agent tool LibreChat's [Agent Builder](https://www.librechat.ai/docs/features/agents) ships with `Tavily Search` as a built-in tool, so any custom agent you build can call Tavily directly. Select **Agents** from the endpoint menu, then open the **Agent Builder** in the side panel. Set the agent's name, avatar, model, and instructions. In the agent's tool list, toggle on **Tavily Search**. If `TAVILY_API_KEY` is not set in the environment, LibreChat will prompt for the key in the UI the first time the tool is used. Save the agent and start a conversation. The agent will now call Tavily whenever it needs current web information. ## Best practices * **Use one Tavily key end-to-end** — the same key powers Web Search and the built-in agent tool, which keeps usage and billing in one place. * **Combine search + extract** — let Tavily search for sources and extract the most relevant pages before sending content to the model, which keeps context windows tight. * **Pick the right surface** — use Web Search for ad-hoc chat queries and the built-in `Tavily Search` tool for simple agents. You can also connect the [Tavily MCP server](/documentation/mcp) when an agent needs the full research workflow. ## Resources * [LibreChat Web Search documentation](https://www.librechat.ai/docs/features/web_search) * [LibreChat Agents documentation](https://www.librechat.ai/docs/features/agents) * [Tavily MCP documentation](/documentation/mcp) * [Tavily API dashboard](https://app.tavily.com/home) # LlamaIndex Source: https://docs.tavily.com/documentation/integrations/llamaindex Search the web from LlamaIndex with Tavily. This tool has a more extensive example use case documented in a Jupyter notebook [here](https://github.com/run-llama/llama_index/blob/main/llama-index-integrations/tools/llama-index-tools-tavily-research/examples/tavily.ipynb). ## Install Tavily and LlamaIndex The following dependencies are required to properly run the integration: ```bash theme={null} pip install llama-index-tools-tavily-research llama-index llama-hub tavily-python ``` ## Usage You can use access Tavily in LlamaIndex through the `TavilyToolSpec`. Here is a simple use case that performs a web search with Tavily and generates an answer to the user's search query: ```python theme={null} from llama_index.tools.tavily_research.base import TavilyToolSpec from llama_index.agent.openai import OpenAIAgent tavily_tool = TavilyToolSpec( api_key='tvly-YOUR_API_KEY', ) agent = OpenAIAgent.from_tools(tavily_tool.to_tool_list()) agent.chat('What happened in the latest Burning Man festival?') ``` `search`: Search for relevant dynamic data based on a query. Returns a list of urls and their relevant content. This loader is designed to be used as a way to load data as a Tool in an Agent. See [here](https://github.com/emptycrown/llama-hub/tree/main) for examples. # Make Source: https://docs.tavily.com/documentation/integrations/make Tavily is now available for no-code integration through Make. ## Introduction Integrate [Tavily with Make](https://www.make.com/en/integrations/tavily) to enhance your business processes without writing a single line of code. With Tavily's powerful search and content extraction capabilities, you can seamlessly integrate real-time online information into your Make workflows and automations. Make-Tavily ## How to set up Tavily with Make [Log in](https://www.make.com/en/login) to your Make account. Create a new scenario and select a trigger module that will start your workflow. Add Tavily as an action module in your scenario and choose between **Perform a Search** or **Extract Raw Content**: **Connection:** Connect your Tavily account by entering your [Tavily API key](https://app.tavily.com/home). **Configuration:** Set up your parameters: **For Search:** * Enter your search `query` (can be manually entered or populated from another module's output) * Select a `topic` (`general` or `news`) * Choose whether to include raw content or generate an answer * Specify domains to include or exclude * Set search depth and other optional parameters **For Extract:** * Enter the URL(s) to extract content from (can be a single URL or multiple URLs from another module's output) * Choose extraction type (`basic` or `advanced`) **Test:** Run a test to verify your configuration. Utilize the search results in your workflow: * Process data through additional modules * Send information to your CRM or database * Generate reports or notifications * Feed data into AI models for further processing ## Use cases for Tavily in Make Leverage Tavily's capabilities to create powerful automated workflows: * **Competitive Intelligence**: Automatically gather and analyze competitor information * **Market Research**: Track industry trends and market developments * **Content Curation**: Collect and organize relevant content for your business * **Lead Enrichment**: Enhance lead data with real-time information * **News Monitoring**: Stay updated with the latest developments in your field ## Detailed example - automated market research Create an automated workflow that performs market research and delivers insights to your team. 1. **Trigger:** Schedule the scenario to run daily or weekly 2. **Generate Search Queries:** Use an AI module to create relevant search queries 3. **Execute Searches:** Use Tavily to perform multiple searches with the generated queries 4. **Process Results:** Filter and organize the search results 5. **Generate Report:** Use an AI module to create a comprehensive report 6. **Deliver Insights:** Send the report via email or to your team's communication platform ## Best practices To optimize your Tavily integration in Make: * Use the Iterator module to process multiple search results efficiently * Use filters to process only relevant results * Use the Aggregator module to combine multiple search results # Mastra Source: https://docs.tavily.com/documentation/integrations/mastra Use Tavily as first-class Mastra tools for web search, extract, crawl, and map via the native package. ## Introduction [Mastra](https://mastra.ai) is a TypeScript framework for building AI agents and workflows. The [`@mastra/tavily`](https://mastra.ai/reference/tools/tavily) package exposes Tavily's [Search](https://docs.tavily.com/documentation/api-reference/endpoint/search), [Extract](https://docs.tavily.com/documentation/api-reference/endpoint/extract), [Crawl](https://docs.tavily.com/documentation/api-reference/endpoint/crawl), and [Map](https://docs.tavily.com/documentation/api-reference/endpoint/map) APIs as Mastra-compatible tools with [Zod](https://zod.dev)-based input/output schemas. For full reference docs, please refer to the [Mastra documentation](https://docs.mastra.ai/reference/tools/tavily). ## Step-by-Step Integration Guide ### Step 1: Install Required Packages ```bash theme={null} npm install @mastra/tavily @tavily/core zod ``` ### Step 2: Set Up API Keys * **Tavily API Key:** [Get your Tavily API key here](https://app.tavily.com/home) * **Anthropic API Key** (or any Mastra-supported provider): [Get an Anthropic API key here](https://console.anthropic.com/) Set these as environment variables: ```bash theme={null} export TAVILY_API_KEY=tvly-your-api-key export ANTHROPIC_API_KEY=your-anthropic-api-key ``` All factory functions read `TAVILY_API_KEY` by default. You can override per tool by passing `{ apiKey }`. ### Step 3: Create Tavily Tools Use `createTavilyTools()` to get all four tools with shared configuration: ```typescript theme={null} import { createTavilyTools } from "@mastra/tavily"; const tools = createTavilyTools(); // tools.tavilySearch, tools.tavilyExtract, tools.tavilyCrawl, tools.tavilyMap // Or with an explicit API key: const tools = createTavilyTools({ apiKey: "tvly-..." }); ``` Each tool can also be created individually when you only need one: ```typescript theme={null} import { createTavilySearchTool, createTavilyExtractTool, } from "@mastra/tavily"; const searchTool = createTavilySearchTool(); const extractTool = createTavilyExtractTool(); ``` ### Step 4: Wire Tools into a Mastra Agent ```typescript theme={null} import { Agent } from "@mastra/core/agent"; import { createTavilySearchTool, createTavilyExtractTool, } from "@mastra/tavily"; const agent = new Agent({ id: "web-search-agent", name: "Web Search Agent", model: "anthropic/claude-sonnet-4-6", instructions: "You are a web search assistant. Use the search tool to find relevant pages, then use extract to pull full content from the best results.", tools: { search: createTavilySearchTool(), extract: createTavilyExtractTool(), }, }); ``` ## Available Tools ### Tavily Search Real-time web search. Tool ID: `tavily-search`. ```typescript theme={null} import { createTavilySearchTool } from "@mastra/tavily"; const searchTool = createTavilySearchTool(); ``` **Key input options:** * `query` (required) — the search query * `searchDepth` — `"basic"`, `"advanced"`, `"fast"`, or `"ultra-fast"` * `maxResults` — 1–20 * `includeAnswer` — `boolean`, `"basic"`, or `"advanced"` for an AI-generated summary * `includeImages`, `includeImageDescriptions` * `includeRawContent` — `false`, `"markdown"`, or `"text"` * `includeDomains`, `excludeDomains` — string arrays * `timeRange` — `"day"`, `"week"`, `"month"`, or `"year"` ### Tavily Extract Clean, structured content extraction from one or more URLs (up to 20 per request). Tool ID: `tavily-extract`. ```typescript theme={null} import { createTavilyExtractTool } from "@mastra/tavily"; const extractTool = createTavilyExtractTool(); ``` **Key input options:** * `urls` (required) — 1–20 URLs * `extractDepth` — `"basic"` or `"advanced"` (use `"advanced"` for tables and embedded content) * `query` — user intent used to rerank extracted chunks * `includeImages` * `format` — `"markdown"` (default) or `"text"` ### Tavily Crawl Crawl a website from a starting URL with configurable depth, breadth, and domain constraints. Tool ID: `tavily-crawl`. ```typescript theme={null} import { createTavilyCrawlTool } from "@mastra/tavily"; const crawlTool = createTavilyCrawlTool(); ``` **Key input options:** * `url` (required) — root URL for the crawl * `maxDepth`, `maxBreadth`, `limit` * `instructions` — natural-language crawling hints * `selectPaths`, `selectDomains`, `excludePaths`, `excludeDomains` — regex arrays * `allowExternal` * `extractDepth`, `includeImages`, `format` ### Tavily Map Discover site structure without extracting content — returns a list of URLs. Tool ID: `tavily-map`. ```typescript theme={null} import { createTavilyMapTool } from "@mastra/tavily"; const mapTool = createTavilyMapTool(); ``` **Key input options:** * `url` (required) — root URL for the map * `maxDepth`, `maxBreadth`, `limit` * `instructions` * `selectPaths`, `selectDomains`, `excludePaths`, `excludeDomains` * `allowExternal` ## Configuration All factory functions accept the same `TavilyClientOptions`: * `apiKey` — falls back to the `TAVILY_API_KEY` environment variable * `clientSource` — attribution string sent with each request (defaults to `"mastra"`) * `apiBaseURL` — override the Tavily API base URL * `proxies` — proxy configuration for the underlying HTTP client * `projectId` — Tavily project ID for request scoping ## Using Multiple Tools Together Combine tools for richer research workflows — for example, map a site first, then crawl the paths you care about: ```typescript theme={null} import { Agent } from "@mastra/core/agent"; import { createTavilyTools } from "@mastra/tavily"; const tools = createTavilyTools(); const agent = new Agent({ id: "site-research-agent", name: "Site Research Agent", model: "anthropic/claude-sonnet-4-6", instructions: "Given a website, map its structure, pick the most relevant paths, then crawl them and summarize the findings.", tools, }); ``` ## Environment Variables | Variable | Description | | ---------------- | ------------------------------------------------------------------------------------------- | | `TAVILY_API_KEY` | Your Tavily API key. Used as the default when `apiKey` is not passed to a factory function. | ## Benefits of Tavily + Mastra * **First-class tools:** drop-in `createTool()`-compatible factories with Zod input/output schemas. * **Lazy, cached client:** each tool instantiates `@tavily/core` on first use and reuses it across calls. # n8n Source: https://docs.tavily.com/documentation/integrations/n8n Tavily is now available for no-code integration through n8n. ## Introduction Integrate Tavily with n8n to enhance your workflows with real-time web search and content extraction—without writing code. With Tavily's powerful search and extraction capabilities, you can seamlessly integrate up-to-date online information into your n8n automations. n8n ## How to set up Tavily with n8n [Log in](https://n8n.io/) to your n8n account or self-hosted instance. Create a new workflow and select a trigger node to start your automation. **Option 1: Add Tavily as a Node** In the node library, search for **Tavily**. Add it to your workflow and choose between **Search** or **Extract** actions. **Option 2: Add Tavily as a Tool to an AI Agent** If you are building an AI agent workflow, you can add Tavily as a tool to your agent. This allows your agent to use Tavily for web search or content extraction as part of its reasoning process. **Connection:** Connect your Tavily account by entering your [Tavily API key](https://app.tavily.com/home). **Configuration:** Set up your parameters: **For Search:** * Enter your search `query` (can be manually entered or populated from another node's output) * Select a `topic` (`general` or `news`) * Choose whether to include raw content or generate an answer * Specify domains to include or exclude * Set search depth and other optional parameters **For Extract:** * Enter the URL(s) to extract content from (can be a single URL or multiple URLs from another node's output) * Choose extraction type (`basic` or `advanced`) **Test:** Run a test to verify your configuration. Utilize the search or extraction results in your workflow: * Process data through additional nodes * Send information to your CRM, database, or email * Generate reports or notifications * Feed data into AI models for further processing ## Use cases for Tavily in n8n Leverage Tavily's capabilities to create powerful automated workflows: * **Job Search Automation**: Find and summarize new job postings, then send results to your inbox * **Competitive Intelligence**: Automatically gather and analyze competitor information * **Market Research**: Track industry trends and market developments * **Content Curation**: Collect and organize relevant content for your business * **Lead Enrichment**: Enhance lead data with real-time information * **News Monitoring**: Stay updated with the latest developments in your field ## Detailed example – Automated job search Create an automated workflow that uses an AI agent with Tavily as a tool for web search to find new "Software Engineering Intern Roles" on the web, summarizes the results, and sends them to your email. 1. **Trigger:** Schedule the workflow to run daily or weekly 2. **AI Agent:** Add an AI agent node to your workflow 3. **Add Tavily as a Tool:** In the AI agent configuration, add Tavily as a tool for web search 4. **Search:** The AI agent uses Tavily to find new "Software Engineering Intern Roles" 5. **Summarize:** The AI agent summarizes the search results using its LLM capabilities 6. **Email:** Use the Email node to send the summarized results to your inbox ## Best practices To optimize your Tavily integration in n8n: * Use the SplitInBatches node to process multiple search results efficiently * Use filters to process only relevant results * Use the Merge node to combine multiple search results # OpenAI Source: https://docs.tavily.com/documentation/integrations/openai Integrate Tavily with OpenAI to enhance your AI applications with real-time web search capabilities. ## Introduction This guide shows you how to integrate Tavily with OpenAI to create more powerful and informed AI applications. By combining OpenAI's language models with Tavily's real-time web search capabilities, you can build AI systems and agentic AI applications that access current information and provide up-to-date responses. ## Prerequisites Before you begin, make sure you have: * An OpenAI API key from [OpenAI Platform](https://platform.openai.com/) * A Tavily API key from [Tavily Dashboard](https://app.tavily.com/sign-in) ## Installation Install the required packages: ```bash theme={null} pip install openai tavily-python ``` ## Setup Set up your API keys: ```python theme={null} import os # Set your API keys os.environ["OPENAI_API_KEY"] = "your-openai-api-key" os.environ["TAVILY_API_KEY"] = "your-tavily-api-key" ``` ## Using Tavily with OpenAI agents SDK ```bash theme={null} pip install -U openai-agents ``` ```python theme={null} import os import asyncio from agents import Agent, Runner, function_tool from tavily import TavilyClient tavily_client = TavilyClient(api_key=os.environ["TAVILY_API_KEY"]) ``` ```python theme={null} @function_tool def tavily_search(query: str) -> str: """ Perform a web search using Tavily and return a summarized result. """ response = tavily_client.search(query,search_depth='advanced',max_results='5') results = response.get("results", []) return results or "No results found." ``` > **Note:** You can enhance the function by adding more parameters like `topic="news"`, `include_domains=["example.com"]`, `time_range="week"`, etc. to customize your search results. > You can set `auto_parameters=True` to have Tavily automatically configure search parameters based on the content and intent of your query. You can still set other parameters manually, and any explicit values you provide will override the automatic ones. ```python theme={null} async def main(): agent = Agent( name="Web Research Agent", instructions="Use tavily_search when you need up-to-date info.", tools=[tavily_search], ) out = await Runner.run(agent, "Latest developments about quantum computing from 2025") print(out.final_output) ``` ```python theme={null} asyncio.run(main()) ``` ```python theme={null} import os import asyncio from agents import Agent, Runner, function_tool from tavily import TavilyClient tavily_client = TavilyClient(api_key=os.environ["TAVILY_API_KEY"]) @function_tool def tavily_search(query: str) -> str: """ Perform a web search using Tavily and return a summarized result. """ response = tavily_client.search(query,search_depth='advanced',max_results='5') results = response.get("results", []) return results or "No results found." async def main(): agent = Agent( name="Web Research Agent", instructions="Use tavily_search when you need up-to-date info.", tools=[tavily_search], ) out = await Runner.run(agent, "Latest developments about quantum computing from 2025") print(out.final_output) asyncio.run(main()) ``` ## Using Tavily with OpenAI Chat Completions API function calling ```python theme={null} import os import json from tavily import TavilyClient from openai import OpenAI # Load your API keys from environment variables tavily_client = TavilyClient(api_key=os.environ["TAVILY_API_KEY"]) openai_client = OpenAI(api_key=os.environ["OPENAI_API_KEY"]) ``` ### Function definition Define a function that OpenAI can call to perform searches: ```python theme={null} def tavily_search(**kwargs): # Pass ALL supported kwargs straight to Tavily results = tavily_client.search(**kwargs) return results ``` ```python theme={null} # --- define tools --- tools = [ { "type": "function", "function": { "name": "tavily_search", "description": "Search the web with Tavily for up-to-date information", "parameters": { "type": "object", "properties": { "query": {"type": "string", "description": "The search query"}, "max_results": {"type": "integer", "default": 5}, }, "required": ["query"], }, }, } ] ``` [Scroll to the bottom to find the full json schema for search, extract, map and crawl](#tavily-endpoints-schema-for-openai-responses-api-tool-definition) ```python theme={null} # --- conversation --- messages = [ {"role": "system", "content": "You are a helpful assistant that uses Tavily search when needed."}, {"role": "user", "content": "What are the top trends in 2025 about AI agents?"} ] ``` ```python theme={null} #Ask the model; let it decide whether to call the tool response = openai_client.chat.completions.create( model="gpt-4o-mini", messages=messages, tools=tools, ) ``` ```python theme={null} assistant_msg = response.choices[0].message # keep the assistant msg that requested tool(s) messages.append(assistant_msg) ``` ```python theme={null} if getattr(assistant_msg, "tool_calls", None): for tc in assistant_msg.tool_calls: args = tc.function.arguments if isinstance(args, str): args = json.loads(args) elif not isinstance(args, dict): args = json.loads(str(args)) if tc.function.name == "tavily_search": # forward ALL args results = tavily_search(**args) messages.append({ "role": "tool", "tool_call_id": tc.id, "name": "tavily_search", "content": json.dumps(results), }) else: print("\nNo tool call requested by the model.") ``` ```python theme={null} # Ask the model again for the final grounded answer final = openai_client.chat.completions.create( model="gpt-4o-mini", messages=messages, ) final_msg = final.choices[0].message print("\nFINAL ANSWER:\n", final_msg.content or "(no content)") ``` ```python theme={null} import os import json from tavily import TavilyClient from openai import OpenAI # --- setup --- tavily_client = TavilyClient(api_key=os.environ["TAVILY_API_KEY"]) openai_client = OpenAI(api_key=os.environ["OPENAI_API_KEY"]) def tavily_search(**kwargs): # Pass ALL supported kwargs straight to Tavily results = tavily_client.search(**kwargs) return results # --- define tools --- tools = [ { "type": "function", "function": { "name": "tavily_search", "description": "Search the web with Tavily for up-to-date information", "parameters": { "type": "object", "properties": { "query": {"type": "string", "description": "The search query"}, "max_results": {"type": "integer", "default": 5}, }, "required": ["query"], }, }, } ] # --- conversation --- messages = [ {"role": "system", "content": "You are a helpful assistant that uses Tavily search when needed."}, {"role": "user", "content": "What are the top trends in 2025 about AI agents?"} ] #Ask the model; let it decide whether to call the tool response = openai_client.chat.completions.create( model="gpt-4o-mini", messages=messages, tools=tools, ) assistant_msg = response.choices[0].message messages.append(assistant_msg) # keep the assistant msg that requested tool(s) if getattr(assistant_msg, "tool_calls", None): for tc in assistant_msg.tool_calls: args = tc.function.arguments if isinstance(args, str): args = json.loads(args) elif not isinstance(args, dict): args = json.loads(str(args)) if tc.function.name == "tavily_search": # forward ALL args results = tavily_search(**args) messages.append({ "role": "tool", "tool_call_id": tc.id, "name": "tavily_search", "content": json.dumps(results), }) else: print("\nNo tool call requested by the model.") # Ask the model again for the final grounded answer final = openai_client.chat.completions.create( model="gpt-4o-mini", messages=messages, ) final_msg = final.choices[0].message print("\nFINAL ANSWER:\n", final_msg.content or "(no content)") ``` ## Using Tavily with OpenAI Responses API function calling ```python theme={null} import os import json from tavily import TavilyClient from openai import OpenAI # --- setup --- tavily_client = TavilyClient(api_key=os.environ["TAVILY_API_KEY"]) openai_client = OpenAI(api_key=os.environ["OPENAI_API_KEY"]) ``` ### Function definition Define a function that OpenAI can call to perform searches: ```python theme={null} # --- Function that will be called when AI requests a search --- def tavily_search(**kwargs): """ Execute a Tavily web search with the given parameters. This function is called by the AI when it needs to search the web. """ results = tavily_client.search(**kwargs) return results ``` ```python theme={null} # Define the tool for Tavily web search # This tells the AI what function it can call and what parameters it needs tools = [{ "type": "function", "name": "tavily_search", "description": "Search the web using Tavily. Provide relevant links in your answer.", "parameters": { "type": "object", "properties": { "query": { "type": "string", "description": "Search query for Tavily." }, "max_results": { "type": "integer", "description": "Max number of results to return", "default": 5 } }, "required": ["query", "max_results"], "additionalProperties": False }, "strict": True }] ``` [Scroll to the bottom to find the full json schema for search, extract, map and crawl](#tavily-endpoints-schema-for-openai-responses-api-tool-definition) ```python theme={null} # --- Step 1: Create initial conversation --- # This sets up the conversation context for the AI input_list = [ {"role": "system", "content": "You are a helpful assistant that uses Tavily search when needed."}, {"role": "user", "content": "What are the top trends in 2025 about AI agents?"} ] # --- Step 2: First API call - AI decides to search --- # The AI will analyze the user's question and decide if it needs to search the web response = openai_client.responses.create( model="gpt-4o-mini", tools=tools, input=input_list, ) # --- Step 3: Process the AI's response --- # Add the AI's response (including any function calls) to our conversation input_list += response.output ``` ```python theme={null} # --- Step 4: Execute any function calls the AI made --- for item in response.output: if item.type == "function_call": if item.name == "tavily_search": # Parse the arguments the AI provided for the search parsed_args = json.loads(item.arguments) # Execute the actual Tavily search results = tavily_search(**parsed_args) # Add the search results back to the conversation # This tells the AI what it found when it searched function_output = { "type": "function_call_output", "call_id": item.call_id, "output": json.dumps({ "results": results }) } input_list.append(function_output) ``` ```python theme={null} # --- Step 5: Second API call - AI provides final answer --- # Now the AI has the search results and can provide an informed response response = openai_client.responses.create( model="gpt-4o-mini", instructions="Based on the Tavily search results provided, give me a comprehensive summary with citations.", input=input_list, ) # --- Display the final result --- print("AI Response:") print(response.output_text) ``` ```python theme={null} import os import json from tavily import TavilyClient from openai import OpenAI # --- Setup: Initialize API clients --- tavily_client = TavilyClient(api_key=os.environ["TAVILY_API_KEY"]) openai_client = OpenAI(api_key=os.environ["OPENAI_API_KEY"]) # --- Function that will be called when AI requests a search --- def tavily_search(**kwargs): """ Execute a Tavily web search with the given parameters. This function is called by the AI when it needs to search the web. """ results = tavily_client.search(**kwargs) return results # --- Define the search tool for OpenAI to use --- # This tells the AI what function it can call and what parameters it needs tools = [{ "type": "function", "name": "tavily_search", "description": "Search the web using Tavily. Provide relevant links in your answer.", "parameters": { "type": "object", "properties": { "query": { "type": "string", "description": "Search query for Tavily." }, "max_results": { "type": "integer", "description": "Max number of results to return", "default": 5 } }, "required": ["query", "max_results"], "additionalProperties": False }, "strict": True }] # --- Step 1: Create initial conversation --- # This sets up the conversation context for the AI input_list = [ {"role": "system", "content": "You are a helpful assistant that uses Tavily search when needed."}, {"role": "user", "content": "What are the top trends in 2025 about AI agents?"} ] # --- Step 2: First API call - AI decides to search --- # The AI will analyze the user's question and decide if it needs to search the web response = openai_client.responses.create( model="gpt-4o-mini", tools=tools, input=input_list, ) # --- Step 3: Process the AI's response --- # Add the AI's response (including any function calls) to our conversation input_list += response.output # --- Step 4: Execute any function calls the AI made --- for item in response.output: if item.type == "function_call": if item.name == "tavily_search": # Parse the arguments the AI provided for the search parsed_args = json.loads(item.arguments) # Execute the actual Tavily search results = tavily_search(**parsed_args) # Add the search results back to the conversation # This tells the AI what it found when it searched function_output = { "type": "function_call_output", "call_id": item.call_id, "output": json.dumps({ "results": results }) } input_list.append(function_output) # --- Step 5: Second API call - AI provides final answer --- # Now the AI has the search results and can provide an informed response response = openai_client.responses.create( model="gpt-4o-mini", instructions="Based on the Tavily search results provided, give me a comprehensive summary with citations.", input=input_list, ) # --- Display the final result --- print("AI Response:") print(response.output_text) ``` ## Tavily endpoints schema for OpenAI Responses API tool definition > **Note:** When using these schemas, you can customize which parameters are exposed to the model based on your specific use case. For example, if you are building a finance application, you might set `topic`: `"finance"` for all queries without exposing the `topic` parameter. This way, the LLM can focus on deciding other parameters, such as `time_range`, `country`, and so on, based on the user’s request. Feel free to modify these schemas as needed and only pass the parameters that are relevant to your application. > **API Format:** The schemas below are for OpenAI Responses API. For Chat Completions API, wrap the parameters in a `"function"` object: `{"type": "function", "function": {"name": "...", "parameters": {...}}}`. ```python theme={null} tools = [ { "type": "function", "name": "tavily_search", "description": "A powerful web search tool that provides comprehensive, real-time results using Tavily's AI search engine. Returns relevant web content with customizable parameters for result count, content type, and domain filtering. Ideal for gathering current information, news, and detailed web content analysis.", "parameters": { "type": "object", "additionalProperties": False, "required": ["query"], "properties": { "query": { "type": "string", "description": "Search query" }, "auto_parameters": { "type": "boolean", "default": False, "description": "Auto-tune parameters based on the query. Explicit values you pass still win." }, "topic": { "type": "string", "enum": ["general", "news","finance"], "default": "general", "description": "The category of the search. This will determine which of our agents will be used for the search" }, "search_depth": { "type": "string", "enum": ["basic", "advanced"], "default": "basic", "description": "The depth of the search. It can be 'basic' or 'advanced'" }, "chunks_per_source": { "type": "integer", "minimum": 1, "maximum": 3, "default": 3, "description": "Chunks are short content snippets (maximum 500 characters each) pulled directly from the source." }, "max_results": { "type": "integer", "minimum": 0, "maximum": 20, "default": 5, "description": "The maximum number of search results to return" }, "time_range": { "type": "string", "enum": ["day", "week", "month", "year"], "description": "The time range back from the current date to include in the search results. This feature is available for both 'general' and 'news' search topics" }, "start_date": { "type": "string", "format": "date", "description": "Will return all results after the specified start date. Required to be written in the format YYYY-MM-DD." }, "end_date": { "type": "string", "format": "date", "description": "Will return all results before the specified end date. Required to be written in the format YYYY-MM-DD" }, "include_answer": { "description": "Include an LLM-generated answer. 'basic' is brief; 'advanced' is more detailed.", "oneOf": [ {"type": "boolean"}, {"type": "string", "enum": ["basic", "advanced"]} ], "default": False }, "include_raw_content": { "description": "Include the cleaned and parsed HTML content of each search result", "oneOf": [ {"type": "boolean"}, {"type": "string", "enum": ["markdown", "text"]} ], "default": False }, "include_images": { "type": "boolean", "default": False, "description": "Include a list of query-related images in the response" }, "include_image_descriptions": { "type": "boolean", "default": False, "description": "Include a list of query-related images and their descriptions in the response" }, "include_favicon": { "type": "boolean", "default": False, "description": "Whether to include the favicon URL for each result" }, "include_usage": { "type": "boolean", "default": False, "description": "Whether to include credit usage information in the response" }, "include_domains": { "type": "array", "items": {"type": "string"}, "maxItems": 300, "description": "A list of domains to specifically include in the search results, if the user asks to search on specific sites set this to the domain of the site" }, "exclude_domains": { "type": "array", "items": {"type": "string"}, "maxItems": 150, "description": "List of domains to specifically exclude, if the user asks to exclude a domain set this to the domain of the site" }, "country": { "type": "string", "enum": ["afghanistan", "albania", "algeria", "andorra", "angola", "argentina", "armenia", "australia", "austria", "azerbaijan", "bahamas", "bahrain", "bangladesh", "barbados", "belarus", "belgium", "belize", "benin", "bhutan", "bolivia", "bosnia and herzegovina", "botswana", "brazil", "brunei", "bulgaria", "burkina faso", "burundi", "cambodia", "cameroon", "canada", "cape verde", "central african republic", "chad", "chile", "china", "colombia", "comoros", "congo", "costa rica", "croatia", "cuba", "cyprus", "czech republic", "denmark", "djibouti", "dominican republic", "ecuador", "egypt", "el salvador", "equatorial guinea", "eritrea", "estonia", "ethiopia", "fiji", "finland", "france", "gabon", "gambia", "georgia", "germany", "ghana", "greece", "guatemala", "guinea", "haiti", "honduras", "hungary", "iceland", "india", "indonesia", "iran", "iraq", "ireland", "israel", "italy", "jamaica", "japan", "jordan", "kazakhstan", "kenya", "kuwait", "kyrgyzstan", "latvia", "lebanon", "lesotho", "liberia", "libya", "liechtenstein", "lithuania", "luxembourg", "madagascar", "malawi", "malaysia", "maldives", "mali", "malta", "mauritania", "mauritius", "mexico", "moldova", "monaco", "mongolia", "montenegro", "morocco", "mozambique", "myanmar", "namibia", "nepal", "netherlands", "new zealand", "nicaragua", "niger", "nigeria", "north korea", "north macedonia", "norway", "oman", "pakistan", "panama", "papua new guinea", "paraguay", "peru", "philippines", "poland", "portugal", "qatar", "romania", "russia", "rwanda", "saudi arabia", "senegal", "serbia", "singapore", "slovakia", "slovenia", "somalia", "south africa", "south korea", "south sudan", "spain", "sri lanka", "sudan", "sweden", "switzerland", "syria", "taiwan", "tajikistan", "tanzania", "thailand", "togo", "trinidad and tobago", "tunisia", "turkey", "turkmenistan", "uganda", "ukraine", "united arab emirates", "united kingdom", "united states", "uruguay", "uzbekistan", "venezuela", "vietnam", "yemen", "zambia", "zimbabwe"], "description": "Boost search results from a specific country. This will prioritize content from the selected country in the search results. Available only if topic is general. Country names MUST be written in lowercase, plain English, with spaces and no underscores." } } } } ] ``` ```python theme={null} tools = [ { "type": "function", "name": "tavily_extract", "description": "A powerful web content extraction tool that retrieves and processes raw content from specified URLs, ideal for data collection, content analysis, and research tasks.", "parameters": { "type": "object", "additionalProperties": False, "required": ["urls"], "properties": { "urls": { "type": "string", "description": "List of URLs to extract content from" }, "include_images": { "type": "boolean", "default": False, "description": "Include a list of images extracted from the urls in the response" }, "include_favicon": { "type": "boolean", "default": False, "description": "Whether to include the favicon URL for each result" }, "include_usage": { "type": "boolean", "default": False, "description": "Whether to include credit usage information in the response" }, "extract_depth": { "type": "string", "enum": ["basic", "advanced"], "default": "basic", "description": "Depth of extraction - 'basic' or 'advanced', if urls are linkedin use 'advanced' or if explicitly told to use advanced" }, "timeout": { "type": "number", "enum": ["basic", "advanced"], "minimum": 0, "maximum": 60, "default": None, "description": "Maximum time in seconds to wait for the URL extraction before timing out. Must be between 1.0 and 60.0 seconds. If not specified, default timeouts are applied based on extract_depth: 10 seconds for basic extraction and 30 seconds for advanced extraction" }, "format": { "type": "string", "enum": ["markdown", "text"], "default": "markdown", "description": "The format of the extracted web page content. markdown returns content in markdown format. text returns plain text and may increase latency." } } } } ] ``` ```python theme={null} tools = [ { "type": "function", "name": "tavily_map", "description": "A powerful web mapping tool that creates a structured map of website URLs, allowing you to discover and analyze site structure, content organization, and navigation paths. Perfect for site audits, content discovery, and understanding website architecture.", "parameters": { "type": "object", "additionalProperties": False, "required": ["url"], "properties": { "url": { "type": "string", "description": "The root URL to begin the mapping" }, "instructions": { "type": "string", "description": "Natural language instructions for the crawler" }, "max_depth": { "type": "integer", "minimum": 1, "maximum": 5, "default": 1, "description": "Max depth of the mapping. Defines how far from the base URL the crawler can explore" }, "max_breadth": { "type": "integer", "minimum": 1, "default": 20, "description": "Max number of links to follow per level of the tree (i.e., per page)" }, "limit": { "type": "integer", "minimum": 1, "default": 50, "description": "Total number of links the crawler will process before stopping" }, "select_paths": { "type": "array", "items": {"type": "string"}, "description": "Regex patterns to select only URLs with specific path patterns (e.g., /docs/.*, /api/v1.*)" }, "select_domains": { "type": "array", "items": {"type": "string"}, "description": "Regex patterns to select crawling to specific domains or subdomains (e.g., ^docs\\.example\\.com$)" }, "exclude_paths": { "type": "array", "items": {"type": "string"}, "description": "Regex patterns to exclude URLs with specific path patterns (e.g., /admin/.*)." }, "exclude_domains": { "type": "array", "items": {"type": "string"}, "description": "Regex patterns to exclude specific domains or subdomains" }, "allow_external": { "type": "boolean", "default": True, "description": "Whether to allow following links that go to external domains" }, "include_usage": { "type": "boolean", "default": False, "description": "Whether to include credit usage information in the response" } } } } ] ``` ```python theme={null} tools = [ { "type": "function", "name": "tavily_crawl", "description": "A powerful web crawler that initiates a structured web crawl starting from a specified base URL. The crawler expands from that point like a tree, following internal links across pages. You can control how deep and wide it goes, and guide it to focus on specific sections of the site.", "parameters": { "type": "object", "additionalProperties": False, "required": ["url"], "properties": { "url": { "type": "string", "description": "The root URL to begin the crawl" }, "instructions": { "type": "string", "description": "Natural language instructions for the crawler" }, "max_depth": { "type": "integer", "minimum": 1, "maximum": 5, "default": 1, "description": "Max depth of the crawl. Defines how far from the base URL the crawler can explore." }, "max_breadth": { "type": "integer", "minimum": 1, "default": 20, "description": "Max number of links to follow per level of the tree (i.e., per page)" }, "limit": { "type": "integer", "minimum": 1, "default": 50, "description": "Total number of links the crawler will process before stopping" }, "select_paths": { "type": "array", "items": {"type": "string"}, "description": "Regex patterns to select only URLs with specific path patterns (e.g., /docs/.*, /api/v1.*)" }, "select_domains": { "type": "array", "items": {"type": "string"}, "description": "Regex patterns to select crawling to specific domains or subdomains (e.g., ^docs\\.example\\.com$)" }, "exclude_paths": { "type": "array", "items": {"type": "string"}, "description": "Regex patterns to exclude paths (e.g., /private/.*, /admin/.*)" }, "exclude_domains": { "type": "array", "items": {"type": "string"}, "description": "Regex patterns to exclude domains/subdomains (e.g., ^private\\.example\\.com$)" }, "allow_external": { "type": "boolean", "default": True, "description": "Whether to allow following links that go to external domains" }, "include_images": { "type": "boolean", "default": False, "description": "Include images discovered during the crawl" }, "extract_depth": { "type": "string", "enum": ["basic", "advanced"], "default": "basic", "description": "Advanced extraction retrieves more data, including tables and embedded content, with higher success but may increase latency" }, "format": { "type": "string", "enum": ["markdown", "text"], "default": "markdown", "description": "The format of the extracted web page content. markdown returns content in markdown format. text returns plain text and may increase latency." }, "include_favicon": { "type": "boolean", "default": False, "description": "Whether to include the favicon URL for each result" }, "include_usage": { "type": "boolean", "default": False, "description": "Whether to include credit usage information in the response" } } } } ] ``` For more information about Tavily's capabilities, check out our [API documentation](/documentation/api-reference/introduction) and [best practices](/documentation/best-practices/best-practices-search). # OpenClaw Source: https://docs.tavily.com/documentation/integrations/openclaw Integrate Tavily with OpenClaw to give your AI agents real-time web search and content extraction across WhatsApp, Telegram, Discord, iMessage, and more. ## Introduction [OpenClaw](https://docs.openclaw.ai/) is an open-source, self-hosted gateway that connects messaging apps — WhatsApp, Telegram, Discord, iMessage, and more — to AI agents. You run a single Gateway process on your own machine or server, and it becomes the bridge between your chat apps and an always-available AI assistant. Tavily is available in OpenClaw as both a web search provider and a dedicated plugin, giving your agents real-time web search and content extraction capabilities across every connected channel. Whether a user asks a question on WhatsApp or shares a link in Telegram, the agent can search the web and extract page content to provide accurate, up-to-date answers. OpenClaw onboarding with Tavily as the web search provider ## How to set up Tavily with OpenClaw Go to the [Tavily Dashboard](https://app.tavily.com/home) to obtain your **API key**. Sign up for free if you don't have an account. You can configure Tavily using the interactive CLI or by editing your config file directly. **Option 1: Interactive CLI** Run the onboarding wizard and select Tavily when prompted for a search provider: ```bash theme={null} openclaw configure --section web ``` **Option 2: Manual configuration** Add the following to your `~/.openclaw/openclaw.json`: ```json theme={null} { "plugins": { "entries": { "tavily": { "enabled": true, "config": { "webSearch": { "apiKey": "tvly-YOUR_API_KEY" } } } } }, "tools": { "web": { "search": { "provider": "tavily" } } } } ``` **Option 3: Environment variable** Set the `TAVILY_API_KEY` environment variable, or add it to `~/.openclaw/.env`: ```bash theme={null} export TAVILY_API_KEY="tvly-YOUR_API_KEY" ``` If `TAVILY_API_KEY` is set and no other search provider key is configured, OpenClaw will auto-detect and select Tavily automatically. Once configured, your agents can use Tavily across all connected channels. Open the Control UI or send a message from any connected chat app: ```bash theme={null} openclaw dashboard ``` OpenClaw supports Tavily in two ways: `web_search` uses Tavily as the default web provider for simple searches, while Tavily-native tools like `tavily_search` and `tavily_extract` expose advanced controls such as topic selection, domain filters, search depth, and URL extraction. ## Search modes in OpenClaw Once Tavily is configured, OpenClaw can use it in two ways. ### 1. `web_search` for simple, provider-backed search If Tavily is set as your web search provider, OpenClaw's built-in `web_search` tool routes searches through Tavily. Use this when: * You want a simple search interface * Your agent only needs a query and result count * You want Tavily to power the default OpenClaw web search flow #### `web_search` parameters | Parameter | Description | | --------- | --------------------------- | | `query` | Search query | | `count` | Number of results to return | ### 2. Tavily-native tools for advanced controls Use Tavily-native tools when you need Tavily-specific capabilities beyond the generic `web_search` interface. | Tool | Use when you need | | ---------------- | ------------------------------------------------------------------------------------------------- | | `tavily_search` | Search depth, topic filtering, domain includes/excludes, recency filters, or AI-generated answers | | `tavily_extract` | Clean extraction from one or more URLs | #### `tavily_search` parameters | Parameter | Description | | ----------------- | --------------------------------------------------------- | | `query` | Search query (keep under 400 characters) | | `search_depth` | `basic` (default, fast) or `advanced` (highest relevance) | | `topic` | `general` (default), `news`, or `finance` | | `max_results` | Number of results, 1–20 (default: 5) | | `include_answer` | Include an AI-generated answer summary | | `time_range` | Filter by recency: `day`, `week`, `month`, or `year` | | `include_domains` | Array of domains to restrict results to | | `exclude_domains` | Array of domains to exclude | #### `tavily_extract` parameters | Parameter | Description | | ------------------- | ---------------------------------------------------- | | `urls` | Array of URLs to extract (1–20 per request) | | `query` | Rerank extracted chunks by relevance to this query | | `extract_depth` | `basic` (default) or `advanced` (for JS-heavy pages) | | `chunks_per_source` | Chunks per URL, 1–5 (requires `query`) | | `include_images` | Include image URLs in results | ## Use cases Leverage Tavily through OpenClaw to enhance your AI assistant across every messaging channel: * **Research on the go** — Ask your agent on WhatsApp to research a topic and get a summarized answer with sources * **Link analysis** — Share a URL in Telegram and have the agent extract and summarize its content * **News monitoring** — Use `tavily_search` with `topic: "news"` and `time_range: "day"` to set up heartbeat alerts and get daily updates via your preferred channels * **Competitive intelligence** — Run domain-filtered searches from any channel to track competitor activity * **Content curation** — Gather and organize information from multiple sources for reports or newsletters ## Learn more * [OpenClaw documentation](https://docs.openclaw.ai/) * [OpenClaw Tavily plugin docs](https://docs.openclaw.ai/tools/tavily) * [OpenClaw Web Search overview](https://docs.openclaw.ai/tools/web) * [OpenClaw on GitHub](https://github.com/openclaw/openclaw) * [Tavily API documentation](/documentation/api-reference/introduction) # Pydantic AI Source: https://docs.tavily.com/documentation/integrations/pydantic-ai Tavily is now available for integration through Pydantic AI. ## Introduction Integrate[Tavily with Pydantic AI](https://ai.pydantic.dev/common-tools/#tavily-search-tool) to enhance your AI agents with powerful web search capabilities. Pydantic AI provides a framework for building AI agents with tools, making it easy to incorporate real-time web search and data extraction into your applications. ## Step-by-Step Integration Guide ### Step 1: Install Required Packages Install the necessary Python packages: ```bash theme={null} pip install "pydantic-ai-slim[tavily]" ``` ### Step 2: Set Up API Keys * **Tavily API Key:** [Get your Tavily API key here](https://app.tavily.com/home) Set this as an environment variable in your terminal or add it to your environment configuration file: ```bash theme={null} export TAVILY_API_KEY=your_tavily_api_key ``` ### Step 3: Initialize Pydantic AI Agent with Tavily Tools ```python theme={null} import os from pydantic_ai.agent import Agent from pydantic_ai.common_tools.tavily import tavily_search_tool # Get API key from environment api_key = os.getenv('TAVILY_API_KEY') assert api_key is not None # Initialize the agent with Tavily tools agent = Agent( 'openai:o3-mini', tools=[tavily_search_tool(api_key)], system_prompt='Search Tavily for the given query and return the results.' ) ``` ### Step 4: Example Use Cases ```python theme={null} # Example 1: Basic search for news result = agent.run_sync('Tell me the top news in the GenAI world, give me links.') print(result.output) ``` Example Response: ```markdown theme={null} Here are some of the top recent news articles related to GenAI: 1. How CLEAR users can improve risk analysis with GenAI – Thomson Reuters Read more: https://legal.thomsonreuters.com/blog/how-clear-users-can-improve-risk-analysis-with-genai/ (This article discusses how CLEAR's new GenAI-powered tool streamlines risk analysis by quickly summarizing key information from various public data sources.) 2. TELUS Digital Survey Reveals Enterprise Employees Are Entering Sensitive Data Into AI Assistants More Than You Think – FT.com Read more: https://markets.ft.com/data/announce/detail?dockey=600-202502260645BIZWIRE_USPRX____20250226_BW490609-1 (This news piece highlights findings from a TELUS Digital survey showing that many enterprise employees use public GenAI tools and sometimes even enter sensitive data.) 3. The Essential Guide to Generative AI – Virtualization Review Read more: https://virtualizationreview.com/Whitepapers/2025/02/SNOWFLAKE-The-Essential-Guide-to-Generative-AI.aspx (This guide provides insights into how GenAI is revolutionizing enterprise strategies and productivity, with input from industry leaders.) ``` ## Additional Use Cases 1. **Content Curation**: Gather and organize information from multiple sources 2. **Real-time Data Integration**: Keep your AI agents up-to-date with the latest information 3. **Technical Documentation**: Search and analyze technical documentation 4. **Market Analysis**: Conduct comprehensive market research and analysis # StackAI Source: https://docs.tavily.com/documentation/integrations/stackai Using Tavily in StackAI to enhance your AI workflows with real-time web data. ## Introduction Integrate [Tavily with StackAI](https://www.stack-ai.com/integrations/tavily) to enhance your AI workflows with real-time web data. With this integration, you can easily fetch and utilize live web content in your StackAI workflows. stackai ## How to set up Tavily with StackAI [Log in](https://stack-ai.com/) to your StackAI account or self-hosted instance. Create a new workflow or choose one of the available templates. **Option 1: Add Tavily as a Node** * Search for "Tavily" under the **Apps** section in the left sidebar. * Drag and drop the "Tavily" app into your canvas. **Option 2: Add Tavily as a Tool to an AI Agent** * Choose between "Search", "Crawl", "Extract" or "Map" tool based on your needs. **Configure the Tavily Node or Tool:** * In the Connect Tavily section, create a new connection by entering a connection name and your [Tavily API key](https://app.tavily.com/home). **Configuring parameters:** **For Search:** * Enter your search `query` (can be manually entered or populated from another node's output) * Select a `topic` (`general` or `news`) * Choose whether to include raw content or generate an answer * Specify Maximum Search Results to return * Set search depth and other optional parameters **For Extract:** * Enter the URL(s) to extract content from (can be a single URL or multiple URLs from another node's output) * Choose Extract Depth (`basic` or `advanced`) * Specify the output format (`markdown` or `text`) **For Crawl:** * Enter the **Root URL** to crawl * Set the crawl instructions to guide the crawler * Set the Limit on the number of pages to crawl **For Map:** * Enter the **Root URL** to begin the mapping * Set the map instructions to guide the mapping process * Set the mapping depth to control how deep the mapping goes **Test:** Run the node to verify your configuration. Utilize the search, crawl, extract, or map results in your workflow: * Process data through additional nodes * Send information to your CRM, database, or email * Generate reports or notifications * Feed data into AI models for further processing ## Use cases for Tavily in StackAI Leverage Tavily's capabilities to create powerful automated workflows: * **Job Search Automation**: Find and summarize new job postings, then send results to your inbox * **Competitive Intelligence**: Automatically gather and analyze competitor information * **Market Research**: Track industry trends and market developments * **Content Curation**: Collect and organize relevant content for your business * **Lead Enrichment**: Enhance lead data with real-time information * **News Monitoring**: Stay updated with the latest developments in your field ## Detailed example - AI News Summary Here's an example workflow that uses Tavily to search for the latest articles on "AI advancements" and sends a summary to your email: 1. **Trigger:** Schedule the workflow to run daily 2. **AI Agent:** Add an AI agent node to your workflow 3. **Search:** The AI agent uses Tavily to find recent articles on "AI advancements" 4. **Summarize:** The AI agent summarizes the most important news and trends 5. **Delivery:** Send the summarized briefing via Email, Slack, or another integration ## Best practices To optimize your Tavily integration in StackAI: * Tightly constrain Tavily queries to specific intent, time range, and domains to avoid noisy retrieval. * Force concise, structured outputs (bullets/JSON with only required fields) to reduce tokens and parsing errors. # Tines Source: https://docs.tavily.com/documentation/integrations/tines Integrate Tavily with Tines for automated, no-code intelligence workflows. ## Introduction Integrate [Tavily with Tines](https://www.tines.com/docs/credentials/connect-flows/tavily/) to enhance your automation workflows with powerful web search and content extraction capabilities. Tines' no-code platform makes it easy to incorporate Tavily's real-time search and data extraction features into your stories, enabling you to build powerful automation workflows without writing code. ## How to set up Tavily with Tines [Log in](https://www.tines.com/) to your Tines account. Create a new story or open an existing one where you want to add Tavily. Follow these steps to add a Tavily action to your story: 1. Navigate to the Templates section. 2. Search for "Tavily" in the search bar. 3. Drag the Tavily action into your story. 4. Select a template between "Extract Web Content" and "Search the Web" based on your use case. 5. Click on the Tavily connection to set up new credentials. 6. Enter your Tavily API key in the provided field. Use Tines built-in actions to process Tavily's response: * Parse and filter search results * Enrich alerts or tickets with real-time intelligence * Trigger notifications or follow-up actions based on findings ## Use cases for Tavily in Tines * **Workbench Integration**: Connect Tavily to Tines Workbench (AI-powered chat interface) to enable real-time web search and content extraction directly in your conversations * **Market & News Monitoring**: Track industry trends or breaking news relevant to your organization * **Lead & Entity Enrichment**: Pull real-time data on companies, people, or technologies * **Content Extraction**: Extract and analyze web content for deeper investigations ## Example Use Cases Enrich a company when it is added to an Airtable database. Receive a webhook notification when a new record is added and fill out the remaining fields with web searches powered by Tavily. See the [full story](https://www.tines.com/library/stories/1312477/?name=enrich-new-airtable-company-records-using-tavily-searches) on Tines' library. Search the internet using Tavily in response to a Slack slash command. Summarize the results and post them in a Slack thread, including source links. Users can click on the links to access more detailed information from the original sources. See the [full story](https://www.tines.com/library/stories/1312847/?name=search-the-internet-with-tavily-via-slack) on Tines' library. # Vellum Source: https://docs.tavily.com/documentation/integrations/vellum Use Tavily as the built-in web search provider in the Vellum Assistant desktop app. Vellum Assistant with Tavily ## Introduction [Vellum Assistant](https://www.vellum.ai/) is a desktop AI assistant from Vellum. It ships with a built-in web search feature that connects your conversations to real-time information from the web, and Tavily is available as one of the supported search providers. Once configured, Vellum Assistant routes web search queries through the Tavily API so the model can answer questions with up-to-date, agent-optimized results. ## Prerequisites * The Vellum Assistant desktop app installed on macOS. * A [Tavily API key](https://app.tavily.com/home). ## Configure Tavily in Vellum Assistant Vellum Settings Launch Vellum Assistant and open **Settings → Models & Services**. Find the **Web Search** section, choose **Tavily** as the provider, and paste your Tavily API key into the key field. Vellum Assistant stores the key securely in the system keychain. Start a new conversation and ask a question that needs current information. Vellum Assistant will call Tavily under the hood and feed the results back to the model. ## Best practices * **Pick Tavily when you want agent-optimized results** — Tavily returns relevance-scored, LLM-friendly snippets that work especially well inside an assistant flow. * **Keep one Tavily key per workspace** — using the same key across your tools keeps usage and billing in one place on the [Tavily dashboard](https://app.tavily.com/home). ## Resources * [Vellum docs](https://www.vellum.ai/docs/) * [Tavily API dashboard](https://app.tavily.com/home) # Vercel AI SDK Source: https://docs.tavily.com/documentation/integrations/vercel Integrate Tavily with Vercel AI SDK to enhance your AI agents with powerful web search, content extraction, crawling, and site mapping capabilities. ## Introduction The `@tavily/ai-sdk` package provides pre-built AI SDK tools for Vercel's AI SDK v5, making it easy to add real-time web search, content extraction, intelligent crawling, and site mapping to your AI applications. ## Step-by-Step Integration Guide ### Step 1: Install Required Packages Install the necessary packages: ```bash theme={null} npm install ai @ai-sdk/openai @tavily/ai-sdk ``` ### Step 2: Set Up API Keys * **Tavily API Key:** [Get your Tavily API key here](https://app.tavily.com/home) * **OpenAI API Key:** [Get your OpenAI API key here](https://platform.openai.com/account/api-keys) Set these as environment variables: ```bash theme={null} export TAVILY_API_KEY=tvly-your-api-key export OPENAI_API_KEY=your-openai-api-key ``` ### Step 3: Basic Usage The simplest way to get started with Tavily Search: ```typescript theme={null} import { tavilySearch } from "@tavily/ai-sdk"; import { generateText, stepCountIs } from "ai"; import { openai } from "@ai-sdk/openai"; const result = await generateText({ model: openai("gpt-5-mini"), prompt: "What are the latest developments in quantum computing?", tools: { tavilySearch: tavilySearch(), }, stopWhen: stepCountIs(3), }); console.log(result.text); ``` ## Available Tools ### Tavily Search Real-time web search optimized for AI applications: ```typescript theme={null} import { tavilySearch } from "@tavily/ai-sdk"; import { generateText, stepCountIs } from "ai"; import { openai } from "@ai-sdk/openai"; const result = await generateText({ model: openai("gpt-5-mini"), prompt: "Research the latest trends in renewable energy technology", tools: { tavilySearch: tavilySearch({ searchDepth: "advanced", includeAnswer: true, maxResults: 5, topic: "general", }), }, stopWhen: stepCountIs(3), }); ``` **Key Configuration Options:** * `searchDepth?: "basic" | "advanced"` - Search depth (default: "basic") * `topic?: "general" | "news" | "finance"` - Search category * `includeAnswer?: boolean` - Include AI-generated answer * `maxResults?: number` - Maximum results to return (default: 5) * `includeImages?: boolean` - Include images in results * `timeRange?: "year" | "month" | "week" | "day"` - Time range for results * `includeDomains?: string[]` - Domains to include * `excludeDomains?: string[]` - Domains to exclude ### Tavily Extract Clean, structured content extraction from URLs: ```typescript theme={null} import { tavilyExtract } from "@tavily/ai-sdk"; import { generateText } from "ai"; import { openai } from "@ai-sdk/openai"; const result = await generateText({ model: openai("gpt-5-mini"), prompt: "Extract and summarize the content from https://tavily.com", tools: { tavilyExtract: tavilyExtract(), }, }); ``` **Key Configuration Options:** * `extractDepth?: "basic" | "advanced"` - Extraction depth * `format?: "markdown" | "text"` - Output format (default: "markdown") * `includeImages?: boolean` - Include images in extracted content ### Tavily Crawl Intelligent website crawling at scale: ```typescript theme={null} import { tavilyCrawl } from "@tavily/ai-sdk"; import { generateText } from "ai"; import { openai } from "@ai-sdk/openai"; const result = await generateText({ model: openai("gpt-5-mini"), prompt: "Crawl tavily.com and tell me about their integrations", tools: { tavilyCrawl: tavilyCrawl({ maxDepth: 2, limit: 50, }), }, }); ``` **Key Configuration Options:** * `maxDepth?: number` - Maximum crawl depth (1-5, default: 1) * `maxBreadth?: number` - Maximum pages per depth level (1-100, default: 20) * `limit?: number` - Maximum total pages to crawl (default: 50) * `extractDepth?: "basic" | "advanced"` - Content extraction depth * `instructions?: string` - Natural language crawling instructions * `selectPaths?: string[]` - Path patterns to include * `excludePaths?: string[]` - Path patterns to exclude * `allowExternal?: boolean` - Allow crawling external domains ### Tavily Map Website structure discovery and mapping: ```typescript theme={null} import { tavilyMap } from "@tavily/ai-sdk"; import { generateText, stepCountIs } from "ai"; import { openai } from "@ai-sdk/openai"; const result = await generateText({ model: openai("gpt-5-mini"), prompt: "Map the structure of tavily.com", tools: { tavilyMap: tavilyMap(), }, stopWhen: stepCountIs(3), }); ``` **Key Configuration Options:** * `maxDepth?: number` - Maximum mapping depth (1-5, default: 1) * `maxBreadth?: number` - Maximum pages per depth level (1-100, default: 20) * `limit?: number` - Maximum total pages to map (default: 50) * `instructions?: string` - Natural language mapping instructions * `selectPaths?: string[]` - Path patterns to include * `excludePaths?: string[]` - Path patterns to exclude * `allowExternal?: boolean` - Allow mapping external domains ## Using Multiple Tools Together You can combine multiple Tavily tools in a single AI agent for comprehensive research capabilities: ```typescript theme={null} import { tavilySearch, tavilyExtract, tavilyCrawl, tavilyMap } from "@tavily/ai-sdk"; import { generateText, stepCountIs } from "ai"; import { openai } from "@ai-sdk/openai"; const result = await generateText({ model: openai("gpt-5-mini"), prompt: "Research the company at tavily.com - search for news, map their site, and extract key pages", tools: { tavilySearch: tavilySearch({ searchDepth: "advanced" }), tavilyExtract: tavilyExtract(), tavilyCrawl: tavilyCrawl(), tavilyMap: tavilyMap(), }, stopWhen: stepCountIs(5), }); ``` ## Advanced Examples ### News Research with Time Range ```typescript theme={null} const newsResult = await generateText({ model: openai("gpt-5-mini"), prompt: "What are the top technology news stories from this week?", tools: { tavilySearch: tavilySearch({ topic: "news", timeRange: "week", maxResults: 10, }), }, stopWhen: stepCountIs(3), }); ``` ### Market Analysis with Advanced Search ```typescript theme={null} const marketResult = await generateText({ model: openai("gpt-5-mini"), prompt: "Analyze the current state of the electric vehicle market", tools: { tavilySearch: tavilySearch({ searchDepth: "advanced", topic: "finance", includeAnswer: true, maxResults: 10, }), }, stopWhen: stepCountIs(5), }); ``` ## Benefits of Tavily + Vercel AI SDK * **Pre-built Tools:** No need to manually create tool definitions - just import and use * **Type-Safe:** Full TypeScript support with proper type definitions * **Real-time Information:** Access up-to-date web content for your AI agents * **Optimized for LLMs:** Search results are specifically formatted for language models * **Multiple Capabilities:** Search, extract, crawl, and map websites - all in one package * **Easy Integration:** Works seamlessly with Vercel AI SDK v5 * **Flexible Configuration:** Extensive configuration options for all tools * **Production-Ready:** Built on the reliable Tavily API infrastructure # Zapier Source: https://docs.tavily.com/documentation/integrations/zapier Tavily is now available for no-code integration through Zapier. ## Introduction No need to write a single line of code to connect Tavily to your business processes. With Tavily's robust search capabilities, you can pull in the latest online information into any application or workflow. Simply set up [**Tavily in Zapier**](https://zapier.com/apps/tavily/integrations) to automate research, track real-time news, or feed relevant data into your tools of choice. ## How to set up Tavily with Zapier [Log in](https://zapier.com/sign-up) to your Zapier account. Create a new Zap and select a trigger event that will start your workflow. Add an action step with Tavily in your workflow: * **Setup:** Connect your Tavily account by pasting your API key. * **Configure:** Enter your search `query` along with optional parameters, such as selecting a `topic` (`general` or `news`), deciding whether to include raw content from the sources or an answer based on the content found, and specifying particular domains to run the search on. * **Test:** Test your query. Use the `results` and optionally the `answer` generated by Tavily in the rest of your workflow, such as: * Sending up-to-date research to your CRM. * Feeding real-time content into your language model (e.g., GPT models) for additional applications. * Inserting dynamic info into an email automation tool. ## Use cases for Tavily in Zapier With Tavily, you can harness the power of Retrieval-Augmented Generation (RAG) to create complex workflows. Here are some examples, for inspiration: * **Automated Email Generation**: Use Tavily to create tailored emails based on real-time data. * **Meeting Preparation**: Gather real-time information about meeting participants. For instance, before a client meeting, retrieve their latest news or social media updates and receive a concise summary through your preferred method, ensuring you’re well-informed. * **Automated Reporting**: Utilize Tavily’s online search data to generate reports. Push this information into tools like **Google Sheets**, **Notion**, or **Slack** to create a weekly digest of industry trends or competitor analysis, keeping your team updated effortlessly. ## Detailed example - company research We can build an automated workflow that executes brief company research for newly signed-up companies and delivers the report via Slack. 1. **Trigger Event:** A new company is created in your CRM. 2. **Conduct Company Search:** Use Tavily to perform a general search using the company's domain (provided by the CRM). 3. **Retrieve Current Date:** Capture the current date and pass it to the LLM in the next step. 4. **Generate Search Queries:** Request the LLM to create 3 concise search queries for Tavily to obtain additional information about the company (e.g., industry, ARR, CEO, CTO). Include the previously gathered data from the company website as context to prevent redundancy. Ask the LLM to incorporate important keywords related to the company to avoid retrieving information about a different company with the same name but in a different industry or domain. 5. **Organize Queries:** Format the generated queries into separate fields for use in distinct steps. 6. **Configure Queries:** Set up the 3 queries in Tavily across 3 individual steps. 7. **Extract Structured Data:** Instruct the LLM to fill in specific details about the company from the gathered data and indicate the sources used for verification. Additionally, instruct the LLM to use the sources extracted from the domain as the ground truth. 8. **Refine Information:** Format the information for clarity and professionalism. 9. **Send to Slack:** Deliver the final message to Slack for easy access and sharing. zap ## Best practices To use Tavily most efficiently in your Zapier workflows, keep the following guidelines in mind when designing your automations: * Create concise queries for Tavily, and if needed, create multiple Tavily steps. * If up-to-date news information is required, configure "news" as your topic. * Add the current date to your queries for relevant, updated information. * Consider using specific domains to narrow down search results. * Use an LLM to generate queries for Tavily to enable a more agentic workflow. # Try Tavily Without an API Key Source: https://docs.tavily.com/documentation/keyless Use Tavily Search and Extract with zero setup. No account, no API key, no configuration. Keyless responses are identical to keyed responses. Drop Tavily into an agent or script in seconds. When you're ready for production, swap in an API key. No code changes required. ## Why Tavily? Tavily is an AI search engine optimized for agent consumption. Built-in tools like `web_search` and `web_fetch` return raw HTML or shallow snippets, so your agent spends tokens parsing, filtering, and guessing what's relevant. Tavily Search returns clean, ranked, and scored results optimized for LLM consumption. Tavily Extract pulls structured content from any URL without dealing with JavaScript rendering or HTML cleanup. The result: fewer tokens, better context, more reliable agent behavior. Use Tavily Search and Extract with zero setup. No account, no API key, no configuration. Your agent gets real results immediately and can upgrade to an API key whenever you need higher limits. **Same results, same schema.** Keyless responses are identical to keyed responses. Your agent can't tell the difference on success. ## Direct API Send a request with the `X-Tavily-Access-Mode: keyless` header. That's it. ```bash Search theme={null} curl -X POST https://api.tavily.com/search \ -H "Content-Type: application/json" \ -H "X-Tavily-Access-Mode: keyless" \ -d '{"query": "latest AI news", "max_results": 3}' ``` ```bash Extract theme={null} curl -X POST https://api.tavily.com/extract \ -H "Content-Type: application/json" \ -H "X-Tavily-Access-Mode: keyless" \ -d '{"urls": ["https://www.tavily.com"]}' ``` The response follows the standard Tavily response schema. See the [API Reference](/documentation/api-reference/endpoint/search) for details. ## MCP Server Connect to the [Tavily Remote MCP](/documentation/mcp) without an API key. Your agent gets `tavily-search` and `tavily-extract` tools with zero configuration. ```bash Claude Code theme={null} claude mcp add tavily-remote-mcp --transport http https://mcp.tavily.com/mcp/ ``` ### Agent-installable prompt Paste this into any AI assistant to let it set up Tavily itself: ```text theme={null} Set up the Tavily MCP server so you can search the web and extract content from URLs. Follow these steps: 1. Detect which platform you're running on (Claude Code, Cursor, Windsurf, Claude Desktop, etc.) 2. Install the Tavily MCP server using the correct method for your platform: - Server URL: https://mcp.tavily.com/mcp/ - Transport: Streamable HTTP - Authentication: none required. Tavily is free to use without an API key. 3. Verify the server is connected and you have access to the tavily-search and tavily-extract tools. 4. Run a test search (e.g. "current weather in Tel Aviv") to confirm you get real results from a live source. 5. Report back whether setup succeeded. ``` ## Supported endpoints | Endpoint | Keyless | Notes | | ---------- | ------- | ------------------------------- | | `/search` | Yes | Full search with all parameters | | `/extract` | Yes | Content extraction from URLs | ## Rate limits Keyless access has rate limits. If you hit a limit, [sign up](https://app.tavily.com) for a free API key (1,000 credits/month, no credit card required) and pass it as a Bearer token: ```bash theme={null} curl -X POST https://api.tavily.com/search \ -H "Content-Type: application/json" \ -H "Authorization: Bearer tvly-YOUR_API_KEY" \ -d '{"query": "latest AI news"}' ``` When you hit a limit, Tavily returns natural-language instructions telling your agent what happened and how to continue. ## FAQ No. Success responses are identical, with the same fields and the same schema. Your agent can switch from keyless to keyed without changing how it parses responses. If you send both `X-Tavily-Access-Mode: keyless` and a valid `Authorization: Bearer` header, the API key takes precedence. The request uses your account's limits, not the keyless budget. These endpoints require an API key. [Sign up](https://app.tavily.com) to access them. You get 1,000 free credits monthly. # Tavily x402 Source: https://docs.tavily.com/documentation/machine-payments/x402 AI agents pay per request for Tavily Advanced Search in USDC on Base — no API key, no account, no human in the loop. ## Overview Tavily exposes `POST /search` over the [x402](https://x402.org) protocol so an AI agent can call it without an API key. The agent sends a request, gets back HTTP `402` with the price, signs a USDC transfer authorization, and retries. Tavily returns the search results in the same response that settles the payment. When the agent's USDC settles on Base, Tavily captures the payment and releases the result. Refunds for upstream failures are issued back to the agent's wallet automatically. `https://x402.tavily.com` `GET /.well-known/pricing` — current pricing as JSON ## How a paid request works Agent sends `POST /search` with the search query. Tavily replies `402` with the `PAYMENT-REQUIRED` header. Decodes the envelope and signs an EIP-3009 USDC transfer authorization. Retries `POST /search` with the signed `PAYMENT-SIGNATURE` header. Verifies + settles on Base, then gets search results. Returns `200` with the search results and a `PAYMENT-RESPONSE` header carrying the on-chain receipt. The `PAYMENT-REQUIRED` response header is base64-encoded JSON. Standard x402 client libraries decode it for you; you only need to handle it manually if you're using your own client. Probe the endpoint to see the raw header: ```bash theme={null} curl -i -X POST https://x402.tavily.com/search \ -H 'content-type: application/json' \ -d '{"query": "Who is Leo Messi?"}' ``` Once decoded (e.g. `base64 -d | jq`), the envelope carries a single `accepts` entry: ```json theme={null} { "x402Version": 2, "error": "Payment header is required", "resource": { "url": "https://x402.tavily.com/search", "description": "Tavily Search - advanced mode", "mimeType": "application/json" }, "accepts": [ { "scheme": "exact", "network": "eip155:8453", "amount": "10000", "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "payTo": "0x…deposit-address", "maxTimeoutSeconds": 60, "extra": { "name": "USD Coin", "version": "2", "tier": "advanced", "terms": "By using the Tavily solution, you agree to be bound by the Terms of Use (https://tavily.com/terms) and Privacy Policy (https://tavily.com/privacy) and accept that Tavily disclaims any liability with regard to the AI agent and cryptocurrency payments." } } ] } ``` `amount` is in USDC atomic units (6 decimals). `"10000"` = \$0.01. ## Pricing | Endpoint | Tier | Price | | -------------- | ---------- | ------------- | | `POST /search` | `advanced` | \$0.01 / call | Standard Tavily [search params](/documentation/api-reference/endpoint/search) (`query`, `topic`, `max_results`, `time_range`, `include_domains`, etc.) pass through unchanged; `search_depth` is always `advanced`. ## Network and asset | Network | Chain ID | Asset | Contract | | ------------ | ------------- | ----- | -------------------------------------------- | | Base mainnet | `eip155:8453` | USDC | `0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913` | The agent must sign for the **exact** atomic amount in `amount`. The on-chain transfer has to match — under-deposits don't settle. ## Client integration Any x402 v2 client works. The wire protocol is what matters; you don't need a Tavily-specific SDK. ```bash awal CLI theme={null} npx -y awal x402 pay https://x402.tavily.com/search \ -X POST \ -d '{"query":"Who is Leo Messi?"}' \ --json ``` ```python Python theme={null} # pip install 'x402[requests,evm]' import os, requests from eth_account import Account from x402 import x402ClientSync from x402.mechanisms.evm.exact import ExactEvmScheme from x402.mechanisms.evm.signers import EthAccountSigner from x402.http.clients.requests import x402_requests account = Account.from_key(os.environ["AGENT_WALLET_KEY"]) signer = EthAccountSigner(account) client = x402ClientSync() client.register("eip155:8453", ExactEvmScheme(signer=signer)) session = x402_requests(client) res = session.post( "https://x402.tavily.com/search", json={"query": "Who is Leo Messi?"}, ) print(res.json()) ``` ```ts JavaScript / TypeScript theme={null} import { wrapFetchWithPayment, x402Client } from "@x402/fetch"; import { ExactEvmScheme, toClientEvmSigner } from "@x402/evm"; import { createPublicClient, http } from "viem"; import { base } from "viem/chains"; import { privateKeyToAccount } from "viem/accounts"; const account = privateKeyToAccount(process.env.AGENT_WALLET_KEY as `0x${string}`); const publicClient = createPublicClient({ chain: base, transport: http() }); const signer = toClientEvmSigner(account, publicClient as any); const client = new x402Client().register("eip155:8453", new ExactEvmScheme(signer)); const paidFetch = wrapFetchWithPayment(fetch, client); const res = await paidFetch("https://x402.tavily.com/search", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ query: "Who is Leo Messi?" }), }); console.log(await res.json()); ``` The client wrapper handles the discovery → sign → retry handshake. From the agent's point of view it's a single `fetch` that costs USDC. ## Response A successful paid call returns `200` with the standard Tavily search response body plus a `PAYMENT-RESPONSE` header carrying the on-chain settlement tx hash: ```json theme={null} { "query": "Who is Leo Messi?", "follow_up_questions": null, "answer": null, "images": [], "results": [ { "title": "Lionel Messi Facts | Britannica", "url": "https://www.britannica.com/facts/Lionel-Messi", "content": "Lionel Messi, an Argentine footballer, is widely regarded as one of the greatest football players of his generation. Born in 1987, Messi spent the majority of his career playing for Barcelona, where he won numerous domestic league titles and UEFA Champions League titles. Messi is known for his exceptional dribbling skills, vision, and goal", "score": 0.81025416, "raw_content": null } ], "response_time": 1.5, "request_id": "" } ``` `answer`, `follow_up_questions`, `images`, and `auto_parameters` are populated only when the caller opts in (`include_answer`, `include_images`, `auto_parameters` in the request body). The minimal-request shape is what's shown above. Decode the `PAYMENT-RESPONSE` header to get the receipt: ```json theme={null} { "success": true, "payer": "0x…agent-wallet", "transaction": "0x…base-mainnet-tx-hash", "network": "eip155:8453" } ``` ## Refunds If the upstream Tavily call fails after the payment has settled, Tavily issues a refund automatically. The refund returns USDC to the wallet that originated the deposit, joined to the original payment via the EIP-3009 `nonce`. No action from the agent is required. Refunds route to the wallet that signed the deposit authorization. If the agent paid from an exchange or custodial wallet, the refund lands there. Use a self-custodied wallet for production agents. ## Terms By using this endpoint you agree to the [Terms of Use](https://tavily.com/terms) and [Privacy Policy](https://tavily.com/privacy). Tavily disclaims any liability with regard to AI agent behavior and cryptocurrency payments. The same language is surfaced inside the `402` envelope under `extra.terms`. # Tavily MCP Server Source: https://docs.tavily.com/documentation/mcp Tavily MCP Server allows you to use the Tavily API in your MCP clients. `/tavily-ai/tavily-mcp` GitHub Repo stars `@tavily/mcp` npm **Compatible with both [Cursor](https://cursor.sh) and [Claude Desktop](https://claude.ai/download)!** Tavily MCP is also compatible with any MCP client. **Check out our [tutorial](https://medium.com/@dustin_36183/building-a-knowledge-graph-assistant-combining-tavily-and-neo4j-mcp-servers-with-claude-db92de075df9) on combining Tavily MCP with Neo4j MCP server!** Tavily MCP Demo The Model Context Protocol (MCP) is an open standard that enables AI systems to interact seamlessly with various data sources and tools, facilitating secure, two-way connections. Developed by Anthropic, the Model Context Protocol (MCP) enables AI assistants like Claude to seamlessly integrate with Tavily's advanced search and data extraction capabilities. This integration provides AI models with real-time access to web information, complete with sophisticated filtering options and domain-specific search features. The Tavily MCP server provides: * Seamless interaction with the tavily-search and tavily-extract tools * Real-time web search capabilities through the tavily-search tool * Intelligent data extraction from web pages via the tavily-extract tool ## Remote MCP Server The easiest way to take advantage of Tavily MCP is by using the remote URL. This provides a seamless experience without requiring local installation or configuration. Simply use the remote MCP server URL with your Tavily API key: ``` https://mcp.tavily.com/mcp/?tavilyApiKey= ``` Get your Tavily API key from [tavily.com](https://www.tavily.com/). ### Connect to Cursor [![Install MCP Server](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=tavily-remote-mcp\&config=eyJjb21tYW5kIjoibnB4IC15IG1jcC1yZW1vdGUgaHR0cHM6Ly9tY3AudGF2aWx5LmNvbS9tY3AvP3RhdmlseUFwaUtleT08eW91ci1hcGkta2V5PiIsImVudiI6e319) Click the ⬆️ Add to Cursor ⬆️ button, this will do most of the work for you but you will still need to edit the configuration to add your API-KEY. You can get a Tavily API key [here](https://www.tavily.com/). once you click the button you should be redirect to Cursor ... You will then be redirected to your `mcp.json` file where you have to add `your-api-key`. ```json theme={null} { "mcpServers": { "tavily-remote-mcp": { "command": "npx -y mcp-remote https://mcp.tavily.com/mcp/?tavilyApiKey=", "env": {} } } } ``` ### Connect to Claude Desktop Claude desktop now supports adding `integrations` which is currently in beta. An integration in this case is the Tavily Remote MCP, below I will explain how to add the MCP as an `integration` in Claude desktop. Open claude desktop, click the button with the two sliders and then navigate to add integrations. Name the integration and insert the Tavily remote MCP url with your API key. You can get a Tavily API key [here](https://www.tavily.com/). Click `Add` to confirm. ### OpenAI Allow models to use remote MCP servers to perform tasks. * You first need to export your OPENAI\_API\_KEY * You must also add your Tavily API-key to ``, you can get a Tavily API key [here](https://www.tavily.com/) ```python theme={null} from openai import OpenAI client = OpenAI() resp = client.responses.create( model="gpt-4.1", tools=[ { "type": "mcp", "server_label": "tavily", "server_url": "https://mcp.tavily.com/mcp/?tavilyApiKey=", "require_approval": "never", ## Optional default parameters: "headers": { "DEFAULT_PARAMETERS": json.dumps({ "include_favicon": True, "include_images": False, "include_raw_content": False, }), }, }, ], input="Do you have access to the tavily mcp server?", ) print(resp.output_text) ``` ### Connect to Claude Code [Claude Code](https://docs.anthropic.com/en/docs/claude-code) natively supports remote MCP servers with OAuth authentication. Add Tavily to your Claude Code configuration by running: ```bash theme={null} claude mcp add tavily-remote-mcp --transport http https://mcp.tavily.com/mcp/ ``` When you start a new conversation, Claude Code will open a browser window for you to complete the OAuth flow and authorize access to your Tavily account. No API key needed in the URL — authentication is handled automatically via OAuth. You can also manually add the following to your `.claude/settings.json`: ```json theme={null} { "mcpServers": { "tavily-remote-mcp": { "type": "http", "url": "https://mcp.tavily.com/mcp/" } } } ``` Alternatively, you can also connect using `mcp-remote`: ```bash theme={null} claude mcp add tavily-remote-mcp -- npx -y mcp-remote https://mcp.tavily.com/mcp ``` ### Clients that don't support remote MCPs mcp-remote is a lightweight bridge that lets MCP clients that can only talk to local (stdio) servers securely connect to remote MCP servers over HTTP + SSE with OAuth-based auth, so you can host and update your server in the cloud while existing clients keep working. It serves as an experimental stop-gap until popular MCP clients natively support remote, authorized servers. ```json theme={null} { "tavily-remote": { "command": "npx", "args": [ "-y", "mcp-remote", "https://mcp.tavily.com/mcp/?tavilyApiKey=" ] } } ``` ### OAuth Authentication The Tavily Remote MCP server supports secure OAuth authentication, allowing you to connect and authorize seamlessly with compatible clients. Open the MCP Inspector and click "Open Auth Settings". Select the OAuth flow and complete these steps: 1. Metadata discovery 2. Client registration 3. Preparing authorization 4. Request authorization and obtain the authorization code 5. Token request 6. Authentication complete Once finished, you will receive an access token that lets you securely make authenticated requests to the Tavily Remote MCP server. You can configure your MCP client to use OAuth without including your Tavily API key in the URL. For example, in Cursor's `mcp.json`: ```json theme={null} { "mcpServers": { "tavily-remote-mcp": { "command": "npx mcp-remote https://mcp.tavily.com/mcp", "env": {} } } } ``` If you need to clear stored OAuth credentials and reauthenticate, run: ```bash theme={null} rm -rf ~/.mcp-auth ``` **API Key Selection for OAuth** When using OAuth authentication, you can control which API key is used by naming a key `mcp_auth_default` in your Tavily dashboard: * **Personal account**: If you have a key named `mcp_auth_default` in your personal account, it will be used for all OAuth-authenticated requests. * **Team account**: If your team has a key named `mcp_auth_default`, it will be used for all OAuth-authenticated requests. * **Both set**: If both your personal account and your team have a key named `mcp_auth_default`, the **personal key takes priority**. * **Neither set**: If no `mcp_auth_default` key exists, the `default` key in your personal account will be used. If no `default` key is set, the first available key will be used. OAuth authentication is optional—you can still use API key authentication at any time by including your Tavily API key in the URL query parameter (`?tavilyApiKey=...`) or by setting it in the Authorization header. Alternatively, you can also run the MCP server locally. ### Default Parameters When using the remote MCP, you can specify default parameters for all requests by including a `DEFAULT_PARAMETERS` header containing a JSON object with your desired defaults. Example: ``` {"include_images":true, "search_depth": "advanced", "max_results": 10} ``` ### Session & User Attribution The remote MCP server automatically attaches identifiers to every Tavily API call so requests can be attributed back to a session. It generates `X-Session-Id` on its own, while `X-Human-Id` is forwarded only when supplied by the client. * **`X-Session-Id`** — generated per MCP session (the `mcp-session-id` returned during the MCP `initialize` handshake). All tool calls within the same MCP session share the same value. * **`X-Human-Id`** — if your client provides an `X-Human-Id` header (or `humanId` query parameter on the MCP URL), it is forwarded through to the Tavily API, helping Tavily better understand multi-step interactions and improve response quality. For security, Tavily hashes human IDs before processing or storing them. See [Session Tracking](/documentation/api-reference/introduction#session--user-tracking) for the underlying API contract. ## Local Installation ### Prerequisites * [Tavily API key](https://app.tavily.com/home) * If you don't have a Tavily API key, you can sign up for a free account [here](https://app.tavily.com/home) * [Claude Desktop](https://claude.ai/download) or [Cursor](https://cursor.sh) * [Node.js](https://nodejs.org/) (v20 or higher) * You can verify your Node.js installation by running: ```bash theme={null} node --version ``` Only needed if using Git installation method: * On macOS: `brew install git` * On Linux: * Debian/Ubuntu: `sudo apt install git` * RedHat/CentOS: `sudo yum install git` * On Windows: Download [Git for Windows](https://git-scm.com/download/win) ```bash NPX theme={null} npx -y tavily-mcp@0.1.3 ``` ```bash Git theme={null} git clone https://github.com/tavily-ai/tavily-mcp.git cd tavily-mcp npm install npm run build ``` Although you can launch a server on its own, it's not particularly helpful in isolation. Instead, you should integrate it into an MCP client. ### Configuring MCP Clients > **Note**: Requires Cursor version 0.45.6 or higher To set up the Tavily MCP server in Cursor: 1. Open Cursor Settings 2. Navigate to Features > MCP Servers 3. Click on the "+ Add New MCP Server" button 4. Fill out the following information: * **Name**: Enter a nickname for the server (e.g., "tavily-mcp") * **Type**: Select "command" as the type * **Command**: Enter the command to run the server: ```bash theme={null} env TAVILY_API_KEY=tvly-YOUR_API_KEY npx -y tavily-mcp@0.1.3 ``` Replace `tvly-YOUR_API_KEY` with your Tavily API key from [app.tavily.com/home](https://app.tavily.com/home) Cursor Interface Example ```bash macOS theme={null} # Create the config file if it doesn't exist touch "$HOME/Library/Application Support/Claude/claude_desktop_config.json" # Opens the config file in TextEdit open -e "$HOME/Library/Application Support/Claude/claude_desktop_config.json" # Alternative method using Visual Studio Code code "$HOME/Library/Application Support/Claude/claude_desktop_config.json" ``` ```bash Windows theme={null} code %APPDATA%\Claude\claude_desktop_config.json ``` Add this configuration (replace `tvly-YOUR_API_KEY-here` with your [Tavily API key](https://tavily.com/api-keys)): ```json Configuration theme={null} { "mcpServers": { "tavily-mcp": { "command": "npx", "args": ["-y", "tavily-mcp@0.1.2"], "env": { "TAVILY_API_KEY": "tvly-YOUR_API_KEY-here" } } } } ``` ### Default Parameters For local MCP setups, you can set default parameter values using the `DEFAULT_PARAMETERS` environment variable. This allows you to configure default search behavior without specifying these parameters in every request. ```json theme={null} { "mcpServers": { "tavily-mcp": { "command": "npx", "args": ["-y", "tavily-mcp@latest"], "env": { "TAVILY_API_KEY": "your-api-key-here", "DEFAULT_PARAMETERS": "{\"include_images\": true, \"max_results\": 15, \"search_depth\": \"advanced\"}" } } } } ``` ### Session & User Attribution The local MCP server automatically attaches identifiers to every Tavily API call so requests can be attributed back to a session: * **`X-Session-Id`** — auto-generated once per MCP process and reused for every tool call. * **`X-Human-Id`** — if you set the `HUMAN_ID` environment variable, that value is forwarded through to the Tavily API on every request, helping Tavily better understand multi-step interactions and improve response quality. For security, Tavily hashes human IDs before processing or storing them. See [Session Tracking](/documentation/api-reference/introduction#session--user-tracking) for the underlying API contract. ## Usage Examples 1. **General Web Search**: ``` Can you search for recent developments in quantum computing? ``` 2. **News Search**: ``` Search for news articles about AI startups from the last 7 days. ``` 3. **Domain-Specific Search**: ``` Search for climate change research on nature.com and sciencedirect.com ``` **Extract Article Content**: `Extract the main content from this article: https://example.com/article` ``` Search for news articles about AI startups from the last 7 days and extract the main content from each article to generate a detailed report. ``` ## Troubleshooting If you encounter server connection issues, run these commands to verify your environment: ```bash theme={null} npm --version node --version ``` Make sure to also check your configuration syntax for any errors. If experiencing problems with npx, locate your executable: ```bash theme={null} which npx ``` Once you have the path, update your configuration to use the full path to the npx executable. When troubleshooting API key problems, verify that your key is: * Properly formatted with the `tvly-` prefix * Valid and active in your Tavily dashboard * Correctly configured in your environment variables You can test your API key validity by making a simple test request through the [Tavily Playground](https://app.tavily.com/playground) ## Acknowledgments For the MCP specification For Claude Desktop # Amazon Bedrock AgentCore Source: https://docs.tavily.com/documentation/partnerships/amazon Integrate Tavily MCP Server with Amazon Bedrock AgentCore for scalable AI agent deployment on AWS. ## Overview The [Tavily MCP Server](https://aws.amazon.com/marketplace/pp/prodview-twjga5bwmoszq) is available on the AWS Marketplace and can be deployed as a managed MCP server on [Amazon Bedrock AgentCore](https://aws.amazon.com/bedrock/agentcore/), enabling developers to securely run and scale AI agents with access to Tavily's real-time web search, content extraction, crawling, and site mapping capabilities. ## Prerequisites * [AWS account](https://aws.amazon.com/) * [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html) installed and [configured](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-quickstart.html) * [Tavily API Key](https://app.tavily.com/home) for authenticating the Tavily MCP Server * An IAM role with a trust policy allowing `bedrock-agentcore.amazonaws.com` to assume the role ## Setup Visit the [Tavily MCP Server listing](https://aws.amazon.com/marketplace/pp/prodview-twjga5bwmoszq) on the AWS Marketplace. Click **View purchase options**, scroll down, and select **Subscribe**. Once your request has been processed, click **Launch your software** in the pop-up that appears. Tavily MCP Server listing on the AWS Marketplace On the launch page, select **Amazon Bedrock AgentCore console** as the Launch Method. Select Amazon Bedrock AgentCore as the deployment target Create an IAM role that allows Bedrock AgentCore to assume it. When creating the role, select **Custom trust policy** and replace the default JSON with the following: ```json theme={null} { "Version": "2012-10-17", "Statement": [ { "Sid": "Statement1", "Effect": "Allow", "Principal": { "Service": "bedrock-agentcore.amazonaws.com" }, "Action": "sts:AssumeRole" } ] } ``` Make sure to run `aws configure` in your terminal and add the access keys associated with the account where you created the IAM role. From AWS CloudShell or a Linux/macOS terminal, run the following command. Replace the placeholders with your own values: * ``: A name of your choice * ``: A description of your choice * ``: The ARN of the IAM role created in the previous step * ``: Your [Tavily API key](https://app.tavily.com/home) ```bash theme={null} aws bedrock-agentcore-control create-agent-runtime \ --region us-east-1 \ --agent-runtime-name "" \ --description "" \ --agent-runtime-artifact '{ "containerConfiguration": { "containerUri": "709825985650.dkr.ecr.us-east-1.amazonaws.com/tavily/tavily-mcp:v6" } }' \ --role-arn "" \ --network-configuration '{ "networkMode": "PUBLIC" }' \ --protocol-configuration '{ "serverProtocol": "MCP" }' \ --environment-variables '{ "TAVILY_API_KEY": "" }' ``` Once the command completes, you will receive an output containing the `agentRuntimeArn`. Save this value for the next step. ```json theme={null} { "agentRuntimeArn": "...", "workloadIdentityDetails": { "workloadIdentityArn": "..." }, "agentRuntimeId": "...", "agentRuntimeVersion": "...", "createdAt": "...", "status": "..." } ``` Use the `agentRuntimeArn` from the previous step to invoke Tavily MCP tools. For example, to list all available tools: ```bash theme={null} export PAYLOAD='{ "jsonrpc": "2.0", "id": 1, "method": "tools/list", "params": { "_meta": { "progressToken": 1 }}}' aws bedrock-agentcore invoke-agent-runtime \ --agent-runtime-arn "" \ --content-type "application/json" \ --accept "application/json, text/event-stream" \ --payload "$(echo -n "$PAYLOAD" | base64)" output.json ``` You can also invoke specific tools by changing the payload. Here are some examples: **[Search](/documentation/api-reference/endpoint/search) the web:** ```json theme={null} { "jsonrpc": "2.0", "id": "1", "method": "tools/call", "params": { "name": "tavily_search", "arguments": { "query": "latest AI news", "max_results": 10 } } } ``` **[Extract](/documentation/api-reference/endpoint/extract) content from a URL:** ```json theme={null} { "jsonrpc": "2.0", "id": "1", "method": "tools/call", "params": { "name": "tavily_extract", "arguments": { "urls": ["www.tavily.com"] } } } ``` **[Crawl](/documentation/api-reference/endpoint/crawl) a website:** ```json theme={null} { "jsonrpc": "2.0", "id": "1", "method": "tools/call", "params": { "name": "tavily_crawl", "arguments": { "url": "www.tavily.com" } } } ``` **[Map](/documentation/api-reference/endpoint/map) a website's structure:** ```json theme={null} { "jsonrpc": "2.0", "id": "1", "method": "tools/call", "params": { "name": "tavily_map", "arguments": { "url": "www.tavily.com" } } } ``` ## Resources * [Amazon Bedrock AgentCore Documentation](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/agentcore-get-started-toolkit.html) * [AWS CLI Installation Guide](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html) * [Tavily MCP Documentation](/documentation/mcp) * [Tavily API Reference](/documentation/api-reference/endpoint/search) # Microsoft Azure Source: https://docs.tavily.com/documentation/partnerships/azure Integrate Tavily Remote MCP with Microsoft Azure AI Foundry and Azure MCP Center for seamless AI agent development. ## Overview Tavily Remote MCP is now available on Microsoft Azure, providing seamless integration for developers building AI agents and workflows. By being listed on Azure MCP Center and included in Azure AI Foundry's Tools Catalog, Tavily enables users to easily discover and connect to its powerful capabilities for grounding AI agents with real-time web search and RAG pipelines. * **[Azure AI Foundry](https://ai.azure.com)** — Tavily is featured in the Tools Catalog of Azure AI Foundry, making it easy for users to add Tavily to their AI agent workflows and leverage its capabilities for real-time information retrieval and grounding. * **[Azure MCP Center](https://mcp.azure.com/detail/tavily-mcp)** — Tavily Remote MCP is listed on Azure's MCP Center (part of Azure API Center), enabling developers to discover and connect to Tavily directly. ## Prerequisites * [Microsoft Azure account](https://azure.microsoft.com/) with active subscription for signing in to [Azure AI Foundry](https://ai.azure.com) * [Tavily API Key](https://app.tavily.com/home) for connecting the Tavily Remote MCP to Azure AI Foundry ## Setup ### Azure AI Foundry Go to [Azure AI Foundry](https://ai.azure.com/) and sign in with your Microsoft Azure account. On the top bar, toggle on the **New Foundry** to switch from Microsoft Foundry (classic) to Microsoft Foundry (New). Toggle on New Foundry experience in Azure AI Foundry A pop-up will appear to select an existing project or create a new one. Select the project you want to work on or create a new project to get started. Select or create a new project in Azure AI Foundry Fill in the required project details such as Foundry resource, subscription, region, and resource group to set up your project environment to create a new project in Microsoft Foundry(new). Enter project details in Azure AI Foundry Once your project is set up, click on the **Start Building** button to create a new agent within your project. Create a new agent in Azure AI Foundry In the playground interface, navigate to the **Tools** section and search for **Tavily MCP** in the catalog. Enter your Tavily API Key to authenticate and connect your agent to the Tavily Remote MCP. Once connected, Tavily MCP will be available as a tool in your agent's workflow for real-time web search and RAG capabilities. Add Tavily MCP to agent workflow in Azure AI Foundry With Tavily MCP added to your agent's tools, you can now use it within your agent's workflow to enhance its capabilities with real-time information retrieval and grounding for more effective AI agent performance. Use Tavily MCP in agent workflow in Azure AI Foundry ### Azure MCP Center Go to the [Azure MCP Center](https://mcp.azure.com/) and search for **Tavily MCP** to find the listing. Click the **Install** button on the Azure MCP Center listing for Tavily MCP to add it to your VS Code. Search for Tavily in Azure MCP Center VS Code will prompt you to authenticate with your Tavily account to connect to the Remote MCP. Follow the authentication flow to grant access. Authentication prompt for Tavily MCP in VS Code Use Tavily MCP within VS Code's Copilot to enhance your AI agent development with real-time web search and RAG capabilities. ## Resources * [Build a workflow in Microsoft Foundry](https://learn.microsoft.com/en-us/azure/ai-foundry/agents/concepts/workflow) * [Use MCP servers in VS Code](https://code.visualstudio.com/docs/copilot/customization/mcp-servers) * [Tavily MCP Documentation](/documentation/mcp) # Databricks Source: https://docs.tavily.com/documentation/partnerships/databricks Integrate Tavily MCP Server with Databricks for real-time web search and RAG capabilities. ## Overview Tavily MCP Server is available on [Databricks Marketplace](https://marketplace.databricks.com/details/3709f418-1ed3-42a8-a753-38d06ce281c7/Tavily_Tavily-MCP-Server), enabling one-click installation that creates a secure Unity Catalog connection for authenticated access. Once installed, Tavily MCP can be used programmatically in your agent code (LangGraph, OpenAI, etc.) through Databricks-managed proxy endpoints, grounding your AI agents with real-time web search, extraction, crawling, and mapping. ## Prerequisites * [Databricks workspace](https://www.databricks.com/) with the **Managed MCP Servers** preview enabled. See [Manage Databricks previews](https://docs.databricks.com/aws/en/admin/workspace-settings/manage-previews). * `CREATE CONNECTION` privilege on the Unity Catalog metastore * [Tavily API Key](https://app.tavily.com/home) for authenticating the Tavily MCP connection (via bearer token) ## Setup ### Install from Databricks Marketplace In your Databricks workspace, go to **Marketplace** and search for **Tavily MCP Server**. Search for Tavily MCP Server in Databricks Marketplace Click **Install** to install the Tavily MCP Server. In the installation dialog, configure the connection settings: * **Connection name**: Enter a name for the Unity Catalog connection (for example, `tavily_mcp_connection`). * **Host**: Pre-populated for Tavily. * **Base path**: Pre-populated for Tavily. * **Bearer token**: Enter your Tavily API Key as the bearer token. Configure the connection for Tavily MCP Server Navigate to **Unity Catalog** > **Connect** > **Connections** and verify that the connection has been created successfully. Verify the connection from Unity Catalog ### Share the MCP server connection Navigate to **Unity Catalog** > **Connect** > **Connections** and click on the connection you created earlier (for example, `tavily_mcp_connection`). Open the Unity Catalog Connections Grant `USE CONNECTION` privileges to identity principals that need to use the Tavily MCP server connection. In your workspace, go to **Permissions** tab and grant **`USE CONNECTION`** to the identity principals that need to use the Tavily MCP server connection. Grant USE CONNECTION privileges to identity principals ### Test Tavily MCP Server within Databricks You can test the Tavily MCP server directly within Databricks without writing any code. **Using AI Playground:** Go to **AI Playground** in your Databricks workspace and choose a model with the **Tools enabled** label. Select a model in AI Playground Click **Tools** tab and select **+ Add tool** and select **MCP Servers** from the available tool options. In the MCP Servers section, select **External MCP servers** to browse available connections, and choose the Unity Catalog connection you installed earlier (for example, `tavily_mcp_connection`). Add Tavily MCP Server as a tool Chat with the LLM to test how it interacts with Tavily MCP tools. Test Tavily MCP Server results ### Add Tavily MCP Server to Databricks Assistant Go to **Databricks Assistant** in your Databricks workspace and click on the **Settings** icon. In **MCP Servers** section, select **+ Add MCP Server**. Go to **External MCP servers** dropdown and choose the Unity Catalog connection you installed earlier (for example, `tavily_mcp_connection`). Add MCP Server from Settings ### Use Tavily MCP in Your Agent Code After installation, use Tavily MCP programmatically in your agent code by connecting to the proxy URL. The Databricks proxy makes external servers behave like managed MCP servers, handling authentication and token management. Add the Tavily MCP proxy endpoint to your `MANAGED_MCP_SERVER_URLS` list. External MCP servers are proxied as managed servers, allowing you to use the same API for both: ```python theme={null} from databricks.sdk import WorkspaceClient from databricks_mcp import DatabricksMCPClient # Initialize workspace client workspace_client = WorkspaceClient() host = workspace_client.config.host # External MCP servers are proxied as managed servers, allowing you # to use the same API for both managed and external servers MANAGED_MCP_SERVER_URLS = [ f"{host}/api/2.0/mcp/functions/system/ai", # Default managed MCP f"{host}/api/2.0/mcp/external/tavily_mcp_connection" # Tavily MCP proxy ] ``` Pass the proxy URL to the `managed_server_urls` parameter to create tools from both managed and external (proxied) servers: ```python theme={null} # Use with agents — external servers work just like managed ones import asyncio from your_agent_code import create_mcp_tools # Your agent's tool creation function # Create tools from both managed and external (proxied) servers mcp_tools = asyncio.run( create_mcp_tools( ws=workspace_client, managed_server_urls=MANAGED_MCP_SERVER_URLS ) ) ``` You can also call Tavily tools directly using the Databricks MCP Client: ```python theme={null} # Direct tool call using DatabricksMCPClient mcp_client = DatabricksMCPClient( server_url=f"{host}/api/2.0/mcp/external/tavily_mcp_connection", workspace_client=workspace_client ) # List available tools tools = mcp_client.list_tools() print(f"Available tools: {[tool.name for tool in tools]}") # Call a tool response = mcp_client.call_tool( "tavily_search", {"query": "latest AI research breakthroughs"} ) print(response.content[0].text) ``` ## Resources * [Tavily MCP Server on Databricks Marketplace](https://marketplace.databricks.com/details/3709f418-1ed3-42a8-a753-38d06ce281c7/Tavily_Tavily-MCP-Server) * [Tavily MCP Documentation](/documentation/mcp) # IBM watsonx Orchestrate Source: https://docs.tavily.com/documentation/partnerships/ibm Integrate Tavily's AI-powered research capabilities with IBM watsonx Orchestrate ## Overview Tavily offers two services on IBM watsonx Orchestrate: * **Tavily Research Agent** — An AI-powered research agent that conducts comprehensive web research using coordinated parallel sub-agents to deliver detailed, citation-backed reports on complex topics. * **Tavily Search API** — Real-time web search optimized for AI agents and LLMs. Both services are available through the IBM Cloud catalog and can be procured using IBM credits. ## Setup Guide ### Step 1: Create a Tavily Instance on IBM Cloud 1. Navigate to [IBM Cloud](https://cloud.ibm.com/) 2. In the search bar, type "Tavily" to find the available services Search for Tavily in IBM Cloud 3. Select either **Tavily Search API** or **Tavily Research Agent** depending on your needs 4. Click **Create** to provision a new instance Create Tavily instance ### Step 2: Copy Your Bearer Token Once your instance is created, copy the bearer token from the credentials section. You'll need this to connect the agent in watsonx Orchestrate. Copy bearer token ### Step 3: Add Tavily to watsonx Orchestrate 1. Navigate to [watsonx Orchestrate](https://dl.watson-orchestrate.ibm.com/chat) 2. Create a new agent Create agent in watsonx Orchestrate 3. Name your agent Name your agent 4. Add a collaborator agent Add collaborator agent 5. Select **Tavily Research Agent** from the partner agents list Select Tavily agent 6. Review the agent details and click **Add as collaborator** Add Tavily as collaborator 7. Enter your bearer token (from Step 2) in the **Bearer token** field and click **Register and add** Register agent with bearer token 8. The Tavily Research Agent will now appear in your agent's **Toolset** under the Agents section Tavily agent loaded in toolset ### Step 4: Try It Out Ask a question in the chat that requires real-time web research, and watsonx Orchestrate will automatically hand off to the Tavily Research Agent. Tavily Research Agent handoff example Your Tavily Research Agent is now ready to use within watsonx Orchestrate. ## Resources * [IBM watsonx Orchestrate Documentation](https://www.ibm.com/docs/en/watsonx/watson-orchestrate/base?topic=agents-adding-orchestration#adding-a-collaborator-agent) * [Partner Agents Catalog](https://www.ibm.com/docs/en/watsonx/watson-orchestrate/base?topic=catalog-partner-agents) # Snowflake Source: https://docs.tavily.com/documentation/partnerships/snowflake Tavily is now available as a native app on the [Snowflake Marketplace](https://app.snowflake.com/marketplace/listing/GZTSZ2XM0ON/tavily-tavily-search-api?search=tavily). ## Introduction The Tavily Snowflake Native App brings powerful web search capabilities directly into your Snowflake environment, allowing you to download and install it natively within your Snowflake account in an easy and secure way. ## Tutorial The following video walks you through the above-mentioned steps for installing, configuring, and using the Tavily Snowflake Native App.