Skip to content

FinceptTerminal is a modern finance application offering advanced market analytics, investment research, and economic data tools, designed for interactive exploration and data-driven decision-making in a user-friendly environment.

refactor(finagent): clean up AgenticMemoryModule imports and tests

tilakpatel2284b21522632b
diff --git a/fincept-qt/scripts/agents/finagent_core/modules/memory_module.py b/fincept-qt/scripts/agents/finagent_core/modules/memory_module.py
index 9cfb0be3e..89b778017 100644
--- a/fincept-qt/scripts/agents/finagent_core/modules/memory_module.py
+++ b/fincept-qt/scripts/agents/finagent_core/modules/memory_module.py
@@ -11,10 +11,13 @@ Provides:
"""
from typing import Dict, Any, Optional, List, Callable
+from pathlib import Path
import logging
import json
from datetime import datetime
+from finagent_core import resources
+
logger = logging.getLogger(__name__)
@@ -323,16 +326,15 @@ class AgenticMemoryModule:
Args:
user_id: User ID
+ agent_id: Agent ID
db_path: Database path
enable_auto_store: Allow agent to auto-store
max_memories: Maximum memories to keep
"""
- from finagent_core import resources
self.user_id = user_id
self.agent_id = agent_id
self.db_path = db_path or resources.agentic_memory_db(user_id, agent_id)
- from pathlib import Path as _P
- _P(self.db_path).parent.mkdir(parents=True, exist_ok=True)
+ Path(self.db_path).parent.mkdir(parents=True, exist_ok=True)
self.enable_auto_store = enable_auto_store
self.max_memories = max_memories
diff --git a/fincept-qt/scripts/agents/finagent_core/tests/test_agentic_memory_isolation.py b/fincept-qt/scripts/agents/finagent_core/tests/test_agentic_memory_isolation.py
index e4b711390..e81a4a77a 100644
--- a/fincept-qt/scripts/agents/finagent_core/tests/test_agentic_memory_isolation.py
+++ b/fincept-qt/scripts/agents/finagent_core/tests/test_agentic_memory_isolation.py
@@ -1,5 +1,3 @@
-import os
-
import pytest
from finagent_core.modules.memory_module import AgenticMemoryModule
@@ -46,5 +44,6 @@ def test_explicit_db_path_overrides_default(monkeypatch, tmp_path):
mod = AgenticMemoryModule.from_config(
{"user_id": "alice", "agent_id": "x", "db_path": str(custom)}
)
+ assert mod.db_path == str(custom)
mod.store("hello", memory_type="fact")
assert custom.exists()