360 Secure SkillHub
360 安全技能中心

Tavily Search

该 Skill 是一个 Node 命令行工具,调用 Tavily 搜索 API,按查询返回标题、链接、内容、相关度分数和可选 AI 答案/图片,并支持搜索深度、结果数量与域名过滤。它需要 TAVILY_API_KEY,配置和调用路径偏向 OpenClaw 工作区;未包含提取或研究 API 的具体实现。

yythumb
yythumb
热度 16.02
最近更新 2026-03-23 05:26:50
分类:搜索依赖:代码执行 / 第三方 API / 读写文件应用场景:研究 / 摘要总结

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add tavily-search-yythumb
Metadata
name
Tavily Search
slug
tavily-search
version
1.0.0
homepage
https://github.com/tavily-ai/tavily-mcp
description
Search the web using Tavily API - real-time, AI-optimized search for agents. 使用 Tavily API 进行网络搜索 - 实时、AI 优化的智能体搜索工具。
changelog
Initial release. Supports basic/advanced search, AI answers, image search, and domain filtering. 初始版本,支持基础/高级搜索、AI 答案、图片搜索和域名过滤。
metadata
{"clawdbot":{"emoji":"🔭","requires":{"bins":["node"]},"os":["linux","darwin","win32"],"configPaths":["~/.openclaw/workspace/skills/tavily-search/.env"],"configPaths.optional":["./SECURITY.md","./README.md"]}}

Tavily Search Skill

🔭 Real-time web search powered by Tavily API - designed for AI agents.

Features

  • ⚡ Fast Search - Results in <1s average
  • 🤖 AI Answers - Optional AI-generated summaries
  • 🖼️ Image Search - Include relevant images
  • 🌐 Multi-language - Supports 100+ languages
  • 🎯 Domain Filtering - Include/exclude specific domains
  • 📊 Structured Results - Title, URL, content, relevance score

功能

  • ⚡ 快速搜索 - 平均 <1 秒返回结果
  • 🤖 AI 答案 - 可选 AI 生成的摘要
  • 🖼️ 图片搜索 - 包含相关图片
  • 🌐 多语言 - 支持 100+ 种语言
  • 🎯 域名过滤 - 包含/排除特定域名
  • 📊 结构化结果 - 标题、URL、内容、相关性分数

Installation

Option 1: Install from ClawHub

clawhub install tavily-search

Option 2: Manual Installation

# Clone or copy the skill to your workspace
cp -r tavily-search ~/.openclaw/workspace/skills/

# Create .env file with your API key
cp ~/.openclaw/workspace/skills/tavily-search/.env.example \
   ~/.openclaw/workspace/skills/tavily-search/.env

# Edit .env and add your Tavily API key
nano ~/.openclaw/workspace/skills/tavily-search/.env

安装方式

方式 1:从 ClawHub 安装

clawhub install tavily-search

方式 2:手动安装

# 复制技能到工作空间
cp -r tavily-search ~/.openclaw/workspace/skills/

# 创建 .env 文件
cp ~/.openclaw/workspace/skills/tavily-search/.env.example \
   ~/.openclaw/workspace/skills/tavily-search/.env

# 编辑 .env 并添加 Tavily API key
nano ~/.openclaw/workspace/skills/tavily-search/.env

Configuration

Step 1: Get Tavily API Key

  1. Go to Tavily Dashboard
  2. Sign up / Log in
  3. Copy your API key from the dashboard

Step 2: Configure API Key

Method A: Using .env file (Recommended)

Create ~/.openclaw/workspace/skills/tavily-search/.env:

TAVILY_API_KEY=tvly-your-api-key-here

Method B: Using environment variable

Add to ~/.bashrc or ~/.zshrc:

export TAVILY_API_KEY="tvly-your-api-key-here"

Then reload:

source ~/.bashrc  # or source ~/.zshrc

配置

步骤 1:获取 Tavily API Key

  1. 访问 Tavily Dashboard
  2. 注册/登录
  3. 从控制台复制 API key

步骤 2:配置 API Key

方式 A:使用 .env 文件(推荐)

创建 ~/.openclaw/workspace/skills/tavily-search/.env:

TAVILY_API_KEY=tvly-your-api-key-here

方式 B:使用环境变量

添加到 ~/.bashrc 或 ~/.zshrc:

export TAVILY_API_KEY="tvly-your-api-key-here"

然后重新加载:

source ~/.bashrc  # 或 source ~/.zshrc

Usage

Basic Search

# Run the search script
~/.openclaw/workspace/skills/tavily-search/tavily-search.js "your query"

# Or with options
~/.openclaw/workspace/skills/tavily-search/tavily-search.js \
  --query "AI developments 2026" \
  --max 5

With AI Answer

~/.openclaw/workspace/skills/tavily-search/tavily-search.js \
  "What is MCP protocol?" \
  --answer \
  --max 3

Advanced Search

~/.openclaw/workspace/skills/tavily-search/tavily-search.js \
  "machine learning" \
  --depth advanced \
  --max 10

Image Search

~/.openclaw/workspace/skills/tavily-search/tavily-search.js \
  "AI architecture" \
  --images \
  --max 5

Domain Filtering

# Only search specific domains
~/.openclaw/workspace/skills/tavily-search/tavily-search.js \
  "OpenClaw tutorial" \
  --include-domains "youtube.com,github.com" \
  --max 5

