Build and run agents you can see, understand and trust.
Python agentchatbotlarge-language-modelsllmllm-agentmcpmulti-agentmulti-modalreact-agentrealtime-agentvoice-agentvoice-assistant
fix(memory): remove obsolete ReMe dream step (#3851)
Aman0b4e3d6d0b63
diff --git a/examples/long_term_memory/reme/README.md b/examples/long_term_memory/reme/README.mdindex 76d849b63..68bc737d6 100644--- a/examples/long_term_memory/reme/README.md+++ b/examples/long_term_memory/reme/README.md@@ -175,7 +175,9 @@ the full memory lifecycle: conversation write-back, nightly/manual dreamconsolidation from daily cards into digest memory, and search across both dailyand digest memory. Only the file/index jobs required by that lifecycle areregistered; ReMe's resource ingestion, independent chat, daily-paper and-operational jobs are not loaded. Search is **BM25-only** unless an+operational jobs are not loaded. Dream consolidates daily cards into digest+nodes; ReMe's separate proactive topic generation and tag indexing are not+part of this embedded configuration. Search is **BM25-only** unless an`embedding_model` is provided:```pythondiff --git a/src/agentscope/middleware/_longterm_memory/_reme/_config.py b/src/agentscope/middleware/_longterm_memory/_reme/_config.pyindex 988e6d63f..623375aac 100644--- a/src/agentscope/middleware/_longterm_memory/_reme/_config.py+++ b/src/agentscope/middleware/_longterm_memory/_reme/_config.py@@ -62,11 +62,6 @@ def _dream_steps() -> list[dict[str, Any]]:"max_units": 5,},{"backend": "dream_integrate_step"},- {- "backend": "dream_topics_step",- "topic_count": 3,- "topic_diversity_days": 7,- },{"backend": "dream_finish_step","file_catalog": "dream",@@ -159,8 +154,7 @@ def _memory_jobs() -> dict[str, Any]:"auto_dream": {"backend": "base","description": (- "Consolidate daily conversation memory into digest nodes "- "and interest topics."+ "Consolidate daily conversation memory into digest nodes."),"parameters": _object_schema({diff --git a/tests/reme_middleware_test.py b/tests/reme_middleware_test.pyindex c83f40fbb..a32bbead8 100644--- a/tests/reme_middleware_test.py+++ b/tests/reme_middleware_test.py@@ -2,10 +2,11 @@# pylint: disable=protected-access,unused-argument"""Unit tests for ReMeMiddleware.-The embedded ReMe app is mocked — we only exercise the AgentScope hook+Most tests mock the embedded ReMe app and exercise the AgentScope hookwiring (retrieve-before / write-after, system-prompt injection,list_tools exposure) and the small adapters that translate between-AgentScope and ReMe. No real ReMe application is built.+AgentScope and ReMe. An optional smoke test starts the real ReMe app+without network access when reme-ai is installed.``protected-access`` is disabled because tests legitimately reach intomiddleware internals (``mw._app``, ``mw._search``, ``mw._session_id_of``)@@ -14,6 +15,9 @@ to inspect what the public API just did.import sysimport typesimport asyncio+import importlib.util+import socket+from tempfile import TemporaryDirectoryfrom unittest import mockfrom unittest.async_case import IsolatedAsyncioTestCasefrom typing import Any@@ -516,10 +520,24 @@ class TestConstructorValidation(IsolatedAsyncioTestCase):self.assertNotIn("resource_watch_loop", captured["jobs"])self.assertNotIn("digest_watch_loop", captured["jobs"])self.assertNotIn("daily_paper", captured["jobs"])- self.assertEqual(- captured["jobs"]["dream_cron"]["steps"],- captured["jobs"]["auto_dream"]["steps"],- )+ for name in ("dream_cron", "auto_dream"):+ self.assertEqual(+ captured["jobs"][name]["steps"],+ [+ {+ "backend": "dream_extract_step",+ "file_catalog": "dream",+ "topic_session_id": "interests",+ "scan_days": 2,+ "max_units": 5,+ },+ {"backend": "dream_integrate_step"},+ {+ "backend": "dream_finish_step",+ "file_catalog": "dream",+ },+ ],+ )self.assertEqual(captured["jobs"]["index_update_loop"]["watch_dirs"],["daily_dir", "digest_dir"],@@ -622,6 +640,40 @@ class TestConstructorValidation(IsolatedAsyncioTestCase):class TestAppLifecycle(IsolatedAsyncioTestCase):"""Tests for the lazily built embedded app's one-time start."""+ async def test_real_app_starts_without_network(self) -> None:+ """Resolve real backends and close the app without model calls."""+ if importlib.util.find_spec("reme") is None:+ self.skipTest("reme-ai is not installed")+ from reme import ReMe++ with (+ TemporaryDirectory() as workspace,+ mock.patch.dict(+ "os.environ",+ {+ "LLM_API_KEY": "test",+ "LLM_BASE_URL": "https://example.invalid/v1",+ },+ clear=True,+ ),+ mock.patch.object(+ socket.socket,+ "connect",+ side_effect=AssertionError("Unexpected network access"),+ ) as connect,+ ):+ app = ReMe(+ log_to_file=False,+ **_build_reme_app_config(workspace_dir=workspace),+ )+ try:+ await asyncio.wait_for(app.start(), timeout=10)+ self.assertTrue(app.is_started)+ finally:+ await asyncio.wait_for(app.close(), timeout=10)+ self.assertFalse(app.is_started)+ connect.assert_not_called()+async def test_concurrent_callers_start_the_app_once(self) -> None:"""Hooks that run before the app is started must start it once."""