LelantosLelantos
Sandbox

Sandbox Lifecycle

Create, run, pause, resume, and terminate sandboxes.

Overview

A sandbox is an isolated Firecracker microVM with its own CPU, memory, disk, and network. Sandboxes are created from templates and follow a well-defined lifecycle.

State Machine

Sandboxes transition through the following states:

created --> running --> paused --> running --> killed
                  |                              ^
                  |                              |
                  +------------------------------+
                  |
                  v
               stopped (timeout expired)
StateDescription
createdSandbox has been requested and is being provisioned.
runningSandbox is active and accepting commands.
pausedSandbox is suspended. Resources are released but state is preserved.
killedSandbox was explicitly terminated via API.
stoppedSandbox was terminated by the reaper after its timeout expired.

Creating a Sandbox

import { LelantosClient } from "@lelantos-ai/sdk";

const client = new LelantosClient({
  apiKey: process.env.LELANTOS_API_KEY!,
});

const sandbox = await client.createSandbox({
  templateID: "base",
});

console.log("Sandbox ID:", sandbox.sandboxID);
console.log("URL:", sandbox.getURL());
curl -X POST https://api.lelantos.ai/sandboxes \
  -H "X-API-Key: lel_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{"templateID": "base"}'

Sandbox Details

Retrieve the current state and metadata of a sandbox:

const details = await sandbox.getDetails();
console.log("State:", details.status);
console.log("Template:", details.templateID);
console.log("Created:", details.startedAt);
curl https://api.lelantos.ai/sandboxes/SANDBOX_ID \
  -H "X-API-Key: lel_your_key_here"

Pause & Resume

Pausing a sandbox suspends the microVM, preserving its full state (memory, disk, running processes). Resume restores it to the exact same state.

// Pause to save resources
await sandbox.pause();

// Resume when needed
await sandbox.resume();

Killing a Sandbox

Explicitly terminate a sandbox when you are done with it:

await sandbox.kill();
curl -X DELETE https://api.lelantos.ai/sandboxes/SANDBOX_ID \
  -H "X-API-Key: lel_your_key_here"

Listing Sandboxes

List all sandboxes for your team, optionally filtering by metadata:

const sandboxes = await client.listSandboxes();
for (const sb of sandboxes) {
  console.log(sb.sandboxID, sb.status);
}

Default Resources

Every sandbox is provisioned with the following default resources:

ResourceDefaultConfigurable Range
vCPU21 - 8 (per template)
Memory512 MB128 - 8192 MB (per template)
Disk20 GB20 GB

Resource allocation is configured at the template level. All sandboxes created from a template inherit its resource settings.

Warm Pool

Lelantos maintains a warm pool of pre-warmed sandboxes based on the base template. When you create a sandbox from the base template, one is handed over from the pool in ~130 ms instead of booting a new microVM, driving a measured ~394 ms p50 end-to-end start from the EU.

The warm pool currently supports only the base template. Custom templates that are cached on the worker node start in roughly the same range; a template not yet on the node is filled from S3 on a cold start, which takes seconds.

Sub-pages

On this page