{"record":{"id":"50391e31ec452c93","repo":"langchain-ai/deepagents","slug":"history-path-prefix-was-removed-in-deepagents-0","errorCode":null,"errorMessage":"`history_path_prefix` was removed in deepagents 0.7. Configure `CompositeBackend.artifacts_root` instead.","messagePattern":"`history_path_prefix` was removed in deepagents 0\\.7\\. Configure `CompositeBackend\\.artifacts_root` instead\\.","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"libs/deepagents/deepagents/middleware/summarization.py","lineNumber":579,"sourceCode":"        Raises:\n            TypeError: If the removed `history_path_prefix` argument is provided.\n\n        Example:\n            ```python\n            from deepagents.middleware.summarization import SummarizationMiddleware\n            from deepagents.backends import StateBackend\n\n            middleware = SummarizationMiddleware(\n                model=\"gpt-5.5\",\n                backend=StateBackend(),\n                trigger=(\"tokens\", 100000),\n                keep=(\"messages\", 20),\n            )\n            ```\n        \"\"\"\n        if \"history_path_prefix\" in deprecated_kwargs:\n            msg = \"`history_path_prefix` was removed in deepagents 0.7. Configure `CompositeBackend.artifacts_root` instead.\"\n            raise TypeError(msg)\n\n        # Initialize langchain helper for core summarization logic\n        self._lc_helper = LCSummarizationMiddleware(\n            model=model,\n            trigger=trigger,\n            keep=keep,\n            token_counter=token_counter,\n            summary_prompt=summary_prompt,\n            trim_tokens_to_summarize=trim_tokens_to_summarize,\n            **deprecated_kwargs,\n        )\n\n        # Whether the configured token counter accepts a `tools` kwarg. Resolved\n        # once here (the counter is fixed after construction) so the per-call\n        # token count never pays signature-introspection cost. `None` means the\n        # signature could not be introspected, so `_count_tokens` probes instead.\n        self._counter_accepts_tools = _token_counter_accepts_tools(self.token_counter)\n","sourceCodeStart":561,"sourceCodeEnd":597,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/deepagents/deepagents/middleware/summarization.py#L561-L597","documentation":"`SummarizationMiddleware.__init__` hard-fails when it detects `history_path_prefix` among its kwargs. That option was removed in deepagents 0.7; storage rooted at a path is now configured via `CompositeBackend.artifacts_root`, so the old kwarg is rejected with `TypeError` to surface the migration immediately.","triggerScenarios":"Passing `history_path_prefix=...` to `SummarizationMiddleware(...)` after upgrading to deepagents 0.7+.","commonSituations":"Upgrading from pre-0.7 code without reading the changelog; copied snippets from older tutorials/docs; kwargs splatted from legacy config dicts.","solutions":["Remove `history_path_prefix` from the call","Configure `CompositeBackend(artifacts_root=...)` and pass that backend to the middleware instead","Pin deepagents <0.7 only as a short-term stopgap while migrating"],"exampleFix":"// before\nSummarizationMiddleware(model=m, history_path_prefix=\"/tmp/history\", trigger=...)\n// after\nbackend = CompositeBackend(artifacts_root=\"/tmp/artifacts\")\nSummarizationMiddleware(model=m, backend=backend, trigger=...)","handlingStrategy":"validation","validationCode":"legacy = kwargs.pop(\"history_path_prefix\", None)\nif legacy is not None:\n    backend = CompositeBackend(artifacts_root=legacy)\n    kwargs[\"backend\"] = backend","typeGuard":"def uses_removed_kwargs(kwargs: dict) -> bool:\n    return \"history_path_prefix\" in kwargs","tryCatchPattern":"try:\n    mw = SummarizationMiddleware(**kwargs)\nexcept TypeError as e:\n    if \"history_path_prefix\" in str(e):\n        logger.error(\"migrate to CompositeBackend.artifacts_root per 0.7 release notes\")\n    raise","preventionTips":["Read the changelog when bumping deepagents minor versions","Strip or translate legacy kwargs at the config-loading layer","Grep the codebase for removed kwargs as part of dependency upgrades"],"tags":["python","summarization","deprecated-api","migration","typeerror"],"backgroundTag":"removed-api-migration","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}