Skip to main content

Sandbox States

A sandbox can move through these lifecycle states:
StateDescription
PendingSandbox is being scheduled or started.
RunningSandbox is active and ready for commands or file/process operations.
SnapshottingThe sandbox is creating a filesystem snapshot.
SuspendingThe sandbox is being suspended and snapshotted for later resume.
SuspendedThe sandbox has been suspended and can be resumed.
TerminatedSandbox has been stopped manually or due to a timeout.
tl sbx new
tl sbx ls
tl sbx ls --running
tl sbx ls --all

Manage Sandboxes

Use the lifecycle API to create a sandbox, inspect it, list active sandboxes, and clean it up when the work is done.
# Create a sandbox
tl sbx new --cpus 1.0 --memory 512 --timeout 300

# Check status or list sandboxes
tl sbx ls
tl sbx ls --all

# Terminate the sandbox when you are done
tl sbx terminate <sandbox-id>

Resource Configuration

Configure CPU and memory for each sandbox. Disk sizing is managed by the platform and is not a current tl option.
tl sbx new --cpus 2.0 --memory 1024
ParameterTypeDefaultDescription
cpusfloat1.0Number of CPUs to allocate
memory_mbint512Memory in megabytes

Timeouts

Set a timeout to automatically terminate sandboxes that run too long:
tl sbx new --timeout 300
If timeout_secs is not set, the sandbox runs until explicitly terminated.

Lifecycle Commands

Create, suspend, resume, and terminate sandboxes from the CLI or public API:
# Create
tl sbx new --timeout 300

# Suspend a running sandbox
tl sbx suspend <sandbox-id>

# Resume a suspended sandbox
tl sbx resume <sandbox-id>

# Terminate a sandbox
tl sbx terminate <sandbox-id>

Runtime Environment

Sandboxes run on Tensorlake’s managed Ubuntu 24.04 environment. Custom image selection is not currently part of the public sandbox workflow, so the --image flag is intentionally omitted from these docs. If you need startup setup, create the sandbox and then use command execution to run those steps explicitly.

Secrets

Secrets can be injected from the Python SDK or HTTP API:
sandbox = client.create(
    secret_names=["OPENAI_API_KEY", "DATABASE_URL"]
)
Secrets must be pre-configured in your Tensorlake account using:
tl secrets set OPENAI_API_KEY=<your-key>

Sandbox Information

The SandboxInfo object returned by client.get() contains:
FieldTypeDescription
sandbox_idstrUnique sandbox identifier
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 and memory state.

Networking

Control internet access and blocked destinations.