From 7dde988efcf6ca3a413a8ed03dacda05031fffdd Mon Sep 17 00:00:00 2001 From: 0xallam Date: Sat, 14 Mar 2026 11:31:40 -0700 Subject: [PATCH] fix: web_search tool not loading when API key is in config file The perplexity API key check in strix/tools/__init__.py used Config.get() which only checks os.environ. At import time, the config file (~/.strix/cli-config.json) hasn't been applied to env vars yet, so the check always returned False. Replace with _has_perplexity_api() that checks os.environ first (fast path for SaaS/env var), then falls back to Config.load() which reads the config file directly. --- strix/tools/__init__.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/strix/tools/__init__.py b/strix/tools/__init__.py index 1c49472..8e92f6c 100644 --- a/strix/tools/__init__.py +++ b/strix/tools/__init__.py @@ -24,9 +24,22 @@ from .registry import ( SANDBOX_MODE = os.getenv("STRIX_SANDBOX_MODE", "false").lower() == "true" -HAS_PERPLEXITY_API = bool(Config.get("perplexity_api_key")) -DISABLE_BROWSER = (Config.get("strix_disable_browser") or "false").lower() == "true" +def _is_browser_disabled() -> bool: + if os.getenv("STRIX_DISABLE_BROWSER", "").lower() == "true": + return True + val: str = Config.load().get("env", {}).get("STRIX_DISABLE_BROWSER", "") + return str(val).lower() == "true" + + +DISABLE_BROWSER = _is_browser_disabled() + + +def _has_perplexity_api() -> bool: + if os.getenv("PERPLEXITY_API_KEY"): + return True + return bool(Config.load().get("env", {}).get("PERPLEXITY_API_KEY")) + if not SANDBOX_MODE: from .agents_graph import * # noqa: F403 @@ -43,7 +56,7 @@ if not SANDBOX_MODE: from .thinking import * # noqa: F403 from .todo import * # noqa: F403 - if HAS_PERPLEXITY_API: + if _has_perplexity_api(): from .web_search import * # noqa: F403 else: if not DISABLE_BROWSER: