langchain-ai/deepagents · warning
<dynamic deprecation warning message from captured record>
Error message
<dynamic deprecation warning message from captured record>
What it means
This is a LangChainDeprecationWarning emitted by deepagents' `warn_deprecated` helper (a wrapper around `langchain_core._api.deprecation.warn_deprecated`). It fires when your code calls an API, parameter, or value that deepagents has deprecated; the wrapper re-emits the upstream-formatted warning with a corrected stacklevel so it points at your actual call site. It is informational: the API still works, but it will be removed (or has a scheduled removal version).
Source
Thrown at libs/deepagents/deepagents/_api/deprecation.py:97
"""
with warnings.catch_warnings(record=True) as captured:
warnings.simplefilter("always")
_lc_warn_deprecated(
since,
message=message,
name=name,
alternative=alternative,
alternative_import=alternative_import,
pending=pending,
obj_type=obj_type,
addendum=addendum,
removal=removal,
package=package,
)
if not captured:
return
record = captured[0]
warnings.warn(record.message, category=record.category, stacklevel=stacklevel + 1)
def reset_deprecation_dedupe(*targets: object) -> None:
"""Reset the `@deprecated` decorator's dedupe flag for testing.
The langchain_core `@deprecated` decorator emits each warning at most once
per process via a closure-bound `warned` flag. Tests that assert per-call
emission must reset that flag between cases — otherwise the assertions
become reorder-sensitive (notably under `pytest -n auto`).
Accepts decorated functions, methods, and `property` objects (in which
case the `fget` closure is reset). Targets without the expected `warned`
freevar are silently skipped, so passing non-decorated callables is safe.
Args:
*targets: Decorated callables (or properties wrapping them) to reset.
"""
for target in targets:View on GitHub (pinned to a1af029e6e)
Solutions
- Read the warning message: it names the deprecated object, the `since` version, and the recommended `alternative`/`alternative_import`.
- Migrate to the suggested replacement (new parameter name, new import path, or new function).
- If the warning comes from a third-party dependency you cannot change, silence it narrowly with `warnings.filterwarnings('ignore', category=LangChainDeprecationWarning, message='...')` scoped to the offending call.
- Pin the current deepagents version temporarily if you cannot migrate yet, and plan the migration before the stated removal version.
Example fix
// before from deepagents import old_module agent = old_module.create_deep_agent(tools=tools, deprecated_param=True) // after from deepagents import create_deep_agent agent = create_deep_agent(tools=tools, new_param=True)
Defensive patterns
Strategy: try-catch
Validate before calling
// check for deprecated usage before calling
import warnings
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("always")
result = call_api(...)
deprecations = [x for x in w if issubclass(x.category, DeprecationWarning)]
assert not deprecations, [str(x.message) for x in deprecations] Type guard
null
Try / catch
import warnings
from deepagents._api.deprecation import LangChainDeprecationWarning
with warnings.catch_warnings():
warnings.filterwarnings("error", category=LangChainDeprecationWarning)
try:
result = call_api(...)
except LangChainDeprecationWarning as dw:
migrate_to(dw.message) # warning text names the alternative
result = call_api(...) Prevention
- Run CI with `-W error::DeprecationWarning` to catch deprecated usage at test time.
- Check the changelog/upgrading guide when bumping deepagents minor versions.
- Prefer the import paths and parameter names shown in current docs over old snippets.
- Pin and review deprecation warnings in dependency update PRs.
When it happens
Trigger: Any call into deepagents code that invokes `warn_deprecated` internally: accessing a module-level `__getattr__` alias for a moved symbol, calling `create_deep_agent` with a deprecated parameter/value, calling a function or property wrapped in `@deprecated`, or calling an internal `helper` marked deprecated. Emission is deduped per process by the `@deprecated` decorator's `warned` closure flag (resettable via `reset_deprecation_dedupe` for tests).
Common situations: Upgrading deepagents past a version that renamed `create_deep_agent` parameters or moved public symbols; importing a symbol from its old module path; test suites that surface DeprecationWarning because `filterwarnings = error` is enabled; running old example/snippet code against a newer release.
Related errors
- modes can only be provided when agent is a factory
- models can only be provided when agent is a factory
- -32601
- -32002
- -32602
AI-assisted analysis of langchain-ai/deepagents@a1af029e6e (2026-08-29).
Data as JSON: /api/errors/1770cd89e76cfc3f.
Report an issue: GitHub.