Skip to main content
On this page

About Sandboxes

Sandboxes bring instant Linux microVMs to Deno Deploy. Each sandbox boots in under a second, is API driven from the @deno/sandbox SDK, and is torn down as soon as you are done. The result is on-demand compute that feels like opening a terminal, yet ships with production-grade isolation and observability.

What are Sandboxes? Jump to heading

  • Linux microVMs orchestrated by Deno Deploy
  • Designed for running untrusted code
  • Instantly available; boot times measured in milliseconds
  • Ephemeral by default but able to persist beyond the current connection lifetime
  • Able to access durable storage via volumes
  • Fully API driven: create, run commands, and tear down from code

Ideal use cases Jump to heading

Sandboxes specialize in workloads where code needs to be generated, evaluated, or safely executed on behalf of an untrusted user. They are ideal for:

  • AI agents and copilots that need to run code as they reason
  • Secure plugin or extension systems
  • Vibe-coding and collaborative IDE experiences
  • Ephemeral CI runners and smoke tests
  • Customer supplied or user generated code paths
  • Instant dev servers and preview environments

This is compute built not just for developers, but for software that builds software.

Run real workloads Jump to heading

Once the sandbox exists, you get a full Linux environment with files, processes, package managers, and background services:

import { Sandbox } from "@deno/sandbox";
await using sandbox = await Sandbox.create();
await sandbox.sh`ls -lh /`;

Security Policies (Coming soon) Jump to heading

Povision a Sandbox so that it can only talk to approved hosts:

await Sandbox.create({
  allowNet: ["google.com"],
});

Environment variables marked as Secrets never enter the sandbox. Below, OPENAI_API_KEY is never visibile to code inside the sandbox and only can ever be sent to api.openai.com.

await Sandbox.create({
  env: {
    OPENAI_API_KEY: Sandbox.secret(
      "api.openai.com",
      process.env.OPENAI_API_KEY,
    ),
  },
});

Built for instant, safe compute Jump to heading

Developers and AI systems now expect compute that is instant, safe, and globally accessible. Sandboxes deliver:

  • Instant spin-up with no warm pool to manage
  • Dedicated isolation with strict network egress policies
  • Full observability alongside Deploy logs and traces
  • Region selection, memory sizing, and lifetime controls per sandbox
  • Seamless hand-off to Deploy apps when code is production ready

Together, Deno Deploy and Sandboxes form a single workflow: code is created, proved safe in a sandbox, and deployed globally without new infrastructure or orchestration layers.

Runtime support Jump to heading

The Sandboxes SDK is tested and supported on:

  • Deno: Latest stable version
  • Node.js: Version 24+

You can use Sandboxes from any environment that can import the @deno/sandbox package and make outbound HTTPS requests to the Deploy API, meaning you can use Sandboxes in your Node projects, Deno Deploy apps, or even browser-based tools.

In your Deno projects you can use either the jsr or npm package, however the jsr package has been optimized for Deno usage and APIs and is recommended.

await using support

The await using syntax requires Node.js 24+. If your project uses earlier Node.js versions, use try/finally blocks instead:

import { Sandbox } from "@deno/sandbox";

const sandbox = await Sandbox.create();
try {
  // ... use sandbox ...
} finally {
  await sandbox.close();
}

Limits Jump to heading

Sandboxes have the following limits:

  • Memory: 768 MB to 4096 MB (1GB default) configurable per sandbox
  • CPU: 2 vCPU
  • Lifetime: Configurable per sandbox and bound to a session, up to 30 minutes
  • Disk: 10 GB of ephemeral storage

Exceeding these limits may result in throttling or termination of your sandbox.

Regions Jump to heading

Regions currently supported are:

  • ams - Amsterdam, Netherlands
  • ord - Chicago, USA

You can specify the region where the sandbox will be created when creating a new sandbox:

import { Sandbox } from "@deno/sandbox";

await using sandbox = await Sandbox.create({ region: "ams" });

If not specified, the sandbox will be created in the default region.

Learn more Jump to heading

Ready to try it? Follow the Getting started guide to create your first sandbox, obtain an access token, and run code on the Deploy edge.

Did you find what you needed?

Privacy policy