Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.superserve.ai/llms.txt

Use this file to discover all available pages before exploring further.

Env vars set at creation time are applied to every process the sandbox runs: commands.run(), shells, and anything those spawn. They persist across pause() / resume() cycles.
const sandbox = await Sandbox.create({
  name: "data-analyzer",
  envVars: {
    OPENAI_API_KEY: "sk-...",
    DATABASE_URL: "postgres://...",
    NODE_ENV: "production",
  },
})

const result = await sandbox.commands.run("echo $NODE_ENV")
console.log(result.stdout)  // "production\n"

Per-command overrides

The env option on commands.run() adds to or overrides the sandbox-wide env for a single command.
const result = await sandbox.commands.run("echo $NODE_ENV", {
  env: { NODE_ENV: "staging" },
})
console.log(result.stdout)  // "staging\n"
Values pass through unmodified - no shell expansion or interpolation. Escape $ and special characters yourself if needed.