The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
feat(onboarding): enhance Tavily backend support for keyless access
Lakshya Agarwal6bf437575549
diff --git a/hermes_cli/nous_subscription.py b/hermes_cli/nous_subscription.pyindex 01d10d12f43..3ef724b3503 100644--- a/hermes_cli/nous_subscription.py+++ b/hermes_cli/nous_subscription.py@@ -446,6 +446,7 @@ def get_nous_subscription_features(# Per-capability overrides: if set, they determine which backend is active for# search/extract independently of web.backend.web_search_backend = str(web_cfg.get("search_backend") or "").strip().lower()+ web_extract_backend = str(web_cfg.get("extract_backend") or "").strip().lower()tts_provider = str(tts_cfg.get("provider") or "edge").strip().lower()# STT default is "local" (faster-whisper) per DEFAULT_CONFIG, which# requires `pip install faster-whisper`. For Nous subscribers we'd@@ -505,6 +506,9 @@ def get_nous_subscription_features(direct_firecrawl = bool(get_env_value("FIRECRAWL_API_KEY") or get_env_value("FIRECRAWL_API_URL"))direct_parallel = bool(get_env_value("PARALLEL_API_KEY"))direct_tavily = bool(get_env_value("TAVILY_API_KEY"))+ # Keyless Tavily is opt-in: selecting it in `hermes tools` / setup writes+ # web.backend (or a per-capability override) without requiring a key.+ tavily_selected = "tavily" in {web_backend, web_search_backend, web_extract_backend}direct_searxng = bool(get_env_value("SEARXNG_URL"))direct_fal = fal_key_is_configured()direct_fal_video = direct_fal # same FAL_KEY; separate var so use_gateway is independent@@ -537,6 +541,7 @@ def get_nous_subscription_features(direct_exa = Falsedirect_parallel = Falsedirect_tavily = False+ tavily_selected = Falseif image_use_gateway:direct_fal = Falseif video_use_gateway:@@ -624,6 +629,8 @@ def get_nous_subscription_features(# different browser choice wins over the env var.direct_camofox = False++ tavily_ready = direct_tavily or tavily_selectedweb_managed = web_backend == "firecrawl" and managed_web_available and not direct_firecrawlweb_active = bool(web_tool_enabled@@ -632,7 +639,7 @@ def get_nous_subscription_features(or (web_backend == "exa" and direct_exa)or (web_backend == "firecrawl" and direct_firecrawl)or (web_backend == "parallel" and direct_parallel)- or (web_backend == "tavily" and direct_tavily)+ or (web_backend == "tavily" and tavily_ready)or (web_backend == "searxng" and direct_searxng)# Per-capability overrides: search_backend or extract_backend may be set# without web.backend (using the new split config from #20061)@@ -640,11 +647,17 @@ def get_nous_subscription_features(or (web_search_backend == "exa" and direct_exa)or (web_search_backend == "firecrawl" and direct_firecrawl)or (web_search_backend == "parallel" and direct_parallel)- or (web_search_backend == "tavily" and direct_tavily)+ or (web_search_backend == "tavily" and tavily_ready)+ or (web_extract_backend == "tavily" and tavily_ready)))web_available = bool(- managed_web_available or direct_exa or direct_firecrawl or direct_parallel or direct_tavily or direct_searxng+ managed_web_available+ or direct_exa+ or direct_firecrawl+ or direct_parallel+ or tavily_ready+ or direct_searxng)image_managed = image_tool_enabled and managed_image_available and not direct_fal@@ -754,8 +767,8 @@ def get_nous_subscription_features(managed_by_nous=web_managed,direct_override=web_active and not web_managed,toolset_enabled=web_tool_enabled,- current_provider=web_backend or web_search_backend or "",- explicit_configured=bool(web_backend or web_search_backend),+ current_provider=web_backend or web_search_backend or web_extract_backend or "",+ explicit_configured=bool(web_backend or web_search_backend or web_extract_backend),),"image_gen": NousFeatureState(key="image_gen",diff --git a/plugins/web/tavily/provider.py b/plugins/web/tavily/provider.pyindex 06c31281f1a..079a67e7520 100644--- a/plugins/web/tavily/provider.py+++ b/plugins/web/tavily/provider.py@@ -227,7 +227,7 @@ class TavilyWebSearchProvider(WebSearchProvider):def get_setup_schema(self) -> Dict[str, Any]:return {"name": "Tavily",- "badge": "free | key optional",+ "badge": "free · key optional","tag": "Search + extract. Works keyless; set TAVILY_API_KEY for higher limits.","env_vars": [{diff --git a/tests/hermes_cli/test_nous_subscription.py b/tests/hermes_cli/test_nous_subscription.pyindex 73f680d3d16..db602ff42cc 100644--- a/tests/hermes_cli/test_nous_subscription.py+++ b/tests/hermes_cli/test_nous_subscription.py@@ -58,8 +58,67 @@ def test_get_nous_subscription_features_recognizes_direct_exa_backend(monkeypatcassert features.web.current_provider == "exa"+def test_get_nous_subscription_features_recognizes_keyless_tavily_backend(monkeypatch):+ """Selecting Tavily in setup/tools counts as available with no API key.+ Mirrors tools.web_tools._is_backend_available('tavily'): keyless is+ opt-in via web.backend / search_backend / extract_backend, not a+ silent empty-install default. The setup summary previously required+ TAVILY_API_KEY and printed a false 'missing' after a skipped key prompt.+ """+ monkeypatch.setattr(ns, "get_env_value", lambda name: "")+ monkeypatch.setattr(+ ns, "get_nous_portal_account_info", lambda: _account(logged_in=False)+ )+ monkeypatch.setattr(ns, "_toolset_enabled", lambda config, key: key == "web")+ monkeypatch.setattr(ns, "_has_agent_browser", lambda: False)+ monkeypatch.setattr(ns, "resolve_openai_audio_api_key", lambda: "")+ monkeypatch.setattr(ns, "has_direct_modal_credentials", lambda: False)++ features = ns.get_nous_subscription_features({"web": {"backend": "tavily"}})++ assert features.web.available is True+ assert features.web.active is True+ assert features.web.managed_by_nous is False+ assert features.web.direct_override is True+ assert features.web.current_provider == "tavily"+ assert features.web.explicit_configured is True+++def test_keyless_tavily_search_backend_without_shared_backend(monkeypatch):+ monkeypatch.setattr(ns, "get_env_value", lambda name: "")+ monkeypatch.setattr(+ ns, "get_nous_portal_account_info", lambda: _account(logged_in=False)+ )+ monkeypatch.setattr(ns, "_toolset_enabled", lambda config, key: key == "web")+ monkeypatch.setattr(ns, "_has_agent_browser", lambda: False)+ monkeypatch.setattr(ns, "resolve_openai_audio_api_key", lambda: "")+ monkeypatch.setattr(ns, "has_direct_modal_credentials", lambda: False)++ features = ns.get_nous_subscription_features(+ {"web": {"search_backend": "tavily"}}+ )++ assert features.web.available is True+ assert features.web.active is True+ assert features.web.current_provider == "tavily"+++def test_unconfigured_web_without_keys_is_unavailable(monkeypatch):+ monkeypatch.setattr(ns, "get_env_value", lambda name: "")+ monkeypatch.setattr(+ ns, "get_nous_portal_account_info", lambda: _account(logged_in=False)+ )+ monkeypatch.setattr(ns, "_toolset_enabled", lambda config, key: key == "web")+ monkeypatch.setattr(ns, "_has_agent_browser", lambda: False)+ monkeypatch.setattr(ns, "resolve_openai_audio_api_key", lambda: "")+ monkeypatch.setattr(ns, "has_direct_modal_credentials", lambda: False)++ features = ns.get_nous_subscription_features({})+ assert features.web.available is False+ assert features.web.active is False+ assert features.web.explicit_configured is Falsedef _stub_browser_probes(monkeypatch, *, has_agent_browser, chromium, lightpanda=False):"""Common monkeypatches for local-browser readiness scenarios.