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

  1. Remove `history_path_prefix` from the call
  2. Configure `CompositeBackend(artifacts_root=...)` and pass that backend to the middleware instead
  3. 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

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


AI-assisted analysis of langchain-ai/deepagents@a1af029e6e (2026-08-29). Data as JSON: /api/errors/50391e31ec452c93. Report an issue: GitHub.