Source: Modal Sandboxes guide and networking docs
Modal Sandboxes: gVisor (or VM runtime) containers for untrusted code, 5-minute default lifetime up to 24 hours, filesystem snapshots, and CIDR/SNI-domain egress allowlists.
Contents
- What: official product documentation
- Publisher: Modal
- Date: living documents, read 2026-11-14
- Original: Sandboxes, Sandbox networking
Summary
Modal Sandboxes are containers for running untrusted code (e.g. LLM output) on Modal’s serverless platform, created with Sandbox.create and driven with sb.exec, from Python, JS or Go SDKs. They reuse Modal’s image, volume, secret and GPU machinery.
Key claims
- Runtimes: gVisor by default (the guide says Modal chooses when
runtimeis unset; Modal’s VM-sandboxes blog confirms gVisor remains the default); a VM runtime gives each sandbox its own kernel for Docker, FUSE and nested cgroups. GPU sandboxes run only on gVisor. - Default maximum lifetime 5 minutes, configurable to 24 hours; longer work should use filesystem snapshots.
idle_timeoutends idle sandboxes. Termination yields exit code 137. - CPU and memory are requests; sandboxes can burst above them and are billed on max(request, actual).
- Secrets are injected as environment variables; an optional OIDC identity token can be injected.
- Named images avoid builds at launch; mutable external tags are cached once pulled.
- Network defaults: no inbound connections, no access to your Modal resources, outbound to any public IP allowed, DNS unrestricted.
block_network=Truedrops all egress.outbound_cidr_allowlistallows listed ranges on any protocol.outbound_domain_allowlist(beta) allows TLS on 443 only, matched on SNI without decryption; ECH unsupported; domain fronting can bypass it, so Modal suggests a Sidecar proxy. CIDR and domain lists are additive. Policies can be replaced at runtime (alpha), terminating newly disallowed connections.- Inbound access is through tunnels (encrypted, unencrypted, HTTP/2 ports) and Connect Tokens;
inbound_cidr_allowlistdoes not apply to unencrypted ports.