Sandboxes

Sandboxes are isolated execution environments where your code runs safely and independently.

What is a sandbox?

Each Vyoma sandbox runs in its own container with a dedicated filesystem and process space. Sandboxes are long-lived and can execute multiple commands over time.

Key features

  • Strong isolation using containers
  • Dedicated filesystem per sandbox
  • Execute arbitrary commands
  • Write and read files
  • Time-based automatic shutdown

Creating a sandbox

const { sandbox } = await client.sandbox.create({
  templateId: "node-20",
  timeout: 300,
})

Templates

Templates define the runtime environment for your sandbox (Node.js, Python, Go, etc.). More templates will be added over time.

Checking sandbox status

const status = await client.sandbox.status(sandbox.id)

console.log(status.status) // "starting" | "running" | "stopped"

Executing commands

const result = await client.sandbox.exec(
  sandbox.id,
  "node -e \"console.log('Hello')\""
)

console.log(result.stdout)

Writing files

await client.sandbox.write(
  sandbox.id,
  "app.js",
  'console.log("Hello from file")'
)

const result = await client.sandbox.exec(
  sandbox.id,
  "node app.js"
)

console.log(result.stdout)

Stopping a sandbox

await client.sandbox.stop(sandbox.id)
Stopping a sandbox immediately frees resources and stops billing.