Hermes Agent 的内置 web_search 技能使用 DuckDuckGo 抓取,该技能经常因空结果、速率限制或超时而失败。本教程通过 MCP 将其替换为可靠的搜索 API 后端,永久修复“web_search 返回无结果”错误。
前置条件
- 安装 Hermes 代理 (v0.10+)
- 来自 scavio.dev 的 Scavio API 密钥
操作指南
步骤 1: 诊断问题
Hermes web_search 失败,因为 DuckDuckGo 对自动请求进行了速率限制。检查 Hermes 日志中的错误模式。
# Common error in Hermes logs:
# [WARN] web_search: DuckDuckGo returned 0 results for query 'python fastapi'
# [ERROR] web_search: Request timed out after 10s
# [WARN] web_search: Rate limited by DuckDuckGo (429)
# Check your Hermes config:
cat ~/.hermes/config.yaml | grep -A5 web_search步骤 2: 添加 Scavio MCP 作为搜索提供商
配置 Hermes 使用 Scavio MCP 服务器而不是 DuckDuckGo 进行 Web 搜索。
# In ~/.hermes/config.yaml, add MCP server:
mcp_servers:
scavio:
url: "https://mcp.scavio.dev/mcp"
headers:
x-api-key: "your_scavio_api_key"
tools:
- google_search
- reddit_search
- youtube_search步骤 3: 创建搜索技能覆盖
覆盖默认的 web_search 技能以使用 MCP 提供的 google_search 工具。
# Create ~/.hermes/skills/reliable_search.yaml:
name: reliable_search
description: Web search using Scavio API (replaces DuckDuckGo)
trigger: "search for|look up|find information about|web search"
action: |
Use the google_search tool from the scavio MCP server.
For Reddit-specific queries, use reddit_search instead.
For video content, use youtube_search.
Always return the top 5 results with title, URL, and snippet.步骤 4: 禁用默认的 web_search
防止 Hermes 回落到破损的 DuckDuckGo 刮刀上。
# In ~/.hermes/config.yaml, disable built-in web_search:
skills:
disabled:
- web_search # Disable DuckDuckGo-based search
# reliable_search skill (above) will handle search queries instead步骤 5: 测试修复
验证搜索在新后端下是否可靠工作。
# In Hermes chat:
> Search for best Python web framework 2026
# Expected: Hermes uses scavio google_search tool, returns results
# Previously: Empty results or timeout from DuckDuckGo
# Test Reddit search:
> Search Reddit for Python framework recommendations
# Test YouTube search:
> Find YouTube tutorials about FastAPIPython 示例
import requests, os
def hermes_search(query: str, platform: str = 'google') -> list:
resp = requests.post('https://api.scavio.dev/api/v1/search',
headers={'x-api-key': os.environ['SCAVIO_API_KEY'], 'Content-Type': 'application/json'},
json={'platform': platform, 'query': query}, timeout=10)
return resp.json().get('organic', [])[:5]JavaScript 示例
async function hermesSearch(query, platform = 'google') {
const resp = await fetch('https://api.scavio.dev/api/v1/search', {
method: 'POST',
headers: {'x-api-key': process.env.SCAVIO_API_KEY, 'Content-Type': 'application/json'},
body: JSON.stringify({platform, query})
});
return (await resp.json()).organic?.slice(0, 5) || [];
}预期输出
Hermes Agent with reliable web search via Scavio MCP, replacing the broken DuckDuckGo scraper with a managed API backend.