Tavily Search 🔎
AI-powered web search platform with 5 modes: Search, Extract, Crawl, Map, and Research.
Requirements
- -
TAVILY_API_KEY environment variable
Configuration
| Env Variable | Default | Description |
|---|
| INLINECODE1 | — | Required. Tavily API key |
Set in OpenClaw config:
CODEBLOCK0
Script Location
CODEBLOCK1
Commands
search — Web Search (Default)
General-purpose web search with optional LLM-synthesized answer.
CODEBLOCK2
Examples:
CODEBLOCK3
Output format (text):
Answer: <LLM-synthesized answer if --answer>
Results:
1. Result Title
https://example.com/article
Content snippet from the page...
2. Another Result
https://example.com/other
Another snippet...
news — News Search
Search optimized for news articles. Sets topic=news.
CODEBLOCK5
Examples:
python3 lib/tavily_search.py news "AI regulation"
python3 lib/tavily_search.py news "Israel tech" --time day --answer
python3 lib/tavily_search.py news "stock market" --time week -n 10
finance — Finance Search
Search optimized for financial data and news. Sets topic=finance.
CODEBLOCK7
Examples:
python3 lib/tavily_search.py finance "NVIDIA stock analysis"
python3 lib/tavily_search.py finance "cryptocurrency market trends" --time month
python3 lib/tavily_search.py finance "S&P 500 forecast 2026" --answer
extract — Extract Content from URLs
Extract readable content from one or more URLs.
CODEBLOCK9
Parameters:
- -
urls: One or more URLs to extract (positional args) - INLINECODE5 : Extraction depth
- INLINECODE6 : Output format (default: markdown)
- INLINECODE7 : Rerank extracted chunks by relevance to query
Examples:
CODEBLOCK10
Output format:
URL: https://example.com/article
─────────────────────────────────
<Extracted content in markdown/text>
URL: https://another.com/page
─────────────────────────────────
<Extracted content>
crawl — Crawl a Website
Crawl a website starting from a root URL, following links.
CODEBLOCK12
Parameters:
- -
url: Root URL to start crawling - INLINECODE9 : Crawl depth
- INLINECODE10 : Maximum link depth to follow (default: 2)
- INLINECODE11 : Maximum pages per depth level (default: 10)
- INLINECODE12 : Maximum total pages (default: 10)
- INLINECODE13 : Natural language crawl instructions
- INLINECODE14 : Only crawl these path patterns
- INLINECODE15 : Skip these path patterns
- INLINECODE16 : Output format
Examples:
CODEBLOCK13
Output format:
Crawled 5 pages from https://docs.example.com
Page 1: https://docs.example.com/intro
─────────────────────────────────
<Content>
Page 2: https://docs.example.com/guide
─────────────────────────────────
<Content>
map — Sitemap Discovery
Discover all URLs on a website (sitemap).
CODEBLOCK15
Parameters:
- -
url: Root URL to map - INLINECODE18 : Depth to follow (default: 2)
- INLINECODE19 : Breadth per level (default: 20)
- INLINECODE20 : Maximum URLs (default: 50)
Examples:
CODEBLOCK16
Output format:
Sitemap for https://example.com (42 URLs found):
1. https://example.com/
2. https://example.com/about
3. https://example.com/blog
...
research — Deep Research
Comprehensive AI-powered research on a topic with citations.
CODEBLOCK18
Parameters:
- -
query: Research question - INLINECODE22 : Research model (default: auto)
-
mini: Faster, cheaper
-
pro: More thorough
-
auto: Let Tavily decide
- -
--json: JSON output (supports structured output schema)
Examples:
CODEBLOCK19
Output format:
Research: Impact of AI on healthcare in 2026
<Comprehensive research report with citations>
Sources:
[1] https://source1.com
[2] https://source2.com
...
Options Reference
| Option | Applies To | Description | Default |
|---|
| INLINECODE27 | search, news, finance, extract | Search/extraction depth | basic |
| INLINECODE28 |
search, news, finance | Time range filter | none |
|
-n NUM | search, news, finance | Max results (0-20) | 5 |
|
--answer | search, news, finance | Include LLM answer | off |
|
--raw | search, news, finance | Include raw page content | off |
|
--images | search, news, finance | Include image URLs | off |
|
--include-domains d1,d2 | search, news, finance | Only these domains | none |
|
--exclude-domains d1,d2 | search, news, finance | Exclude these domains | none |
|
--country XX | search, news, finance | Boost country results | none |
|
--json | all | Structured JSON output | off |
|
--format markdown\|text | extract, crawl | Content format | markdown |
|
--query "text" | extract | Relevance reranking query | none |
|
--model mini\|pro\|auto | research | Research model | auto |
|
--max-depth N | crawl, map | Max link depth | 2 |
|
--max-breadth N | crawl, map | Max pages per level | 10/20 |
|
--limit N | crawl, map | Max total pages/URLs | 10/50 |
|
--instructions "text" | crawl | Natural language instructions | none |
|
--select-paths p1,p2 | crawl | Include path patterns | none |
|
--exclude-paths p1,p2 | crawl | Exclude path patterns | none |
Error Handling
- - Missing API key: Clear error message with setup instructions.
- 401 Unauthorized: Invalid API key.
- 429 Rate Limit: Rate limit exceeded, try again later.
- Network errors: Descriptive error with cause.
- No results: Clean "No results found." message.
- Timeout: 30-second timeout on all HTTP requests.
Credits & Pricing
| API | Basic | Advanced |
|---|
| Search | 1 credit | 2 credits |
| Extract |
1 credit/URL | 2 credits/URL |
| Crawl | 1 credit/page | 2 credits/page |
| Map | 1 credit | 1 credit |
| Research | Varies by model | - |
Install
CODEBLOCK21
Tavily 搜索 🔎
AI驱动的网络搜索平台,提供5种模式:搜索、提取、爬取、站点地图和研究。
环境要求
配置
| 环境变量 | 默认值 | 描述 |
|---|
| TAVILYAPIKEY | — | 必需。 Tavily API密钥 |
在OpenClaw配置中设置:
json
{
env: {
TAVILYAPIKEY: tvly-...
}
}
脚本位置
bash
python3 skills/tavily/lib/tavily_search.py <命令> 查询内容 [选项]
命令
search — 网络搜索(默认)
通用网络搜索,可选择LLM生成的答案。
bash
python3 lib/tavily_search.py search 查询内容 [选项]
示例:
bash
基础搜索
python3 lib/tavily_search.py search 最新AI新闻
带LLM答案
python3 lib/tavily_search.py search 什么是量子计算 --answer
高级深度(更好的结果,消耗2积分)
python3 lib/tavily_search.py search 气候变化解决方案 --depth advanced
时间筛选
python3 lib/tavily_search.py search OpenAI公告 --time week
域名筛选
python3 lib/tavily_search.py search 机器学习 --include-domains arxiv.org,nature.com
国家/地区加权
python3 lib/tavily_search.py search 科技初创公司 --country US
包含原始内容和图片
python3 lib/tavily_search.py search 太阳能 --raw --images -n 10
JSON输出
python3 lib/tavily_search.py search 比特币价格 --json
输出格式(文本):
答案:<如果使用--answer,则显示LLM生成的答案>
结果:
1. 结果标题
https://example.com/article
页面内容摘要...
2. 另一个结果
https://example.com/other
另一个摘要...
news — 新闻搜索
针对新闻文章优化的搜索。设置topic=news。
bash
python3 lib/tavily_search.py news 查询内容 [选项]
示例:
bash
python3 lib/tavily_search.py news AI监管
python3 lib/tavily_search.py news 以色列科技 --time day --answer
python3 lib/tavily_search.py news 股市 --time week -n 10
finance — 财经搜索
针对财经数据和新闻优化的搜索。设置topic=finance。
bash
python3 lib/tavily_search.py finance 查询内容 [选项]
示例:
bash
python3 lib/tavily_search.py finance 英伟达股票分析
python3 lib/tavily_search.py finance 加密货币市场趋势 --time month
python3 lib/tavily_search.py finance 标普500 2026年预测 --answer
extract — 从URL提取内容
从一个或多个URL提取可读内容。
bash
python3 lib/tavily_search.py extract URL [URL...] [选项]
参数:
- - urls:一个或多个要提取的URL(位置参数)
- --depth basic|advanced:提取深度
- --format markdown|text:输出格式(默认:markdown)
- --query 文本:根据查询相关性对提取的片段重新排序
示例:
bash
提取单个URL
python3 lib/tavily_search.py extract https://example.com/article
提取多个URL
python3 lib/tavily_search.py extract https://url1.com https://url2.com
带相关性重排序的高级提取
python3 lib/tavily_search.py extract https://arxiv.org/paper --depth advanced --query transformer架构
文本格式输出
python3 lib/tavily_search.py extract https://example.com --format text
输出格式:
URL: https://example.com/article
─────────────────────────────────
<以markdown/text格式提取的内容>
URL: https://another.com/page
─────────────────────────────────
<提取的内容>
crawl — 爬取网站
从根URL开始爬取网站,跟随链接。
bash
python3 lib/tavily_search.py crawl URL [选项]
参数:
- - url:开始爬取的根URL
- --depth basic|advanced:爬取深度
- --max-depth N:要跟随的最大链接深度(默认:2)
- --max-breadth N:每层最大页面数(默认:10)
- --limit N:最大总页面数(默认:10)
- --instructions 文本:自然语言爬取指令
- --select-paths p1,p2:仅爬取这些路径模式
- --exclude-paths p1,p2:跳过这些路径模式
- --format markdown|text:输出格式
示例:
bash
基础爬取
python3 lib/tavily_search.py crawl https://docs.example.com
带指令的定向爬取
python3 lib/tavily_search.py crawl https://docs.python.org --instructions 查找所有asyncio文档 --limit 20
仅爬取特定路径
python3 lib/tavily_search.py crawl https://example.com --select-paths /blog,/docs --max-depth 3
输出格式:
从 https://docs.example.com 爬取了5个页面
页面 1: https://docs.example.com/intro
─────────────────────────────────
<内容>
页面 2: https://docs.example.com/guide
─────────────────────────────────
<内容>
map — 站点地图发现
发现网站上的所有URL(站点地图)。
bash
python3 lib/tavily_search.py map URL [选项]
参数:
- - url:要映射的根URL
- --max-depth N:跟随深度(默认:2)
- --max-breadth N:每层宽度(默认:20)
- --limit N:最大URL数(默认:50)
示例:
bash
映射一个网站
python3 lib/tavily_search.py map https://example.com
深度映射
python3 lib/tavily_search.py map https://docs.python.org --max-depth 3 --limit 100
输出格式:
https://example.com 的站点地图(找到42个URL):
1. https://example.com/
2. https://example.com/about
3. https://example.com/blog
...
research — 深度研究
基于AI的综合性主题研究,带引用来源。
bash
python3 lib/tavily_search.py research 查询内容 [选项]
参数:
- - query:研究问题
- --model mini|pro|auto:研究模型(默认:auto)
- mini:更快,更便宜
- pro:更全面
- auto:让Tavily决定
- - --json:JSON输出(支持结构化输出模式)
示例:
bash
基础研究
python3 lib/tavily_search.py research 2026年AI对医疗保健的影响
使用Pro模型进行全面研究
python3 lib/tavily_search.py research 量子计算方法比较 --model pro
JSON输出
python3 lib/tavily_search.py research 电动汽车市场分析 --json
输出格式:
研究:2026年AI对医疗保健的影响
<带引用来源的综合性研究报告>
来源:
[1] https://source1.com
[2] https://source2.com
...
选项参考
| 选项 | 适用命令 | 描述 | 默认值 |
|---|
| --depth basic\ | advanced | search, news, finance, extract | 搜索/提取深度 | basic |
| --time day\ |
week\|month\|year | search, news, finance | 时间范围筛选 | 无 |
| -n NUM | search, news, finance | 最大结果数(0-20) | 5 |
| --answer | search, news, finance | 包含LLM答案 | 关闭 |
| --raw | search, news, finance | 包含原始页面内容 | 关闭 |
| --images | search, news, finance | 包含图片URL | 关闭 |
| --include-domains d1,d2 | search, news, finance | 仅限这些域名 | 无 |
| --exclude-domains d1,d2 | search, news, finance | 排除这些域名 | 无 |
| --country XX | search, news, finance | 加权国家/地区结果 | 无 |
| --json | 所有 | 结构化JSON输出 |