chasehl

tavily-search

AI 智能体v1.0.0
作者:chasehl更新于 2026-05-11search-with-tavily@clawhub_chasehl/search-with-tavily
工具调用#Web Search#Current Information#Search The Web#News#Rag

据 AlphaMoat 统计,截至 2026-10,tavily-search 累计下载 31,910 次、获 3 个星标,按累计下载量在本次参与排名的 10,914 个 AI 技能中排名第 850 位,在「AI 智能体」分类(1,632 个)中排名第 134 位。

列表默认按累计下载量排序,也可按星标排序;详情页排名按累计下载量计算。

累计下载
3.2万
星标
3
全站下载量排名
#850
全站前 8% · 「AI 智能体」前 9%
平台累计下载星标评论
ClawHub ↗3,187--
SkillHub ↗3.2万3—

各平台的计数口径不同,统计时间不一致。

这个技能是做什么的

面向需要最新网络信息的场景,可检索新闻、资料与一般主题。使用时需先设置 TAVILY_API_KEY,并安装 tavily-python;做检索增强生成时可改用 get_search_context() 而不是普通检索。搜索词和返回内容会发送给 Tavily;fast helper 可能把结果缓存在本机 ~/.cache/tavily_search。除非接受相应处理方式,否则不要提交敏感或机密内容。

资料发布于 2026-10-27

可以用来做什么

  • 为回答补充最新的网络资料
  • 为 RAG 流程取回可直接拼接的上下文

什么时候用

  • 问题依赖最新信息时
  • 需要带出处的检索结果时

示例提示词

以下是根据技能文档生成的示例,不代表实际运行结果。

查一下这个话题本周的进展,附上来源链接
帮我取回能直接拼进知识库的检索上下文

月度数据趋势

累计下载3.2万
3,5961.9万3.4万2026-03 · 累计下载 5,6932026-05 · 累计下载 8,5902026-06 · 累计下载 9,2602026-07 · 累计下载 1.1万2026-08 · 累计下载 1.2万2026-09 · 累计下载 1.4万2026-10 · 累计下载 3.2万26-0326-0926-10
星标3
0232026-03 · 星标 -2026-05 · 星标 22026-06 · 星标 32026-07 · 星标 32026-08 · 星标 32026-09 · 星标 32026-10 · 星标 326-0326-0926-10

2026-09 起统计方法调整:同名技能按作者分别统计,并覆盖全部技能。图中虚线为调整前的月份,与之后的数据不直接比较,也不计算跨越调整的增长。

月份累计下载环比星标
2026-103.2万—3
2026-091.4万—3
2026-081.2万+9.2%3
2026-071.1万+15.8%3
2026-069,260+7.8%3
2026-058,590—2
2026-035,693—-

SKILL.md 原文

以下是作者发布的原始文件,按纯文本显示,本站未做修改或审核;其中的链接不可点击,命令请核实后再运行。抓取于 2026-10-23。

5.2 KB · ClawHub v1.0.0
---
name: tavily-search
description: Web search using Tavily API - a powerful search engine for AI agents. Use when you need to search the web for current information, news, research, or any topic that requires up-to-date web data. Supports multiple search modes including basic search, Q&A, and context retrieval for RAG applications.
metadata:
  openclaw:
    emoji: 🔍
    requires:
      env:
        - TAVILY_API_KEY
---
展开全部(共 202 行)

# Tavily Search

Web search using Tavily API - optimized for AI agents and RAG applications.

## Quick Start

### Prerequisites

Set your Tavily API key:
```bash
export TAVILY_API_KEY="tvly-your-api-key"
```

Or use the Python client directly with API key.

### Basic Search

```python
from tavily import TavilyClient

client = TavilyClient(api_key="tvly-your-api-key")
response = client.search("Latest AI developments")

for result in response['results']:
    print(f"Title: {result['title']}")
    print(f"URL: {result['url']}")
    print(f"Content: {result['content'][:200]}...")
```

### Q&A Search (Get Direct Answers)

```python
answer = client.qna_search(query="Who won the 2024 US Presidential Election?")
print(answer)
```

