{"record":{"id":"3a384cb94d2d7f18","repo":"agentscope-ai/agentscope","slug":"rememiddleware-requires-the-reme-ai-package-in","errorCode":null,"errorMessage":"\"ReMeMiddleware requires the `reme-ai` package. Install it with `pip install \\\"agentscope[memory-reme]\\\"` (or `pip install reme-ai`).\"","messagePattern":"\"ReMeMiddleware requires the `reme-ai` package\\. Install it with `pip install \\\\\"agentscope\\[memory-reme\\]\\\\\"` \\(or `pip install reme-ai`\\)\\.\"","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"src/agentscope/middleware/_longterm_memory/_reme/_middleware.py","lineNumber":237,"sourceCode":"        # finally). Keyed by ``session_id`` so one middleware shared across\n        # agents keeps each session's retrieval isolated — a concurrent reply\n        # in another session never clobbers this one's task.\n        self._retrieval_tasks: dict[Any, asyncio.Task] = {}\n\n    # ==================================================================\n    # Embedded ReMe application lifecycle\n    # ==================================================================\n    def _build_app(self) -> Any:\n        \"\"\"Lazily build the embedded :class:`reme.ReMe` application.\n\n        Raises:\n            ImportError:\n                If ``reme-ai`` is not installed.\n        \"\"\"\n        try:\n            from reme import ReMe\n        except ImportError as e:  # pragma: no cover - import guard\n            raise ImportError(\n                \"ReMeMiddleware requires the `reme-ai` package. Install \"\n                'it with `pip install \"agentscope[memory-reme]\"` (or '\n                \"`pip install reme-ai`).\",\n            ) from e\n\n        embedding_dimensions = None\n        if self._parameters.embedding_model is not None:\n            embedding_dimensions = self._parameters.embedding_model.dimensions\n        app_config = _build_reme_app_config(\n            workspace_dir=self._workspace_dir,\n            embedding_dimensions=embedding_dimensions,\n        )\n        return ReMe(**app_config)\n\n    async def _ensure_started(self) -> None:\n        \"\"\"Build (if needed) and start the embedded app (idempotent).\n\n        The configured ``chat_model`` / ``embedding_model`` are injected","sourceCodeStart":219,"sourceCodeEnd":255,"githubUrl":"https://github.com/agentscope-ai/agentscope/blob/e90f1c7592896cc95f6e5ee506194f533378247d/src/agentscope/middleware/_longterm_memory/_reme/_middleware.py#L219-L255","documentation":"ReMeMiddleware delegates to the optional reme-ai package; on first start it imports reme.ReMe and re-raises ImportError with install instructions if the extra is missing.","triggerScenarios":"Constructing/starting ReMeMiddleware without reme-ai installed, e.g. plain `pip install agentscope`.","commonSituations":"Using the memory-reme feature without its extra; CI environments that install only core deps; transitive dependency pruning.","solutions":["pip install \"agentscope[memory-reme]\"","Or pip install reme-ai directly","Verify with python -c \"import reme\" before enabling ReMeMiddleware"],"exampleFix":"# before\npip install agentscope\n# after\npip install \"agentscope[memory-reme]\"","handlingStrategy":"validation","validationCode":"try:\n    import reme  # noqa\nexcept ImportError:\n    raise SystemExit('Install with: pip install \"agentscope[memory-reme]\"')","typeGuard":null,"tryCatchPattern":"try:\n    mw = ReMeMiddleware(...)\nexcept ImportError as e:\n    if 'reme-ai' in str(e):\n        subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'reme-ai'])\n        mw = ReMeMiddleware(...)\n    else:\n        raise","preventionTips":["Declare agentscope[memory-reme] in project dependencies when using ReMe","Gate ReMe features behind an import check with a friendly message"],"tags":["agentscope","reme","import-error","optional-dependency"],"backgroundTag":"missing-optional-dependency","analyzedSha":"e90f1c7592896cc95f6e5ee506194f533378247d","analyzedAt":"2026-08-28T18:24:12.087Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}