Index of every page on this site: llms.txt
All skills
tavily-ai avatar

/tavily-sdk

@90de383 official
by Tavily AItavily-ai/skills497 stars
45
Run it yourself

Build production-ready Tavily integrations with best practices baked in. Reference documentation for developers using coding assistants to implement web search, content extraction, crawling, and research in agentic workflows, RAG systems, or autonomous agents.

Use this Skill: https://skilld.dev/gh/tavily-ai/skills/tavily-sdk

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencessearch.md

≈1.7k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Search API Reference

Table of Contents


Query Optimization

Keep queries under 400 characters. Think search query, not long-form prompt.

Break complex queries into sub-queries:

# Instead of one massive query, break it down:
queries = [
    "Competitors of company ABC",
    "Financial performance of company ABC",
    "Recent developments of company ABC"
]
responses = await asyncio.gather(*(client.search(q) for q in queries))

Search Depth

Controls the latency vs. relevance tradeoff:

Depth Latency Relevance Content Type
ultra-fast Lowest Lower Content (NLP summary)
fast Low Good Chunks
basic Medium High Content (NLP summary)
advanced Higher Highest Chunks

Content types:

  • Content: NLP-based summary of the page, providing general context
  • Chunks: Short snippets (max 500 chars) reranked by relevance to your query

When to use each:

  • ultra-fast: Latency-critical (real-time chat, autocomplete)
  • fast: Need chunks but latency matters
  • basic: General-purpose, balanced relevance and latency
  • advanced: Specific information queries, precision matters - default (Still fast and suitable for almost all use cases)

Key Parameters

Parameter Type Default Description
query string Required Search query (keep under 400 chars)
search_depth enum "basic" "ultra-fast", "fast", "basic", "advanced"
topic enum "general" "general", "news", "finance"
chunks_per_source integer 3 Chunks per source (advanced/fast depth only)
max_results integer 10 Maximum results (0-20)
time_range enum null "day", "week", "month", "year"
start_date string null Results after date (YYYY-MM-DD)
end_date string null Results before date (YYYY-MM-DD)
include_domains array [] Domains to include (max 300, supports wildcards like *.com)
exclude_domains array [] Domains to exclude (max 150)
country enum null Boost results from country
include_answer bool/enum false true/"basic" or "advanced" for LLM answer
include_raw_content bool/enum false true/"markdown" or "text" for full page
include_images boolean false Include image results
include_image_descriptions boolean false AI descriptions for images
include_favicon boolean false Favicon URL per result
auto_parameters boolean false Auto-configure based on query intent
include_usage boolean false Include credit usage info

Notes:

  • include_answer: Only use if you don't want to bring your own LLM. Most users bring their own model.

  • auto_parameters: May set search_depth="advanced" (2 credits). Set search_depth manually to control cost.

Basic Usage

from tavily import TavilyClient

client = TavilyClient()

response = client.search(
    query="latest developments in quantum computing",
    max_results=10,
    search_depth="advanced",
    chunks_per_source=5
)

for result in response["results"]:
    print(f"{result['title']}: {result['url']}")
    print(f"Score: {result['score']}")

Filtering Results

By domain

# Only search trusted sources
response = client.search(
    query="machine learning best practices",
    include_domains=["arxiv.org", "github.com", "pytorch.org"],
)

# Exclude specific domains
response = client.search(
    query="openai product reviews",
    exclude_domains=["reddit.com", "quora.com"]
)

# Restrict to LinkedIn profiles
response = client.search(
    query="CEO background at Google",
    include_domains=["linkedin.com/in"]
)

By date

# Relative time range
response = client.search(query="latest ML trends", time_range="month")

# Specific date range
response = client.search(
    query="AI news",
    start_date="2025-01-01",
    end_date="2025-02-01"
)

By country

# Boost results from specific country
response = client.search(query="tech startup funding", country="united states")

Async Patterns

Leveraging the async client enables scaled search with higher breadth and reach by running multiple queries in parallel. This is the best practice for agentic systems where you need to gather comprehensive information quickly before passing it to a model for analysis.

import asyncio
from tavily import AsyncTavilyClient

# Initialize Tavily client
tavily_client = AsyncTavilyClient("tvly-YOUR_API_KEY")

async def fetch_and_gather():
    queries = ["latest AI trends", "future of quantum computing"]

    # Perform search and continue even if one query fails (using return_exceptions=True)
    try:
        responses = await asyncio.gather(*(tavily_client.search(q) for q in queries), return_exceptions=True)

        # Handle responses and print
        for response in responses:
            if isinstance(response, Exception):
                print(f"Search query failed: {response}")
            else:
                print(response)

    except Exception as e:
        print(f"Error during search queries: {e}")

# Run the function
asyncio.run(fetch_and_gather())

Response Fields

Top-level response:

Field Description
query The original search query
answer AI-generated answer (if include_answer enabled)
results Array of search result objects
images Array of image results (if include_images=True)

Each result object:

Field Description
title Page title
url Source URL
content Extracted text snippet(s)
score Semantic relevance score (0-1)
raw_content Full page content (if include_raw_content enabled)
favicon Favicon URL (if include_favicon=True)

Top-level response also includes:

Field Description
request_id Unique identifier for support reference
response_time Response time in seconds

Each image object (if include_images=True):

Field Description
url Image URL
description AI-generated description (if include_image_descriptions=True)

For more details, please read the full API reference

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

1 warning20d3 checks · Risk SAFE
  • Gen Agent Trust Hub20d

    The skill provides comprehensive documentation and implementation guides for the Tavily SDK, enabling web search, content extraction, and AI-powered research. It includes examples for Python and JavaScript, as well as integrations with popular frameworks like LangChain, Pydantic AI, and Vercel AI SDK. No security issues were detected.

  • Socket20d

    No alerts

  • Snyk20d

    Risk: MEDIUM · 1 issue

Signed by skilld at 90de383. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 3 days ago.

Activeupdated 3 weeks ago
  • tavily
  • search-api
  • web-search
  • rag
  • agents
  • content-extraction
  • crawling
  • research
  • llm

README badge

README badge for tavily-ai/skills/tavily-sdk

Provides production-grade reference documentation for integrating Tavily's search API into AI agents and RAG systems, covering web search, content extraction, site crawling, and AI-powered research workflows. Includes SDK initialization patterns, method selection guidance, and detailed parameter reference for Python and JavaScript clients.

Generated from the current SKILL.md.

Does Tavily work with both Python and JavaScript?
Yes. Install tavily-python for Python or @tavily/core for JavaScript/Node.js. Both SDKs support the same core methods: search, extract, crawl, map, and research.
What's the difference between search(), extract(), crawl(), and research()?
search() returns web search results; extract() pulls content from specific URLs; crawl() extracts content across an entire site with semantic filtering; research() performs end-to-end multi-topic research with AI synthesis.
Can I use Tavily for RAG systems?
Yes. The skill references SDK patterns for Hybrid RAG, and extract()/crawl() are designed to fetch and chunk content for retrieval workflows.
Does this skill cover async/parallel queries?
Yes. The AsyncTavilyClient is documented for parallel queries, and detailed async patterns are covered in the references/sdk.md guide.
What integrations are supported?
The skill includes integrations for LangChain, LlamaIndex, CrewAI, and Vercel AI SDK, documented in references/integrations.md.

Generated from the current SKILL.md. These answers refresh after source changes.