Tavily Search
Search the web and get relevant results optimized for LLM consumption.
Authentication
Get your API key at https://tavily.com and add to your OpenClaw config:
CODEBLOCK0
Or set the environment variable:
CODEBLOCK1
Quick Start
Using the Script
CODEBLOCK2
Examples
CODEBLOCK3
Options
| Option | Description | Default |
|---|
| INLINECODE0 | Number of results (1-20) | 10 |
| INLINECODE1 |
Search depth:
ultra-fast,
fast,
basic,
advanced |
basic |
|
--topic <topic> | Topic:
general or
news |
general |
|
--time-range <range> | Time range:
day,
week,
month,
year | - |
|
--include-domains <domains> | Comma-separated domains to include | - |
|
--exclude-domains <domains> | Comma-separated domains to exclude | - |
|
--raw-content | Include full page content | false |
|
--json | Output raw JSON | false |
Search Depth
| Depth | Latency | Relevance | Use Case |
|---|
| INLINECODE20 | Lowest | Lower | Real-time chat, autocomplete |
| INLINECODE21 |
Low | Good | Need chunks but latency matters |
|
basic | Medium | High | General-purpose, balanced |
|
advanced | Higher | Highest | Precision matters, research |
Tips
- - Keep queries under 400 characters - Think search query, not prompt
- Break complex queries into sub-queries - Better results than one massive query
- Use
--include-domains to focus on trusted sources - Use
--time-range for recent information - Filter by
score (0-1) to get highest relevance results
Tavily 搜索
搜索网络并获取针对大语言模型消费优化的相关结果。
身份验证
在 https://tavily.com 获取您的 API 密钥,并将其添加到您的 OpenClaw 配置中:
json
{
skills: {
entries: {
tavily-search: {
enabled: true,
apiKey: tvly-您的API密钥
}
}
}
}
或者设置环境变量:
bash
export TAVILYAPIKEY=tvly-您的API密钥
快速开始
使用脚本
bash
node {baseDir}/scripts/search.mjs 查询内容
node {baseDir}/scripts/search.mjs 查询内容 -n 10
node {baseDir}/scripts/search.mjs 查询内容 --deep
node {baseDir}/scripts/search.mjs 查询内容 --topic news
示例
bash
基础搜索
node {baseDir}/scripts/search.mjs python 异步模式
更多结果
node {baseDir}/scripts/search.mjs React hooks 教程 -n 10
高级搜索
node {baseDir}/scripts/search.mjs 机器学习 --deep
新闻搜索
node {baseDir}/scripts/search.mjs AI 新闻 --topic news
按域名筛选搜索
node {baseDir}/scripts/search.mjs Python 文档 --include-domains docs.python.org
选项
| 选项 | 描述 | 默认值 |
|---|
| -n <数量> | 结果数量(1-20) | 10 |
| --depth <模式> |
搜索深度:ultra-fast、fast、basic、advanced | basic |
| --topic <主题> | 主题:general 或 news | general |
| --time-range <范围> | 时间范围:day、week、month、year | - |
| --include-domains <域名> | 包含的域名(逗号分隔) | - |
| --exclude-domains <域名> | 排除的域名(逗号分隔) | - |
| --raw-content | 包含完整页面内容 | false |
| --json | 输出原始 JSON | false |
搜索深度
| 深度 | 延迟 | 相关性 | 使用场景 |
|---|
| ultra-fast | 最低 | 较低 | 实时聊天、自动补全 |
| fast |
低 | 良好 | 需要片段但延迟重要 |
| basic | 中等 | 高 | 通用目的,平衡 |
| advanced | 较高 | 最高 | 精度重要,研究用途 |
提示
- - 保持查询在 400 字符以内 - 思考搜索查询,而非提示词
- 将复杂查询拆分为子查询 - 比单个大型查询效果更好
- 使用 --include-domains 聚焦于可信来源
- 使用 --time-range 获取最新信息
- 按 score(0-1)筛选 获取最高相关性的结果