diff --git a/plugins/memory/hindsight/__init__.py b/plugins/memory/hindsight/__init__.py index c40a65b3f..26c60bb9e 100644 --- a/plugins/memory/hindsight/__init__.py +++ b/plugins/memory/hindsight/__init__.py @@ -304,7 +304,11 @@ class HindsightMemoryProvider(MemoryProvider): mode = cfg.get("mode", "cloud") if mode in ("local", "local_embedded", "local_external"): return True - has_key = bool(cfg.get("apiKey") or os.environ.get("HINDSIGHT_API_KEY", "")) + has_key = bool( + cfg.get("apiKey") + or cfg.get("api_key") + or os.environ.get("HINDSIGHT_API_KEY", "") + ) has_url = bool(cfg.get("api_url") or os.environ.get("HINDSIGHT_API_URL", "")) return has_key or has_url except Exception: diff --git a/tests/plugins/memory/test_hindsight_provider.py b/tests/plugins/memory/test_hindsight_provider.py index d916b2505..45fbab3de 100644 --- a/tests/plugins/memory/test_hindsight_provider.py +++ b/tests/plugins/memory/test_hindsight_provider.py @@ -628,3 +628,19 @@ class TestAvailability: monkeypatch.setenv("HINDSIGHT_MODE", "local") p = HindsightMemoryProvider() assert p.is_available() + + def test_available_with_snake_case_api_key_in_config(self, tmp_path, monkeypatch): + config_path = tmp_path / "hindsight" / "config.json" + config_path.parent.mkdir(parents=True, exist_ok=True) + config_path.write_text(json.dumps({ + "mode": "cloud", + "api_key": "config-key", + })) + monkeypatch.setattr( + "plugins.memory.hindsight.get_hermes_home", + lambda: tmp_path, + ) + + p = HindsightMemoryProvider() + + assert p.is_available()