langchain-ai/deepagents · error · TypeError
`history_path_prefix` was removed in deepagents 0.7. Configu
Error message
`history_path_prefix` was removed in deepagents 0.7. Configure `CompositeBackend.artifacts_root` instead.
What it means
`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.
Source
Thrown at libs/deepagents/deepagents/middleware/summarization.py:579
Raises:
TypeError: If the removed `history_path_prefix` argument is provided.
Example:
```python
from deepagents.middleware.summarization import SummarizationMiddleware
from deepagents.backends import StateBackend
middleware = SummarizationMiddleware(
model="gpt-5.5",
backend=StateBackend(),
trigger=("tokens", 100000),
keep=("messages", 20),
)
```
"""
if "history_path_prefix" in deprecated_kwargs:
msg = "`history_path_prefix` was removed in deepagents 0.7. Configure `CompositeBackend.artifacts_root` instead."
raise TypeError(msg)
# Initialize langchain helper for core summarization logic
self._lc_helper = LCSummarizationMiddleware(
model=model,
trigger=trigger,
keep=keep,
token_counter=token_counter,
summary_prompt=summary_prompt,
trim_tokens_to_summarize=trim_tokens_to_summarize,
**deprecated_kwargs,
)
# Whether the configured token counter accepts a `tools` kwarg. Resolved
# once here (the counter is fixed after construction) so the per-call
# token count never pays signature-introspection cost. `None` means the
# signature could not be introspected, so `_count_tokens` probes instead.
self._counter_accepts_tools = _token_counter_accepts_tools(self.token_counter)
View on GitHub (pinned to a1af029e6e)
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
Example fix
// before SummarizationMiddleware(model=m, history_path_prefix="/tmp/history", trigger=...) // after backend = CompositeBackend(artifacts_root="/tmp/artifacts") SummarizationMiddleware(model=m, backend=backend, trigger=...)
Defensive patterns
Strategy: validation
Validate before calling
legacy = kwargs.pop("history_path_prefix", None)
if legacy is not None:
backend = CompositeBackend(artifacts_root=legacy)
kwargs["backend"] = backend Type guard
def uses_removed_kwargs(kwargs: dict) -> bool:
return "history_path_prefix" in kwargs Try / catch
try:
mw = SummarizationMiddleware(**kwargs)
except TypeError as e:
if "history_path_prefix" in str(e):
logger.error("migrate to CompositeBackend.artifacts_root per 0.7 release notes")
raise Prevention
- 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
When it happens
Trigger: Passing `history_path_prefix=...` to `SummarizationMiddleware(...)` after upgrading to deepagents 0.7+.
Common situations: Upgrading from pre-0.7 code without reading the changelog; copied snippets from older tutorials/docs; kwargs splatted from legacy config dicts.
Related errors
- `create_summarization_middleware` expects `model` to be a `B
- system_prompt must be str or None, got {type(system_prompt).
- module {__name__!r} has no attribute {name!r}
- backend must be an initialized backend instance. Backend fac
- Received unsupported arguments: {list(kwargs.keys())}
AI-assisted analysis of langchain-ai/deepagents@a1af029e6e (2026-08-29).
Data as JSON: /api/errors/50391e31ec452c93.
Report an issue: GitHub.