Files
hermes-agent/tests/hermes_cli/test_web_provider_selection.py
Robin Fernandes 749220ef00 feat(web): serve managed search through Perplexity
Use Perplexity for Nous-managed search, retaining Firecrawl for extract
and as a per-call search fallback. Explicit search overrides and direct
keys keep their own billing paths; fallback results are never cached.
When the managed route is selected but the Tool Gateway is unavailable
(unentitled account or no Nous token), search reports that selection
error instead of asking for a direct key the user never chose.

The managed search vendor is unannounced, so user-facing copy names the
capability rather than the vendor: status, portal and docs say "managed
web search", and the fallback annotation reads `managed_primary`. Direct-key
configuration docs are unchanged.

Routing, auth, payload, cache and entitlement regressions are covered
through real config loading and local HTTP.
2026-09-24 16:17:16 -04:00

21 lines
871 B
Python

"""Web setup reports the selected backend without interrupting config writes."""
import pytest
@pytest.mark.parametrize("managed,backend", [(True, "firecrawl"), (False, "perplexity"), (False, "exa")])
def test_web_selection_reports_the_backend_it_writes(monkeypatch, managed, backend):
import hermes_cli.tools_config_providers as providers
monkeypatch.setattr(providers, "_nous_provider_gate", lambda *a, **kw: True)
messages = []
monkeypatch.setattr(providers, "_print_success", messages.append)
row = {"name": "Test provider", "web_backend": backend, "env_vars": []}
if managed:
row["managed_nous_feature"] = "web"
config = {}
providers._configure_provider(row, config)
selected = config["web"]["backend"]
assert selected == ("nous" if managed else backend)
assert f" Web backend set to: {selected}" in messages