hermes - 💡(How to fix) Fix Feature: Add Ollama web search/fetch as a web backend

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Add Ollama's web search and fetch API as a web_search/web_extract backend, alongside the existing Exa, Firecrawl, Parallel, Tavily, and SearXNG backends.

Ollama accounts include web search at no additional cost (free tier), which makes this a compelling zero-cost option for users who already have an Ollama account for model hosting.

Root Cause

Add Ollama's web search and fetch API as a web_search/web_extract backend, alongside the existing Exa, Firecrawl, Parallel, Tavily, and SearXNG backends.

Ollama accounts include web search at no additional cost (free tier), which makes this a compelling zero-cost option for users who already have an Ollama account for model hosting.

Fix Action

Fix / Workaround

The patch adds Ollama as a web backend following the exact same pattern as the other backends (Tavily, Exa, etc.):

Patch

Full patch attached or available on request. I've been running this locally for several weeks with web.backend: ollama and it works well for both search and fetch.

Code Example

diff --git a/tools/web_tools.py b/tools/web_tools.py
--- a/tools/web_tools.py
+++ b/tools/web_tools.py
@@ Backend registration (5 sites):
+    if configured in ("parallel", "firecrawl", "tavily", "exa", "searxng", "ollama"):
+        ("ollama", _has_env("OLLAMA_API_KEY")),
+    if backend == "ollama":
+        return _has_env("OLLAMA_API_KEY")
+        "OLLAMA_API_KEY",
+    if configured in ("exa", "parallel", "firecrawl", "tavily", "searxng", "ollama"):
+    return any(_is_backend_available(backend) for backend in ("exa", "parallel", "firecrawl", "tavily", "searxng", "ollama"))

@@ New Ollama client (~130 lines):
+_OLLAMA_WEB_BASE_URL = os.getenv("OLLAMA_WEB_BASE_URL", "https://ollama.com/api")
+_ollama_request(), _ollama_search(), _ollama_fetch(), _normalize_ollama_fetch_results()

@@ web_search_tool integration:
+        if backend == "ollama":
+            response_data = _ollama_search(query, limit)

@@ web_extract_tool integration:
+            elif backend == "ollama":
+                results = _normalize_ollama_fetch_results(safe_urls)
RAW_BUFFERClick to expand / collapse

Summary

Add Ollama's web search and fetch API as a web_search/web_extract backend, alongside the existing Exa, Firecrawl, Parallel, Tavily, and SearXNG backends.

Ollama accounts include web search at no additional cost (free tier), which makes this a compelling zero-cost option for users who already have an Ollama account for model hosting.

What it does

  • web_search: Calls https://ollama.com/api/web_search with OLLAMA_API_KEY auth, returns results in the standard { "success": True, "data": { "web": [...] } } format
  • web_extract: Calls https://ollama.com/api/web_fetch to fetch page content, normalizes to the standard document format
  • Supports web.backend: ollama in config.yaml, hermes tools setup wizard entry, and per-capability overrides via web.search_backend / web.extract_backend
  • OLLAMA_API_KEY is included in secret redaction, dump exports, and Nous subscription feature detection

Implementation

The patch adds Ollama as a web backend following the exact same pattern as the other backends (Tavily, Exa, etc.):

  • tools/web_tools.py — Ollama client functions (_ollama_request, _ollama_search, _ollama_fetch, _normalize_ollama_fetch_results) + backend registration in _get_backend, _is_backend_available, check_web_api_key, _web_requires_env, web_search_tool, web_extract_tool
  • hermes_cli/config.py — OLLAMA_API_KEY env var metadata (description, tools list, redaction)
  • hermes_cli/dump.py — OLLAMA_API_KEY in dump export list
  • hermes_cli/nous_subscription.py — Ollama in web_available/web_active detection
  • hermes_cli/tools_config.py — Ollama setup wizard entry

Patch

diff --git a/tools/web_tools.py b/tools/web_tools.py
--- a/tools/web_tools.py
+++ b/tools/web_tools.py
@@ Backend registration (5 sites):
+    if configured in ("parallel", "firecrawl", "tavily", "exa", "searxng", "ollama"):
+        ("ollama", _has_env("OLLAMA_API_KEY")),
+    if backend == "ollama":
+        return _has_env("OLLAMA_API_KEY")
+        "OLLAMA_API_KEY",
+    if configured in ("exa", "parallel", "firecrawl", "tavily", "searxng", "ollama"):
+    return any(_is_backend_available(backend) for backend in ("exa", "parallel", "firecrawl", "tavily", "searxng", "ollama"))

@@ New Ollama client (~130 lines):
+_OLLAMA_WEB_BASE_URL = os.getenv("OLLAMA_WEB_BASE_URL", "https://ollama.com/api")
+_ollama_request(), _ollama_search(), _ollama_fetch(), _normalize_ollama_fetch_results()

@@ web_search_tool integration:
+        if backend == "ollama":
+            response_data = _ollama_search(query, limit)

@@ web_extract_tool integration:
+            elif backend == "ollama":
+                results = _normalize_ollama_fetch_results(safe_urls)

Full patch attached or available on request. I've been running this locally for several weeks with web.backend: ollama and it works well for both search and fetch.

Open questions

  • Default priority: In the auto-detect fallback, where should Ollama rank? Currently last (after searxng), since it's the newest. Users with an OLLAMA_API_KEY but another backend configured would prefer their existing backend.
  • Rate limits: Ollama's web search has undocumented rate limits. The implementation uses a 60s timeout per request but no explicit rate limiting. Should we add a delay or backoff?
  • _OLLAMA_WEB_BASE_URL env override: I added this for testing. Worth keeping or should it be hardcoded?

Environment

  • Hermes v0.13.0
  • macOS 15 (Sequoia)
  • Running against Ollama cloud (ollama.com) with OLLAMA_API_KEY set

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING