Skip to content
extraorbital
Documentation ExtraOrbital
Browse documentation

Application services

Sandboxes

Run untrusted or generated code in isolated containers.

Run in your project folder
npx extraorbital add sandbox

A sandbox resource is a place to run code you do not want on your own servers: an agent's generated code, a user's script, a build. You get a token for the official Modal SDK; your code starts sandboxes, runs commands in them and reads their output directly. Nothing goes through ExtraOrbital.

  1. 01 / Run the commandGet the service
  2. 02 / Read your .envUse its credentials
  3. 03 / Connect your appCall the SDK or API

Limits

LimitFree · PrototypePaid
Sandbox resources10No plan count cap
ComputeFrom the $5.00 account allowance$0.1419 / core-hour, $0.024 / GiB-hour
BandwidthFrom the $5.00 account allowance$0.04 / GiB of egress
SpendIdle environments are freeShared team credit or budget

Free allowances are shared across the account. Provider limits still apply on paid plans.

Use it

js
import { ModalClient } from "modal";

const modal = new ModalClient();
const app = await modal.apps.fromName("my-app", { createIfMissing: true });
const sandbox = await modal.sandboxes.create(app, modal.images.fromRegistry("python:3.12-slim"));
const run = await sandbox.exec(["python", "-c", "print(2 + 2)"]);
console.log(await run.stdout.readText());
await sandbox.terminate();

The token runs code that you pay for: keep it server-side. Each machine and each deploy target gets a credential of its own.

Environment variables

The CLI writes these to .env or an existing .env.local. The Modal SDKs (TypeScript, Python and Go) read them as they are.

VariablePurpose
MODAL_TOKEN_IDIdentifies the credential
MODAL_TOKEN_SECRETAuthenticates it; keep it private
MODAL_ENVIRONMENTThe resource's environment, where every sandbox and app of the resource runs

Specifics

Budget

Set a spending ceiling per calendar month (UTC) with maxBudgetCents. Past it, running sandboxes stop and new ones are refused until the next month or a higher ceiling. Spend is read a few minutes late, so a resource can pass its ceiling by what it spends in that time.

Read-only credentials

A read credential lists and reads what runs in the environment and cannot start anything.

GPUs and public URLs

GPUs are off by default. Web endpoints need Modal's proxy authentication: an environment refuses unauthenticated web endpoints. Use sandboxes for code you run, not to host public sites.

Extra environments

A resource is one environment. An environment created with a resource's credential is removed within a minute, and what ran in it is billed to that resource. Add another resource for another environment.

Freeze

Freezing a resource stops every sandbox and app in it and refuses its credentials within a few seconds. Unfreezing gives the same credentials back; deploy stopped apps again.

Pricing

UsagePaid rate
Compute$0.1419 / core-hour, $0.024 / GiB-hour
Bandwidth$0.04 / GiB of egress
SpendIdle environments are free

See pricing for team subscription fees, allowances, and billing terms. Plans and billing ↗