langchain-ai/deepagents · error · ValueError
enable_interpreter=True is not supported with a remote sandb
Error message
enable_interpreter=True is not supported with a remote sandbox in this release. Disable the sandbox or unset enable_interpreter.
What it means
create_cli_agent refuses to build an agent when enable_interpreter=True is combined with a remote sandbox. The code-interpreter middleware is only wired for local execution in this release, so the combination is explicitly rejected with a ValueError before any provider calls are made. This is a guard against a known-unsupported configuration, not a transient failure.
Source
Thrown at libs/code/deepagents_code/agent.py:2993
env=shell_env,
)
else:
# No shell access - use plain FilesystemBackend
backend = FilesystemBackend(root_dir=root_dir, virtual_mode=False)
else:
# ========== REMOTE SANDBOX MODE ==========
backend = sandbox # Remote sandbox (ModalSandbox, etc.)
# Note: Shell middleware not used in sandbox mode
# File operations and execute tool are provided by the sandbox backend
if enable_interpreter:
if sandbox is not None:
msg = (
"enable_interpreter=True is not supported with a remote "
"sandbox in this release. Disable the sandbox or unset "
"enable_interpreter."
)
raise ValueError(msg)
# Lazy import keeps `dcode -v` fast — see AGENTS.md startup-perf rule.
from langchain_core._api import ( # noqa: PLC2701 # re-exported in _api.__all__
suppress_langchain_beta_warning,
)
from langchain_quickjs import CodeInterpreterMiddleware, PTCOption
interpreter = interpreter_config or InterpreterConfig.from_resolver()
ptc_names = _resolve_ptc_option(
interpreter.ptc,
tools=tools,
acknowledge_unsafe=interpreter.ptc_acknowledge_unsafe,
auto_approve=auto_approve,
)
ptc_option: PTCOption | None = (
cast("PTCOption", list(ptc_names)) if ptc_names is not None else None
)
# `CodeInterpreterMiddleware` is decorated `@beta()`, which emits a
# `LangChainBetaWarning` on every instantiation. We intentionally use itView on GitHub (pinned to a1af029e6e)
Solutions
- Unset enable_interpreter (leave it False/default) while keeping the remote sandbox enabled.
- Disable the sandbox (pass sandbox=None) if you need enable_interpreter=True.
- Check the release notes/changelog for when remote-sandbox interpreter support lands, and upgrade before re-enabling the combination.
Example fix
// before agent = create_cli_agent(sandbox=remote_sandbox, enable_interpreter=True) // after (option A: keep remote sandbox) agent = create_cli_agent(sandbox=remote_sandbox) // after (option B: keep interpreter, local execution) agent = create_cli_agent(enable_interpreter=True)
Defensive patterns
Strategy: validation
Validate before calling
if sandbox is not None and getattr(options, 'enable_interpreter', False):
# reconfigure before calling create_cli_agent
options.enable_interpreter = False # or drop the remote sandbox Type guard
def interpreter_compatible(sandbox: object | None, enable_interpreter: bool) -> bool:
return not (sandbox is not None and enable_interpreter) Prevention
- Keep enable_interpreter at its default unless running fully locally.
- Centralize agent construction in one factory so sandbox/interpreter flags are checked in one place.
- Read the release notes before combining experimental flags (interpreter) with remote infrastructure.
When it happens
Trigger: Calling create_cli_agent (directly or via build_agent / _create_cli_graphs_sync) with sandbox=<remote sandbox object> and enable_interpreter=True set in the agent options.
Common situations: Enabling the PTC/quickjs interpreter in a config or CLI flag that also points at a hosted/remote sandbox; copying an example that sets enable_interpreter=True into an environment that already uses a remote sandbox; upgrading to a release where interpreter support for remote sandboxes has not shipped yet.
Related errors
- allow_list must not be empty; disable shell access instead
- SHELL_ALLOW_ALL should not be used with ShellAllowListMiddle
- interpreter_ptc='all' exposes every host tool to PTC calls t
- Invalid interpreter_ptc string {ptc!r}; expected 'safe', 'al
- interpreter_ptc list entries cannot include 'all'; use 'all'
AI-assisted analysis of langchain-ai/deepagents@a1af029e6e (2026-08-29).
Data as JSON: /api/errors/9a7cc8d7d7340b39.
Report an issue: GitHub.