# Exclude domains
~/.openclaw/workspace/skills/tavily-search/tavily-search.js \
  "product reviews" \
  --exclude-domains "reddit.com,pinterest.com" \
  --max 5

使用方法

基础搜索

# 运行搜索脚本
~/.openclaw/workspace/skills/tavily-search/tavily-search.js "your query"

# 或带参数
~/.openclaw/workspace/skills/tavily-search/tavily-search.js \
  --query "AI developments 2026" \
  --max 5

带 AI 答案

~/.openclaw/workspace/skills/tavily-search/tavily-search.js \
  "What is MCP protocol?" \
  --answer \
  --max 3

高级搜索

~/.openclaw/workspace/skills/tavily-search/tavily-search.js \
  "machine learning" \
  --depth advanced \
  --max 10

图片搜索

~/.openclaw/workspace/skills/tavily-search/tavily-search.js \
  "AI architecture" \
  --images \
  --max 5

域名过滤

# 只搜索特定域名
~/.openclaw/workspace/skills/tavily-search/tavily-search.js \
  "OpenClaw tutorial" \
  --include-domains "youtube.com,github.com" \
  --max 5

# 排除域名
~/.openclaw/workspace/skills/tavily-search/tavily-search.js \
  "product reviews" \
  --exclude-domains "reddit.com,pinterest.com" \
  --max 5

CLI Options

Option Short Description Default
--query -q Search query (required)
--depth -d Search depth: basic or advanced basic
--max -m Max results (1-20) 5
--answer -a Include AI-generated answer false
--images -i Include image results false
--raw -r Include raw page content false
--include-domains - Comma-separated domains to include []
--exclude-domains - Comma-separated domains to exclude []

命令行选项

选项 简写 说明 默认值
--query -q 搜索关键词 (必填)
--depth -d 搜索深度:basic 或 advanced basic
--max -m 最大结果数 (1-20) 5
--answer -a 包含 AI 生成的答案 false
--images -i 包含图片结果 false
--raw -r 包含原始页面内容 false
--include-domains - 要包含的域名(逗号分隔) []
--exclude-domains - 要排除的域名(逗号分隔) []

Output Format

Success Response

🔭 Searching Tavily for: "query"...

✅ Found 5 results (0.87s)

🤖 AI Answer:
[AI-generated summary if --answer flag is used]

📋 Results:

1. Page Title
   URL: https://example.com
   Score: 0.95
   Snippet content...

🖼️  Images (3):
1. https://example.com/image1.jpg
2. https://example.com/image2.jpg
3. https://example.com/image3.jpg

Error Response

❌ Error: TAVILY_API_KEY environment variable not set
Set it with:
  1. Create .env file in the script directory
  2. Or: export TAVILY_API_KEY="tvly-your-key-here"
  3. Or add to ~/.bashrc or ~/.zshrc

输出格式

成功响应

🔭 Searching Tavily for: "query"...

✅ Found 5 results (0.87s)

🤖 AI Answer:
[如果使用 --answer 参数,显示 AI 生成的摘要]

📋 Results:

1. Page Title
   URL: https://example.com
   Score: 0.95
   Snippet content...

🖼️  Images (3):
1. https://example.com/image1.jpg
2. https://example.com/image2.jpg
3. https://example.com/image3.jpg

错误响应

❌ Error: TAVILY_API_KEY environment variable not set
Set it with:
  1. Create .env file in the script directory
  2. Or: export TAVILY_API_KEY="tvly-your-key-here"
  3. Or add to ~/.bashrc or ~/.zshrc

Security

⚠️ IMPORTANT: Never share your API key!

  • Store API key in .env file (permissions: 600)
  • Never commit .env to version control
  • Never share API key in public channels
  • Rotate key immediately if leaked

See SECURITY.md for detailed security guidelines.

安全

⚠️ 重要:切勿分享你的 API key!

  • 将 API key 存储在 .env 文件中(权限:600)
  • 切勿将 .env 提交到版本控制
  • 切勿在公开渠道分享 API key
  • 如泄露立即撤销并重新生成

详见 SECURITY.md 安全指南。


Troubleshooting

"TAVILY_API_KEY not set"

Solution: Make sure .env file exists and contains your API key:

cat ~/.openclaw/workspace/skills/tavily-search/.env
# Should show: TAVILY_API_KEY=tvly-xxxxx

"HTTP 401: Unauthorized"

Solution: Your API key is invalid. Check:

  1. Key is copied correctly (no extra spaces)
  2. Key is active in Tavily dashboard
  3. Account has available credits

"Rate limited"

Solution: Wait a few minutes and retry. Free tier: 1000 requests/month.

故障排除

"TAVILY_API_KEY not set"

解决方法: 确保 .env 文件存在并包含 API key:

cat ~/.openclaw/workspace/skills/tavily-search/.env
# 应该显示:TAVILY_API_KEY=tvly-xxxxx

"HTTP 401: Unauthorized"

解决方法: API key 无效。检查:

  1. Key 复制正确(无多余空格)
  2. Key 在 Tavily 控制台处于激活状态
  3. 账户有可用额度

"Rate limited"

解决方法: 等待几分钟后重试。免费额度:1000 次请求/月。


API Reference

For detailed API documentation, see:

API 参考

详细 API 文档:


License

MIT-0 - Free to use, modify, and redistribute. No attribution required.

许可证

MIT-0 - 可自由使用、修改和重新分发。无需署名。


Support

支持