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 ↗3187--
SkillHub ↗3.2萬3—

各平台的計數口徑不同,統計時間不一致。

這個技能是做什麼的

面向需要最新網路資訊的場景,可檢索新聞、資料與一般主題。使用時需先設定 TAVILY_API_KEY,並安裝 tavily-python;做檢索增強生成時可改用 get_search_context() 而不是普通檢索。搜尋詞和回傳內容會傳送至 Tavily;fast helper 可能將結果快取在本機 ~/.cache/tavily_search。除非接受相關處理方式,否則不要提交敏感或機密內容。

資料釋出於 2026-10-27

可以用來做什麼

  • 為回答補充最新的網路資料
  • 為 RAG 流程取回可直接拼接的上下文

什麼時候用

  • 問題依賴最新資訊時
  • 需要帶出處的檢索結果時

示例提示詞

以下是根據技能文件生成的示例,不代表實際執行結果。

查一下這個話題本週的進展,附上來源連結
幫我取回能直接拼進知識庫的檢索上下文

月度資料趨勢

累計下載3.2萬
35961.9萬3.4萬2026-03 · 累計下載 56932026-05 · 累計下載 85902026-06 · 累計下載 92602026-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-069260+7.8%3
2026-058590—2
2026-035693—-

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),按月更新。口徑說明見資料方法。