Fix Missing Web Search Capability

Date: 2026-04-25
Goal: Enable a reliable web search backend using the user's existing Perplexity API key instead of the currently unconfigured native tool.


Current Context

  • The user's Perplexity API key is available but never persisted for security.
  • My config.yaml has no search provider configured (no SerpAPI, Brave, Google CSE, etc.).
  • My enabled toolsets are only hermes-cli and hermes-telegram — there is no web toolset loaded.
  • Attempting web_search calls will either fail or silently fall back to slow browser-based scraping.
  • We inspected pplx-cli (a local RAG wrapper around Perplexity) and concluded it is overkill for this need.

Assumptions

  • Hermes supports a web toolset that can be enabled in config.yaml under toolsets.
  • The web toolset supports a configurable provider backend (e.g., SerpAPI, Brave, or a custom OpenAI-compatible endpoint).
  • Perplexity's Sonar models (sonar, sonar-pro, sonar-reasoning) accept a messages payload via https://api.perplexity.ai/chat/completions and return grounded, cited web search results.

Proposed Approach

Use the Perplexity API as the web search backend rather than installing pplx-cli.
Two viable paths exist; Path A is preferred for simplicity.


Path A — Native web Toolset + Perplexity Provider (Preferred)

Wire the native web_search tool to call Perplexity's chat completions endpoint directly.
If Hermes' web toolset expects a traditional search API (10-blue-links style), we can proxy through a lightweight shell wrapper instead.

  1. Inspect available toolsets to confirm the exact name of the web search skill (e.g., web, search, web_search).
  2. Enable the toolset in ~/.hermes/config.yaml under toolsets:.
  3. Configure the provider:
    • If the toolset supports a generic openai_compatible provider, point base_url to https://api.perplexity.ai and supply the API key.
    • If it only supports traditional search APIs (SerpAPI, Brave, etc.), create a micro-wrapper script that translates web_search queries into Perplexity API calls and returns structured results.
  4. Test with a simple query like "current weather in Tokyo" and verify citations are returned.

Path B — Lightweight Shell Wrapper (Fallback)

If Path A is blocked by toolset limitations, create a minimal wrapper script.

  1. Write ~/.hermes/scripts/perplexity_search.sh that:
    • Accepts a query string.
    • Calls curl to https://api.perplexity.ai/chat/completions with model sonar.
    • Returns top citations + a short summary in JSON.
  2. Register this script as a custom Hermes hook or alias so I can invoke it transparently when web context is needed.
  3. Document usage in a skill note.

Step-by-Step Plan

StepActionDetails
1Discover toolsetRun skills_list or inspect ~/.hermes/skills/ for a web / search skill
2Inspect skill configLoad the skill with skill_view to learn its provider schema
3Configure config.yamlAdd the skill to the toolsets: array; add provider block under providers: or auxiliary: if needed
4Set API keyEither export PERPLEXITY_API_KEY in shell env, or add it to providers.perplexity.api_key in config
5ValidateRun a live web_search query and confirm results with citations
6(Fallback) Write wrapperIf native integration fails, create perplexity_search.sh and test it manually

Files Likely to Change

  • ~/.hermes/config.yaml — add toolset + provider configuration
  • ~/.hermes/scripts/perplexity_search.sh — only if Path A is blocked
  • ~/.bashrc or ~/.profile — to export PERPLEXITY_API_KEY persistently

Tests / Validation

  1. Basic search: Query "who won the last FIFA world cup" and expect a grounded answer with citation URLs.
  2. Edge case: Query with special characters (C++, &, -v flags) to ensure proper URL encoding.
  3. Error handling: Temporarily break the key and confirm a graceful failure message instead of a crash.

Risks, Tradeoffs, and Open Questions

RiskMitigation
Perplexity API key is rate-limited / meteredUse the cheapest Sonar model (sonar) for search; reserve sonar-pro for deep queries
Native web toolset may not support custom endpointsFall back to Path B wrapper script
Citations format from Perplexity may not match what other search providers returnNormalize the response JSON in the wrapper

Open question: Does Hermes have a native-mcp or built-in MCP client that could expose Perplexity as a tool more cleanly? Worth checking ~/.hermes/skills/mcp/ if Path A stalls.


Decision

Proceed with Path A first.
If the native web toolset cannot ingest Perplexity directly, pivot to Path B and document the wrapper as a new skill for future reuse.