Modal logo

V2 Sandboxes

“V2” refers to Modal’s next-generation Sandbox backend, which creates Sandboxes with higher throughput, runs more of them concurrently, and gets them interactive faster. It is not a separate API: Sandboxes use it automatically.

Upgrading 

The new backend is the default in these SDK versions and later:

  • Python 1.6.0
  • JavaScript 0.11.0
  • Go 0.11.0

Sandbox.create(), Sandbox.from_name(), and Sandbox.list() (and their JavaScript and Go equivalents) use the new backend without any code changes. On earlier versions (from Python 1.5.4 and JavaScript and Go 0.10.1), the new backend is opt-in via the MODAL_SANDBOX_V2=1 environment variable or sandbox_v2 = true in your .modal.toml profile. You can drop that setting once you upgrade.

Sandboxes that use features the new backend does not support (such as GPUs) are created on the previous backend automatically.

Two things to be aware of:

  • The new backend does not support the legacy filesystem API (Sandbox.open, ls, mkdir, rm, and watch), which was removed in Python 1.6.0. Migrate any code that uses it before upgrading.
  • When Sandbox.create() returns, the Sandbox has already been scheduled onto a machine, so wait_until_ready() completes faster and more consistently.

If you hit a rough edge, please reach out via Slack or email us at support@modal.com.