langchain-ai/deepagents · error · AttributeError
{type(helper).__name__} exposes no {name!r} slot, so dcode c
Error message
{type(helper).__name__} exposes no {name!r} slot, so dcode cannot {purpose}. The SDK's summarization internals have changed. What it means
dcode installs retry, trim-limit, token-counter, and lazy-model behavior onto LangChain's `SummarizationMiddleware` internals via private attribute slots. `_require_helper_slot` verifies a private attribute exists before patching; when the helper class no longer exposes the expected slot, it raises AttributeError naming the missing slot. This means the pinned SDK's summarization implementation changed shape and dcode's monkeypatching can no longer proceed safely.
Source
Thrown at libs/code/deepagents_code/offload_middleware.py:154
nothing reads, leaving the SDK's own behavior in place -- a silent no-op
that reports nothing. Checking first turns that into a loud failure.
Args:
helper: The SDK summarization helper being patched.
name: Attribute dcode is about to overwrite.
purpose: What dcode loses if the slot is gone, phrased to follow
"so dcode cannot ...".
Raises:
AttributeError: If the SDK no longer exposes the named slot.
"""
if hasattr(helper, name):
return
msg = (
f"{type(helper).__name__} exposes no {name!r} slot, so dcode cannot "
f"{purpose}. The SDK's summarization internals have changed."
)
raise AttributeError(msg)
def _install_summary_model_retries(
summarization: SummarizationMiddleware,
model: BaseChatModel | None = None,
) -> None:
"""Replace LangChain's generic summary retries with dcode's exact policy.
Also selects the model summaries are generated with, which is the only
place a `--summarization-model` override takes effect.
Args:
summarization: Middleware whose summary-model slot is replaced.
model: Model to generate summaries with. `None` reuses
`summarization.model`, the model driving thresholds and counting.
"""
helper = summarization._lc_helper
# A renamed slot would leave LangChain's unconditional three-attemptView on GitHub (pinned to a1af029e6e)
Solutions
- Pin the `deepagents` version dcode expects (exact pin in libs/code pyproject.toml).
- Update dcode's `_install_*` helpers to the new private attribute names in the upgraded SDK, then bump the pin in the same PR.
- Clear stale installs: reinstall dcode so the editable/installed SDK matches the pin.
Example fix
// before: patching a renamed slot
_install_summary_token_counter(summarization, counter) # AttributeError
// after: guard or update to the new slot name
if hasattr(summarization, "_token_counter_new"):
setattr(summarization, "_token_counter_new", counter) Defensive patterns
Strategy: type-guard
Validate before calling
for slot in ("_model", "_trim_tokens", "_token_counter"):
assert hasattr(summarization, slot), f"{type(summarization).__name__} missing {slot!r}"
assert deepagents_version == pinned_version, "SDK drift vs dcode pin" Type guard
def supports_summarization_slots(helper: object, slots: tuple[str, ...]) -> bool:
return all(hasattr(helper, s) for s in slots) Try / catch
try:
install_summary_helpers(summarization)
except AttributeError as e:
if "exposes no" in str(e):
raise SdkPinMismatch(str(e)) from e # surface pin drift, not a crash Prevention
- Keep the exact `deepagents==X.Y.Z` pin and bump it in the same PR as any internal-slot change.
- Add a canary test asserting the private slots exist on SummarizationMiddleware.
- Avoid editable installs against mismatched workspace SDKs in dev.
When it happens
Trigger: Raising an SDK pin (`deepagents` / langchain SummarizationMiddleware) to a version that renamed or removed private attributes targeted by `_install_summary_model_retries`, `_install_summary_trim_limit`, `_install_summary_token_counter`, or `_install_lazy_summary_model`.
Common situations: Upgrading `deepagents` in pyproject without updating offload_middleware internals; using a fork or prerelease SDK with refactored summarization classes; running dcode-dev against a workspace SDK newer than the pin.
Related errors
AI-assisted analysis of langchain-ai/deepagents@a1af029e6e (2026-08-29).
Data as JSON: /api/errors/47d23b52ba8d3aa6.
Report an issue: GitHub.