Ephemeral — no name. Runs until you terminate it or it times out. Cannot be suspended.
Named — a name given at creation (or assigned later). Supports suspend and resume, so you can pause between tasks and pick up exactly where you left off.
Every sandbox moves through the states below. Create starts the sandbox in Pending; from Running, you can suspend (named only), snapshot, or terminate. Ephemeral sandboxes follow the same flow but skip Suspending/Suspended.
State
What it means
How you exit it
Pending
Sandbox is being scheduled and booted. Not yet ready to accept commands.
Transitions to Running automatically once boot completes.
Running
Sandbox is live and accepting commands, file operations, and process execution. Snapshots can be taken from this state.
Call suspend (named only) or terminate.
Snapshotting
A reusable snapshot artifact is being captured from the sandbox’s filesystem, memory, and running processes.
Returns to Running when capture completes.
Suspending
Named sandbox is being paused in place. Triggered by manual suspend or by timeout_secs elapsing.
Transitions to Suspended automatically.
Suspended
Named sandbox is paused. Consumes no compute; state is preserved for resume under the same sandbox ID.
Call resume to return to Running, or terminate to end it.
Terminated
Sandbox has stopped — manually, or via timeout for ephemeral sandboxes. Final state; cannot be reversed.
Create an ephemeral sandbox by calling create with no name. Add a name to make the sandbox persistent and eligible for suspend/resume.You can also boot a sandbox from an existing snapshot to restore a previously captured filesystem, memory, and running processes. See Restoring from a snapshot for details.
CLI
Python
TypeScript
HTTP
# Ephemeral — runs until terminated or timed outtl sbx new# Named — can be suspended and resumedtl sbx new my-env
from tensorlake.sandbox import SandboxClientclient = SandboxClient()# Ephemeral sandbox — no name, cannot be suspendedephemeral = client.create()# Named sandbox — can be suspended and resumednamed = client.create(name="my-env")print(f"Sandbox ID: {named.sandbox_id}")print(f"Status: {named.status}")
// Ephemeral sandbox — no name, cannot be suspendedconst ephemeral = await client.create();// Named sandbox — can be suspended and resumedconst named = await client.create({ name: "my-env" });console.log(named.sandboxId, named.status);
Sandboxes run on Tensorlake’s managed Ubuntu 24.04 environment by default. If you need reusable setup or preinstalled dependencies, create a Sandbox Image and launch sandboxes with --image. For one-off startup setup, create the sandbox and then use command execution to run those steps explicitly.
You can assign or update a sandbox’s name after it is created. This is how you convert an ephemeral sandbox into a named one so it becomes eligible for suspend and resume.
CLI
Python
TypeScript
HTTP
# Assign a name to a running sandboxtl sbx name <sandbox-id> my-env# Change an existing nametl sbx name my-env new-name
Once a sandbox has a name, you can use either the name or the UUID anywhere a sandbox identifier is accepted. Use connect to get an operable handle from either identifier.
CLI
Python
TypeScript
HTTP
# All of these work with either the ID or the nametl sbx exec my-env python main.pytl sbx ssh my-envtl sbx cp ./file.py my-env:/workspace/file.pytl sbx suspend my-envtl sbx resume my-envtl sbx terminate my-envtl sbx snapshot my-envtl sbx name my-env new-name
info = client.get("my-env")print(info.status)sandbox = client.connect(identifier="my-env")print(sandbox.sandbox_id) # server UUID, e.g. "s7jus08qec4axzgbpq76h"print(sandbox.name) # "my-env"result = sandbox.run("python", ["main.py"])print(result.stdout)renamed = client.update_sandbox("my-env", "new-name")print(renamed.name)client.delete("new-name")
const info = await client.get("my-env");console.log(info.status);const sandbox = client.connect("my-env");console.log(sandbox.sandboxId); // server UUIDconsole.log(sandbox.name); // "my-env"const result = await sandbox.run("python", { args: ["main.py"] });console.log(result.stdout);await client.update("my-env", { name: "new-name" });await client.delete("new-name");
Authenticated requests can use either the sandbox ID or sandbox name. Unauthenticated proxy requests can also use sandbox names for exposed user ports when allow_unauthenticated_access is enabled. The management URL on port 9501 still requires authentication.
Use get to check a single sandbox’s status and configuration, or list to see all sandboxes in your namespace.
CLI
Python
TypeScript
HTTP
# List active sandboxestl sbx ls# Running sandboxes onlytl sbx ls --running# Include all sandboxes regardless of statetl sbx ls --all
info = client.get("my-env")print(info.status)print(info.image)print(f"{info.resources.cpus} CPUs, {info.resources.memory_mb} MB RAM")sandboxes = client.list()for sb in sandboxes: print(f"{sb.sandbox_id}: {sb.status}")
const info = await client.get("my-env");console.log(info.status, info.image, info.resources.cpus, info.resources.memoryMb);const sandboxes = await client.list();for (const sb of sandboxes) { console.log(`${sb.sandboxId}: ${sb.status}`);}
# Get one sandbox (by name or ID)curl https://api.tensorlake.ai/sandboxes/my-env \ -H "Authorization: Bearer $TL_API_KEY"# List all sandboxescurl https://api.tensorlake.ai/sandboxes \ -H "Authorization: Bearer $TL_API_KEY"
Suspend a running named sandbox to pause it in place, then resume the same sandbox later exactly where it left off. Suspend and resume do not create a reusable artifact — for that, use Snapshots. Ephemeral sandboxes cannot be suspended — suspend calls on them return an error.
CLI
Python
TypeScript
HTTP
# Suspend a named sandbox (by name or ID)tl sbx suspend my-env# Resume it latertl sbx resume my-env
Terminate a sandbox when the work is done. Terminated is a final state and cannot be reversed. Sandboxes with timeout_secs set also terminate automatically once the timeout elapses.
If you want a single example that creates a sandbox, inspects it, lists sandboxes, and cleans up when finished, use one of the sessions below.
CLI
Python
TypeScript
HTTP
# Create an ephemeral sandbox (no name — cannot be suspended)tl sbx new --cpus 1.0 --memory 1024 --timeout 300# Create a named sandbox (can be suspended and resumed)tl sbx new my-env --cpus 1.0 --memory 1024 --timeout 300# Check status or list sandboxestl sbx lstl sbx ls --all# Terminate the sandbox when you are done (by name or ID)tl sbx terminate my-env
from tensorlake.sandbox import SandboxClientclient = SandboxClient()# Ephemeral sandbox — no name, cannot be suspendedephemeral = client.create( cpus=1.0, memory_mb=1024, timeout_secs=300,)# Named sandbox — can be suspended and resumednamed = client.create( name="my-env", cpus=1.0, memory_mb=1024, timeout_secs=300,)print(f"Sandbox ID: {named.sandbox_id}")print(f"Status: {named.status}")info = client.get(named.sandbox_id)print(f"Image: {info.image}")print(f"Resources: {info.resources.cpus} CPUs, {info.resources.memory_mb} MB RAM")sandboxes = client.list()for sb in sandboxes: print(f"{sb.sandbox_id}: {sb.status}")client.delete(named.sandbox_id)client.delete(ephemeral.sandbox_id)print("Sandboxes terminated")
The Sandbox object returned by connect() and create_and_connect() exposes the following properties. Both are resolved from the server on first access and cached for the lifetime of the object.
Property (Python)
Property (TypeScript)
Type
Description
sandbox_id
sandboxId
str
Server-assigned UUID. Always a UUID, never a name, even if you connected using a name.
name
name
str | None
Human-readable name, or None for ephemeral sandboxes.