Skip to main content

Overview

Sandboxes come in two flavors:
  • 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.
EphemeralNamed
Created withtl sbx newtl sbx new <name>
Suspend / ResumeNot supportedSupported
Reference byID onlyID or name
Use whenShort-lived tasks, one-off executionMulti-step work, persistent environments

Lifecycle states

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.
StateWhat it meansHow you exit it
PendingSandbox is being scheduled and booted. Not yet ready to accept commands.Transitions to Running automatically once boot completes.
RunningSandbox is live and accepting commands, file operations, and process execution. Snapshots can be taken from this state.Call suspend (named only) or terminate.
SnapshottingA reusable snapshot artifact is being captured from the sandbox’s filesystem, memory, and running processes.Returns to Running when capture completes.
SuspendingNamed sandbox is being paused in place. Triggered by manual suspend or by timeout_secs elapsing.Transitions to Suspended automatically.
SuspendedNamed 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.
TerminatedSandbox has stopped — manually, or via timeout for ephemeral sandboxes. Final state; cannot be reversed.

Suspend vs. snapshot

Suspend and snapshot both preserve sandbox state, but they serve different purposes:
  • Suspend pauses this sandbox so you can resume it later under the same ID.
  • Snapshot captures a reusable artifact you can restore into a new sandbox.
Suspend/resume is covered on this page; see Snapshots for save-and-restore.

When should I use what?

ScenarioUse SuspendUse Snapshot
Pause and resume later
Save cost when idle
Keep agent memory alive
Retry from a checkpoint
Run experiments from same state
Clone environment

Create a sandbox

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.
# Ephemeral — runs until terminated or timed out
tl sbx new

# Named — can be suspended and resumed
tl sbx new my-env

Resources

Configure CPU and memory per sandbox. Disk sizing is managed by the platform.
tl sbx new --cpus 2.0 --memory 2048
ParameterTypeDefaultDescription
cpusfloat1.0Number of CPUs to allocate
memory_mbint1024Memory in megabytes. Must be between 1024–8192 MB per CPU core.

Timeout

Set a timeout to automatically stop a sandbox that runs too long. The behavior depends on the sandbox type:
  • Named sandboxes — timeout triggers a suspend, preserving state for later resume.
  • Ephemeral sandboxes — timeout triggers termination (final state).
If timeout_secs is not set, the sandbox runs until explicitly suspended or terminated.
tl sbx new --timeout 300

Secrets

Inject secrets into the sandbox at creation. Secrets must be pre-configured in your Tensorlake account with tl secrets set OPENAI_API_KEY=<your-key>.
Not supported in the CLI.

Runtime environment

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.

Name and reference a sandbox

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.
# Assign a name to a running sandbox
tl sbx name <sandbox-id> my-env

# Change an existing name
tl 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.
# All of these work with either the ID or the name
tl sbx exec my-env python main.py
tl sbx ssh my-env
tl sbx cp ./file.py my-env:/workspace/file.py
tl sbx suspend my-env
tl sbx resume my-env
tl sbx terminate my-env
tl sbx snapshot my-env
tl sbx name my-env 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.

Inspect and list

Use get to check a single sandbox’s status and configuration, or list to see all sandboxes in your namespace.
# List active sandboxes
tl sbx ls

# Running sandboxes only
tl sbx ls --running

# Include all sandboxes regardless of state
tl sbx ls --all

Suspend and resume

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.
# Suspend a named sandbox (by name or ID)
tl sbx suspend my-env

# Resume it later
tl sbx resume my-env

Terminate

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.
tl sbx terminate my-env

End-to-end example

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.
# 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 sandboxes
tl sbx ls
tl sbx ls --all

# Terminate the sandbox when you are done (by name or ID)
tl sbx terminate my-env

Sandbox object reference

Sandbox

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)TypeDescription
sandbox_idsandboxIdstrServer-assigned UUID. Always a UUID, never a name, even if you connected using a name.
namenamestr | NoneHuman-readable name, or None for ephemeral sandboxes.
sandbox = client.connect(identifier="my-env")
print(sandbox.sandbox_id)  # "s7jus08qec4axzgbpq76h"  ← UUID
print(sandbox.name)        # "my-env"                  ← name

SandboxInfo

The SandboxInfo object returned by client.get() contains:
FieldTypeDescription
sandbox_idstrUnique sandbox identifier
namestr | NoneName of the sandbox, or None for ephemeral sandboxes
namespacestrNamespace the sandbox belongs to
statusstrCurrent lifecycle state
imagestrContainer image used
resourcesContainerResourcesInfoCPU and memory allocation
secret_nameslist[str]Injected secret names
timeout_secsintTimeout in seconds
entrypointlist[str]Custom entrypoint command
created_atdatetime | NoneCreation timestamp
terminated_atdatetime | NoneTermination timestamp

Learn more

Snapshots

Save and restore sandbox filesystem, memory, and running processes.

Networking

Control internet access and blocked destinations.