The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(web): keyless ring fails over when a free tier refuses the client
alt-glitch4d757bf87a7c
diff --git a/plugins/web/firecrawl/provider.py b/plugins/web/firecrawl/provider.pyindex 950611e2f8b..614ebb87705 100644--- a/plugins/web/firecrawl/provider.py+++ b/plugins/web/firecrawl/provider.py@@ -117,7 +117,11 @@ class _KeylessFirecrawlClient:def _post(self, path: str, payload: Dict[str, Any]) -> Dict[str, Any]:response = httpx.post(f"{self.api_url}{path}", json=payload, headers={"Content-Type": "application/json"}, timeout=60.0)- response.raise_for_status()+ try:+ response.raise_for_status()+ except httpx.HTTPStatusError as exc:+ # Keep the vendor's reason (e.g. "your IP address looks suspicious") and the ring's ``HTTP <code>`` shape.+ raise httpx.HTTPStatusError(f"HTTP {response.status_code}: {response.text.strip()[:300]}", request=exc.request, response=response) from excreturn response.json()search = lambda self, *, query, limit=5: self._post("/v2/search", {"query": query, "limit": limit}) # noqa: E731diff --git a/plugins/web/keyless_mcp.py b/plugins/web/keyless_mcp.pyindex e59d33b71bd..c1f2bfd2583 100644--- a/plugins/web/keyless_mcp.py+++ b/plugins/web/keyless_mcp.py@@ -34,6 +34,9 @@ class KeylessMCPError(RuntimeError):_RATE_LIMIT_MARKERS = ("rate limit", "rate-limit", "ratelimit", "too many requests", "429", "quota exceeded", "slow down")+# A free tier that refuses this client (401/402/403: anonymous access revoked, IP reputation gate) or+# errors server-side (5xx) fails every query from here, so the next vendor gets the request too.+_VENDOR_REFUSAL = re.compile(r"\bHTTP (?:40[123]|5\d\d)\b")# vendor -> (display label, env key, signup URL) for the standard failure hint._VENDOR_HINTS = {@@ -43,8 +46,8 @@ _VENDOR_HINTS = {def _is_rate_limitish(message: str) -> bool:- """Heuristic: does an error message look like free-tier throttling?"""- return any(marker in (message or "").lower() for marker in _RATE_LIMIT_MARKERS)+ """Heuristic: does an error message look like free-tier throttling or a vendor-side refusal?"""+ return any(marker in (message or "").lower() for marker in _RATE_LIMIT_MARKERS) or bool(_VENDOR_REFUSAL.search(message or ""))def _fail_msg(vendor: str, kind: str, exc: Any, *, other_backends: bool = True) -> str:@@ -291,7 +294,7 @@ def _keenable_request(method: str, path: str, **kwargs: Any) -> Dict[str, Any]:headers["Content-Type"] = "application/json"response = getattr(requests, method)(f"{KEENABLE_API_URL}{path}", headers=headers, timeout=_TIMEOUT_SECONDS, **kwargs)if response.status_code >= 400:- raise KeylessMCPError(_response_text(response).strip() or f"HTTP {response.status_code}")+ raise KeylessMCPError(f"HTTP {response.status_code}: {_response_text(response).strip()[:300]}")return response.json()@@ -369,12 +372,12 @@ def _walk_ring(name: str, kind: str, call, throttled) -> tuple:if not throttled(result):return order, vendor, result, Falseif i + 1 < len(order):- logger.info("keyless %s %s throttled; failing over to %s", vendor, kind, order[i + 1])+ logger.info("keyless %s %s throttled or refused; failing over to %s", vendor, kind, order[i + 1])return order, vendor, result, Truedef search_with_failover(name: str, query: str, limit: int = 5) -> Dict[str, Any]:- """Rate-limit-shaped errors advance to the next vendor, other errors stop the walk+ """Rate-limit-shaped errors and vendor refusals advance to the next vendor, other errors stop the walk(a malformed query fails everywhere). ``data.served_by`` is set when the servingvendor differs from *name*."""diff --git a/website/docs/user-guide/configuration.md b/website/docs/user-guide/configuration.mdindex 6c034dab9ba..513e5cd79cb 100644--- a/website/docs/user-guide/configuration.md+++ b/website/docs/user-guide/configuration.md@@ -2740,7 +2740,7 @@ web:| **Perplexity** | `PERPLEXITY_API_KEY` | ✔ | ✔ (query-relevant snippets) || **Exa** | `EXA_API_KEY` (optional — keyless free tier) | ✔ | ✔ |-**Backend selection:** The runtime always uses the stored `web.backend` selection (set via `hermes tools`; `nous` routes through the managed Tool Gateway). Only if no web backend has ever been selected is one auto-detected from available API keys: if only `SEARXNG_URL` is set, SearXNG is used; if only `EXA_API_KEY` is set, Exa; if only `TAVILY_API_KEY` is set, Tavily; if only `PERPLEXITY_API_KEY` is set, Perplexity; if only `PARALLEL_API_KEY` is set, Parallel; if only `KEENABLE_API_KEY` is set, Keenable. With **no selection and no credentials at all**, requests rotate round-robin across the keyless free-tier ring (Exa / Parallel / Firecrawl / Keenable) with automatic next-in-line failover on rate limits — see the [Web Search guide](./features/web-search.md) for details. Once a selection exists, adding a key to `.env` does not change the route. Selecting Tavily, Firecrawl, or Keenable in `hermes tools` also works without a key.+**Backend selection:** The runtime always uses the stored `web.backend` selection (set via `hermes tools`; `nous` routes through the managed Tool Gateway). Only if no web backend has ever been selected is one auto-detected from available API keys: if only `SEARXNG_URL` is set, SearXNG is used; if only `EXA_API_KEY` is set, Exa; if only `TAVILY_API_KEY` is set, Tavily; if only `PERPLEXITY_API_KEY` is set, Perplexity; if only `PARALLEL_API_KEY` is set, Parallel; if only `KEENABLE_API_KEY` is set, Keenable. With **no selection and no credentials at all**, requests rotate round-robin across the keyless free-tier ring (Exa / Parallel / Firecrawl / Keenable) with automatic next-in-line failover on rate limits and vendor refusals — see the [Web Search guide](./features/web-search.md) for details. Once a selection exists, adding a key to `.env` does not change the route. Selecting Tavily, Firecrawl, or Keenable in `hermes tools` also works without a key.**SearXNG** is a free, self-hosted, privacy-respecting metasearch engine that queries 70+ search engines. No API key needed — just set `SEARXNG_URL` to your instance (e.g., `http://localhost:8080`). SearXNG is search-only; `web_extract` requires a separate extract provider (set `web.extract_backend`). See the [Web Search setup guide](./features/web-search.md) for Docker setup instructions.diff --git a/website/docs/user-guide/features/web-search.md b/website/docs/user-guide/features/web-search.mdindex 81e515d344e..e53672598b6 100644--- a/website/docs/user-guide/features/web-search.md+++ b/website/docs/user-guide/features/web-search.md@@ -39,7 +39,7 @@ Brave Search, DDGS, xAI, and OpenAI Native are **search-only** — pair any of t**Per-capability split:** you can use different providers for search and extract independently — for example SearXNG (free) for search and Firecrawl for extract. See [Per-capability configuration](#per-capability-configuration) below.:::info Works out of the box — keyless free-tier rotation-A fresh install with **no web credentials at all** gets working `web_search` and `web_extract` out of the box: requests rotate round-robin across the ring vendors' public free tiers — **Exa, Parallel, Firecrawl, and Keenable** — spreading load evenly, and a rate-limited request automatically retries on the next vendor in the ring (multi-hop, until one serves or all are throttled). No signup, no key. This tier is strictly last-resort — any configured backend or present API key always wins — and requests carry no user identifiers (only a random per-process session id, rotated on restart). For guaranteed, unthrottled service, set up a keyed provider. Disable the keyless tier entirely with `web.keyless_fallback: false`.+A fresh install with **no web credentials at all** gets working `web_search` and `web_extract` out of the box: requests rotate round-robin across the ring vendors' public free tiers — **Exa, Parallel, Firecrawl, and Keenable** — spreading load evenly, and a request that is rate-limited or refused (a 401/402/403 access gate or a 5xx) automatically retries on the next vendor in the ring (multi-hop, until one serves or all fail). No signup, no key. This tier is strictly last-resort — any configured backend or present API key always wins — and requests carry no user identifiers (only a random per-process session id, rotated on restart). For guaranteed, unthrottled service, set up a keyed provider. Disable the keyless tier entirely with `web.keyless_fallback: false`.:::**Choosing free vs paid explicitly:** in `hermes tools`, Exa, Parallel, and Keenable each appear as two rows — **Free (keyless)** and **Paid (API key)**. Picking Free pins that vendor's anonymous endpoint (even if you later add a key); picking Paid pins the keyed path (a missing key then errors instead of silently downgrading to the free tier). The selection is stored as `web.provider_tier.<name>: free|paid`; leave it unset for auto (key present → paid, otherwise the keyless ring).@@ -447,7 +447,7 @@ If no shared backend has **ever** been selected (no `web.backend` written by you| `ddgs` package importable | ddgs || *(nothing set at all)* | keyless ring: exa / parallel / firecrawl / keenable (round-robin) |-**Keyless free-tier ring:** when *no* credential above is present, requests rotate across the ring vendors' public free tiers (Exa, Parallel, Firecrawl, Keenable) so web tools work on a fresh install with zero setup — and a rate-limited request fails over to the next vendor in the ring automatically. Pin one vendor in `hermes tools` to stop the rotation (the ring is then only used as failover succession on throttles). All free tiers are vendor-rate-limited under burst load; sustained normal usage goes through fine. Set `web.keyless_fallback: false` to turn the tier off — with it off and no credentials, web tools are unavailable until a provider is configured.+**Keyless free-tier ring:** when *no* credential above is present, requests rotate across the ring vendors' public free tiers (Exa, Parallel, Firecrawl, Keenable) so web tools work on a fresh install with zero setup — and a rate-limited or refused request fails over to the next vendor in the ring automatically. Pin one vendor in `hermes tools` to stop the rotation (the ring is then only used as failover succession on throttles). All free tiers are vendor-rate-limited under burst load; sustained normal usage goes through fine. Set `web.keyless_fallback: false` to turn the tier off — with it off and no credentials, web tools are unavailable until a provider is configured.**One-shot keyless rescue for keyed backends:** when your chosen/keyed backend — including the Nous Tool Gateway route (`web.backend: nous`) — fails a call (bad key, outage, unreachable gateway, upstream 5xx), that single call automatically retries on the keyless free-tier ring instead of erroring — the result notes which vendor served it and why (`rescued_from` / `backend_error`). The failover is never sticky: the very next `web_search`/`web_extract` call attempts your chosen backend again. Disable with `web.keyless_rescue: false` (also off whenever `keyless_fallback` is off).