Tavily Search Tool
Tavily provides AI-optimized web search, content extraction, and website crawling capabilities for your agents.Installation
Environment Variables
Quick Start
Using Tavily Directly
You can also use the Tavily SDK directly with AI SDK’sgenerateText:
Tool Options
tavilySearch
| Option | Type | Default | Description |
|---|---|---|---|
apiKey | string | env var | Tavily API key |
searchDepth | ’basic’ | ‘advanced' | 'basic’ | Search depth level |
topic | ’general’ | ‘news’ | ‘finance' | 'general’ | Search topic category |
maxResults | number | 5 | Maximum number of results |
includeAnswer | boolean | false | Include AI-generated answer |
includeImages | boolean | false | Include image results |
timeRange | ’day’ | ‘week’ | ‘month’ | ‘year’ | - | Filter by time range |
includeDomains | string[] | - | Only search these domains |
excludeDomains | string[] | - | Exclude these domains |
tavilyExtract
Extract content from specific URLs:| Option | Type | Default | Description |
|---|---|---|---|
apiKey | string | env var | Tavily API key |
extractDepth | ’basic’ | ‘advanced' | 'basic’ | Extraction depth |
tavilyCrawl
Crawl websites starting from a base URL:| Option | Type | Default | Description |
|---|---|---|---|
apiKey | string | env var | Tavily API key |
maxDepth | number | 2 | Maximum crawl depth |
extractDepth | ’basic’ | ‘advanced' | 'basic’ | Content extraction depth |
instructions | string | - | Instructions for the crawler |
allowExternal | boolean | false | Allow crawling external links |
tavilyMap
Map website structure:Examples
Research Agent
News Agent
Content Extraction Agent
Response Format
Search Response
Extract Response
Crawl Response
Best Practices
- Use appropriate search depth: Use
basicfor quick searches,advancedfor comprehensive research - Filter by domain: Use
includeDomainsto focus on authoritative sources - Time-sensitive queries: Use
timeRangefor news or recent information - Rate limiting: Tavily has rate limits; implement appropriate delays for batch operations
- Error handling: Always handle potential API errors gracefully
Pricing
Tavily offers:- Free tier: 1,000 searches/month
- Paid plans: Higher limits and advanced features
Related
- Tavily CLI Usage - Command-line interface for Tavily
- Tools Registry - Overview of all available tools
- Exa Search - Alternative semantic search tool

