{"record":{"id":"9a7cc8d7d7340b39","repo":"langchain-ai/deepagents","slug":"enable-interpreter-true-is-not-supported-with-a-re","errorCode":null,"errorMessage":"enable_interpreter=True is not supported with a remote sandbox in this release. Disable the sandbox or unset enable_interpreter.","messagePattern":"enable_interpreter=True is not supported with a remote sandbox in this release\\. Disable the sandbox or unset enable_interpreter\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"libs/code/deepagents_code/agent.py","lineNumber":2993,"sourceCode":"                env=shell_env,\n            )\n        else:\n            # No shell access - use plain FilesystemBackend\n            backend = FilesystemBackend(root_dir=root_dir, virtual_mode=False)\n    else:\n        # ========== REMOTE SANDBOX MODE ==========\n        backend = sandbox  # Remote sandbox (ModalSandbox, etc.)\n        # Note: Shell middleware not used in sandbox mode\n        # File operations and execute tool are provided by the sandbox backend\n\n    if enable_interpreter:\n        if sandbox is not None:\n            msg = (\n                \"enable_interpreter=True is not supported with a remote \"\n                \"sandbox in this release. Disable the sandbox or unset \"\n                \"enable_interpreter.\"\n            )\n            raise ValueError(msg)\n        # Lazy import keeps `dcode -v` fast — see AGENTS.md startup-perf rule.\n        from langchain_core._api import (  # noqa: PLC2701  # re-exported in _api.__all__\n            suppress_langchain_beta_warning,\n        )\n        from langchain_quickjs import CodeInterpreterMiddleware, PTCOption\n\n        interpreter = interpreter_config or InterpreterConfig.from_resolver()\n        ptc_names = _resolve_ptc_option(\n            interpreter.ptc,\n            tools=tools,\n            acknowledge_unsafe=interpreter.ptc_acknowledge_unsafe,\n            auto_approve=auto_approve,\n        )\n        ptc_option: PTCOption | None = (\n            cast(\"PTCOption\", list(ptc_names)) if ptc_names is not None else None\n        )\n        # `CodeInterpreterMiddleware` is decorated `@beta()`, which emits a\n        # `LangChainBetaWarning` on every instantiation. We intentionally use it","sourceCodeStart":2975,"sourceCodeEnd":3011,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/code/deepagents_code/agent.py#L2975-L3011","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nagent = create_cli_agent(sandbox=remote_sandbox, enable_interpreter=True)\n\n// after (option A: keep remote sandbox)\nagent = create_cli_agent(sandbox=remote_sandbox)\n// after (option B: keep interpreter, local execution)\nagent = create_cli_agent(enable_interpreter=True)","handlingStrategy":"validation","validationCode":"if sandbox is not None and getattr(options, 'enable_interpreter', False):\n    # reconfigure before calling create_cli_agent\n    options.enable_interpreter = False  # or drop the remote sandbox","typeGuard":"def interpreter_compatible(sandbox: object | None, enable_interpreter: bool) -> bool:\n    return not (sandbox is not None and enable_interpreter)","tryCatchPattern":null,"preventionTips":["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."],"tags":["python","configuration","sandbox","cli"],"backgroundTag":"incompatible-feature-flags","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}