### Context Search (For RAG Applications)

```python
context = client.get_search_context(
    query="Climate change effects on agriculture",
    max_tokens=4000
)
# Use context directly in LLM prompts
```

## Search Parameters

### Common Parameters

| Parameter | Type | Description | Default |
|-----------|------|-------------|---------|
| `query` | string | Search query (required) | - |
| `search_depth` | string | "basic" or "comprehensive" | "basic" |
| `max_results` | int | Number of results (1-20) | 5 |
| `include_answer` | bool | Include AI-generated answer | False |
| `include_raw_content` | bool | Include full page content | False |
| `include_images` | bool | Include image URLs | False |

### Advanced Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `topic` | string | Search topic: "general" or "news" |
| `time_range` | string | Time filter: "day", "week", "month", "year" |
| `include_domains` | list | Restrict to specific domains |
| `exclude_domains` | list | Exclude specific domains |
| `exact_match` | bool | Require exact phrase matching |

## Response Format

### Standard Search Response

```json
{
  "query": "search query",
  "results": [
    {
      "title": "Result Title",
      "url": "https://example.com/article",
      "content": "Snippet or full content...",
      "score": 0.95,
      "raw_content": "Full page content (if requested)..."
    }
  ],
  "answer": "AI-generated answer (if requested)",
  "images": ["image_url1", "image_url2"],
  "response_time": 1.23
}
```

## Error Handling

### Common Errors

```python
from tavily import TavilyClient
from tavily.exceptions import TavilyError, RateLimitError, InvalidAPIKeyError

client = TavilyClient(api_key="your-api-key")

try:
    response = client.search("query")
except InvalidAPIKeyError:
    print("Invalid API key. Check your TAVILY_API_KEY.")
except RateLimitError:
    print("Rate limit exceeded. Please wait before retrying.")
except TavilyError as e:
    print(f"Tavily error: {e}")
```

## Best Practices

### 1. Use Context Search for RAG

For retrieval-augmented generation, use `get_search_context()` instead of standard search:

```python
context = client.get_search_context(
    query=user_query,
    max_tokens=4000,  # Fit within your LLM's context window
    search_depth="comprehensive"
)

# Use in prompt
prompt = f"""Based on the following context:
{context}

Answer this question: {user_query}"""
```

### 2. Handle Rate Limits

Tavily has rate limits. Implement exponential backoff:

```python
import time
from tavily.exceptions import RateLimitError

def search_with_retry(client, query, max_retries=3):
    for attempt in range(max_retries):
        try:
            return client.search(query)
        except RateLimitError:
            if attempt < max_retries - 1:
                wait_time = 2 ** attempt  # Exponential backoff
                print(f"Rate limited. Waiting {wait_time}s...")
                time.sleep(wait_time)
            else:
                raise
```

### 3. Filter Results

Use domain filters to improve result quality:

```python
# Only search trusted news sources
response = client.search(
    query="breaking news",
    include_domains=["bbc.com", "reuters.com", "apnews.com"],
    time_range="day"  # Only recent news
)
```

### 4. Use Q&A Mode for Facts

For factual questions, use Q&A mode for direct answers:

```python
# Good for: "Who won the 2024 election?"
answer = client.qna_search("Who won the 2024 US Presidential Election?")

# Good for: "What is the capital of France?"
answer = client.qna_search("Capital of France")
```

## Additional Resources

- **Tavily Documentation**: https://docs.tavily.com
- **Python SDK**: https://github.com/tavily-ai/tavily-python
- **JavaScript SDK**: https://github.com/tavily-ai/tavily-js
- **API Reference**: https://docs.tavily.com/documentation/api-reference

## Skill Maintenance

This skill requires:
- `TAVILY_API_KEY` environment variable set
- `tavily-python` package installed (`pip install tavily-python`)

For issues or updates, refer to the Tavily documentation or GitHub repository.

「AI 智能体」分类下的热门技能

数据月份:2026-10 · 下载/星标数聚合自公开技能注册库(ClawHub、SkillHub),按月更新。口径说明见数据方法。