Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Production-ready Tavily API integration patterns for search, extract, crawl, map, and research in Python and JavaScript.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
SKILL.md
1---2name: tavily-best-practices3description: "Build production-ready Tavily integrations with best practices baked in. Reference documentation for developers using coding assistants (Claude Code, Cursor, etc.) to implement web search, content extraction, crawling, and research in agentic workflows, RAG systems, or autonomous agents."4---56# Tavily78Tavily is a search API designed for LLMs, enabling AI applications to access real-time web data.910## Installation1112**Python:**13```bash14pip install tavily-python15```1617**JavaScript:**18```bash19npm install @tavily/core20```2122See **[references/sdk.md](references/sdk.md)** for complete SDK reference.2324## Client Initialization2526```python27from tavily import TavilyClient2829# Uses TAVILY_API_KEY env var (recommended)30client = TavilyClient()3132#With project tracking (for usage organization)33client = TavilyClient(project_id="your-project-id")3435# Async client for parallel queries36from tavily import AsyncTavilyClient37async_client = AsyncTavilyClient()38```3940## Choosing the Right Method4142**For custom agents/workflows:**4344| Need | Method |45|------|--------|46| Web search results | `search()` |47| Content from specific URLs | `extract()` |48| Content from entire site | `crawl()` |49| URL discovery from site | `map()` |5051**For out-of-the-box research:**5253| Need | Method |54|------|--------|55| End-to-end research with AI synthesis | `research()` |5657## Quick Reference5859### search() - Web Search6061```python62response = client.search(63query="quantum computing breakthroughs", # Keep under 400 chars64max_results=10,65search_depth="advanced"66)67print(response)68```69Key parameters: `query`, `max_results`, `search_depth` (ultra-fast/fast/basic/advanced), `include_domains`, `exclude_domains`, `time_range`7071See **[references/search.md](references/search.md)** for complete search reference.7273### extract() - URL Content Extraction7475```python76# Simple one-step extraction77response = client.extract(78urls=["https://docs.example.com"],79extract_depth="advanced"80)81print(response)82```83Key parameters: `urls` (max 20), `extract_depth`, `query`, `chunks_per_source` (1-5)8485See **[references/extract.md](references/extract.md)** for complete extract reference.8687### crawl() - Site-Wide Extraction8889```python90response = client.crawl(91url="https://docs.example.com",92instructions="Find API documentation pages", # Semantic focus93extract_depth="advanced"94)95print(response)96```97Key parameters: `url`, `max_depth`, `max_breadth`, `limit`, `instructions`, `chunks_per_source`, `select_paths`, `exclude_paths`9899See **[references/crawl.md](references/crawl.md)** for complete crawl reference.100101### map() - URL Discovery102103```python104response = client.map(105url="https://docs.example.com"106)107print(response)108```109110### research() - AI-Powered Research111112```python113import time114115# For comprehensive multi-topic research116result = client.research(117input="Analyze competitive landscape for X in SMB market",118model="pro" # or "mini" for focused queries, "auto" when unsure119)120request_id = result["request_id"]121122# Poll until completed123response = client.get_research(request_id)124while response["status"] not in ["completed", "failed"]:125time.sleep(10)126response = client.get_research(request_id)127128print(response["content"]) # The research report129```130131Key parameters: `input`, `model` ("mini"/"pro"/"auto"), `stream`, `output_schema`, `citation_format`132133See **[references/research.md](references/research.md)** for complete research reference.134135## Detailed Guides136137For complete parameters, response fields, patterns, and examples:138139- **[references/sdk.md](references/sdk.md)** - Python & JavaScript SDK reference, async patterns, Hybrid RAG140- **[references/search.md](references/search.md)** - Query optimization, search depth selection, domain filtering, async patterns, post-filtering141- **[references/extract.md](references/extract.md)** - One-step vs two-step extraction, query/chunks for targeting, advanced mode142- **[references/crawl.md](references/crawl.md)** - Crawl vs Map, instructions for semantic focus, use cases, Map-then-Extract pattern143- **[references/research.md](references/research.md)** - Prompting best practices, model selection, streaming, structured output schemas144- **[references/integrations.md](references/integrations.md)** - LangChain, LlamaIndex, CrewAI, Vercel AI SDK, and framework integrations145