Tavily Search Skill
Use Tavily API for real-time web search and content extraction.
When to Use
✅ USE this skill when:
- - "Search the web for [topic]"
- "Find recent information about [subject]"
- "Get current news about [topic]"
- "Research [topic] online"
- "Find up-to-date information"
When NOT to Use
❌ DON'T use this skill when:
- - Simple URL fetching → use
web_fetch tool - No API key available → use
web_fetch for specific URLs - Historical/archival data → use specialized archives
Setup
- 1. Get a Tavily API key from https://tavily.com
- Set the API key in environment or config
Configuration
Set your Tavily API key in one of these ways:
Environment variable:
CODEBLOCK0
OpenClaw config:
Add to your
openclaw.json:
CODEBLOCK1
Usage Examples
Basic Search
CODEBLOCK2
Research Query
CODEBLOCK3
News Search
CODEBLOCK4
API Parameters
- -
query: Search query string (required) - INLINECODE4 : "basic" or "advanced" (default: "basic")
- INLINECODE5 : Number of results (1-10, default: 5)
- INLINECODE6 : Include AI-generated answer (true/false)
- INLINECODE7 : Include image URLs (true/false)
- INLINECODE8 : Include full page content (true/false)
Error Handling
- - Check API key is set: INLINECODE9
- Test connection: Use the basic search example above
- Rate limits: Tavily has usage limits based on your plan
Alternatives
If Tavily API is not available:
- 1. Use
web_fetch for specific URLs - Use
web_search with Kimi API (if configured) - Manual web browsing with
browser tool
Tavily 搜索技能
使用 Tavily API 进行实时网络搜索和内容提取。
使用时机
✅ 在以下情况下使用此技能:
- - 搜索关于 [主题] 的网络信息
- 查找关于 [主题] 的最新信息
- 获取关于 [主题] 的当前新闻
- 在线研究 [主题]
- 查找最新信息
不应使用的情况
❌ 在以下情况下不要使用此技能:
- - 简单的 URL 获取 → 使用 webfetch 工具
- 没有可用的 API 密钥 → 使用 webfetch 获取特定 URL
- 历史/档案数据 → 使用专门的档案库
设置
- 1. 从 https://tavily.com 获取 Tavily API 密钥
- 在环境变量或配置中设置 API 密钥
配置
通过以下方式之一设置您的 Tavily API 密钥:
环境变量:
bash
export TAVILY
APIKEY=your-api-key-here
OpenClaw 配置:
添加到您的 openclaw.json:
json
{
tavily: {
apiKey: your-api-key-here
}
}
使用示例
基础搜索
bash
搜索某个主题
curl -X POST https://api.tavily.com/search \
-H Content-Type: application/json \
-H Authorization: Bearer $TAVILY
APIKEY \
-d {
query: 2026年AI最新发展,
search_depth: basic,
max_results: 5
} | jq .
研究查询
bash
获取详细的研究结果
curl -X POST https://api.tavily.com/search \
-H Content-Type: application/json \
-H Authorization: Bearer $TAVILY
APIKEY \
-d {
query: 2026年气候变化对农业的影响,
search_depth: advanced,
max_results: 10,
include_answer: true,
include_images: false
} | jq .
新闻搜索
bash
搜索最新新闻
curl -X POST https://api.tavily.com/search \
-H Content-Type: application/json \
-H Authorization: Bearer $TAVILY
APIKEY \
-d {
query: 今日科技新闻,
search_depth: basic,
max_results: 5,
include
rawcontent: false
} | jq .
API 参数
- - query: 搜索查询字符串(必需)
- searchdepth: basic 或 advanced(默认:basic)
- maxresults: 结果数量(1-10,默认:5)
- includeanswer: 包含 AI 生成的答案(true/false)
- includeimages: 包含图片 URL(true/false)
- includerawcontent: 包含完整页面内容(true/false)
错误处理
- - 检查 API 密钥是否已设置:echo $TAVILYAPIKEY
- 测试连接:使用上面的基础搜索示例
- 速率限制:Tavily 根据您的套餐有使用限制
替代方案
如果 Tavily API 不可用:
- 1. 使用 webfetch 获取特定 URL
- 使用 Kimi API 的 websearch(如果已配置)
- 使用 browser 工具手动浏览网页