What You’ll Learn
- Running a basic web search and reading results
- Filtering by recency and news sources
- Constraining searches to specific domains
- Aggregating results across multiple queries with async
How Does It Work?
Tavily Search returns relevant web results for a natural-language query, optimized for LLM consumption. Each result includes a title, URL, relevance score, and a content snippet. You can tune the depth/speed tradeoff, filter by topic or time range, and restrict results to specific domains.Getting Started
Get your Tavily API key
Domain-Constrained Search
Restrict results to trusted sources withinclude_domains, or remove noise with exclude_domains.
Multi-Query Aggregation
For complex search operations, run multiple focused queries concurrently withAsyncTavilyClient and merge the results.
Critical Knobs
search_depth
search_depth
- Default:
"basic" "advanced"— highest relevance, reranked chunks (2 credits)"fast"— lower latency, chunk format (1 credit)"ultra-fast"— near-instant, summary format (0.5 credits)
time_range / start_date / end_date
time_range / start_date / end_date
time_range— relative filter:"day","week","month","year"start_date/end_date— absolute date range inYYYY-MM-DDformat- Use one or the other, not both
include_domains / exclude_domains
include_domains / exclude_domains
- Restrict results to specific domains or filter them out
- Keep lists short for best results
max_results
max_results
- Range: 1–20, default: 5
- Higher values may return lower-quality results
Production Notes
- Credits:
"basic","fast", and"ultra-fast"cost 1 credit per query."advanced"costs 2 credits per query.
- Rate limits: See Rate Limits for current thresholds.
- Quality filtering: Use
scorefrom the response to filter low-relevance results (e.g., discard results below 0.5). - Async for throughput: Use
AsyncTavilyClientwithasyncio.gatherwhen making multiple concurrent requests.
Next Steps
Search API Reference
Full parameter list, response schema, and interactive playground.
Search Best Practices
Query optimization, depth selection, filtering, and post-processing tips.
Python SDK Reference
Python client methods, async support, and type details.
JavaScript SDK Reference
JavaScript/TypeScript client methods and usage.