langchain-ai/deepagents · error · AttributeError
module {__name__!r} has no attribute {name!r}
Error message
module {__name__!r} has no attribute {name!r} What it means
deepagents.graph implements module __getattr__ to lazily provide legacy attributes with deprecation warnings. When the requested attribute is not a known legacy export, the module raises a standard AttributeError saying the module has no such attribute.
Source
Thrown at libs/deepagents/deepagents/graph.py:137
def __getattr__(name: str) -> str:
"""Provide deprecated compatibility access to legacy module attributes."""
if name == "BASE_AGENT_PROMPT":
warn_deprecated(
since="0.7.0",
removal="0.9.0",
message=(
"`BASE_AGENT_PROMPT` was deprecated in `deepagents==0.7.0` and "
"will be removed in `deepagents==0.9.0`. Deep Agents no longer "
"provides an "
"authored base prompt."
),
package="deepagents",
)
return _LEGACY_BASE_AGENT_PROMPT
msg = f"module {__name__!r} has no attribute {name!r}"
raise AttributeError(msg)
def _build_default_model() -> ChatAnthropic:
"""Construct the default model without emitting a deprecation warning.
Internal helper used by `create_deep_agent` so the parameter-level
`model=None` warning isn't paired with a separate function-level warning
from `get_default_model`. Direct user calls go through `get_default_model`,
which keeps its decorator and warns once per process.
"""
return ChatAnthropic(model_name="claude-sonnet-4-6")
@deprecated(
since="0.5.3",
removal="1.0.0",
message=(
"Relying on the default model is deprecated and will be removed in "View on GitHub (pinned to a1af029e6e)
Solutions
- Use the current symbol, commonly create_deep_agent from the top-level package.
- Update imports per the changelog/migration guide.
- Run dir(deepagents.graph) to see available attributes.
- Pin the older deepagents version temporarily if the legacy symbol is required.
Example fix
// before from deepagents.graph import create_agent // after from deepagents import create_deep_agent
Defensive patterns
Strategy: try-catch
Validate before calling
import deepagents.graph as g
if not hasattr(g, "create_agent"):
from deepagents import create_deep_agent # current API Type guard
def graph_has(name: str) -> bool:
import deepagents.graph as g
return hasattr(g, name) Try / catch
try:
from deepagents.graph import create_agent
except AttributeError:
from deepagents import create_deep_agent as create_agent Prevention
- Import public entry points from the top-level deepagents package, not internal modules.
- Check the changelog after every deepagents upgrade for renamed/removed exports.
- Run mypy/pyright so stale imports fail at type-check time.
- Treat module-level __getattr__ deprecation warnings as prompts to migrate immediately.
When it happens
Trigger: Importing or accessing an attribute on deepagents.graph that no longer exists — e.g. `from deepagents.graph import SomeRemovedSymbol` or `deepagents.graph.OldClass` after it was removed or renamed.
Common situations: Upgrading deepagents across a version where graph exports were renamed (e.g. to create_deep_agent); copying old tutorial code; stale IDE auto-imports.
Related errors
- `history_path_prefix` was removed in deepagents 0.7. Configu
- modes can only be provided when agent is a factory
- models can only be provided when agent is a factory
- -32601
- -32002
AI-assisted analysis of langchain-ai/deepagents@a1af029e6e (2026-08-29).
Data as JSON: /api/errors/0e68495450045774.
Report an issue: GitHub.