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.
Lifecycle states
Every sandbox moves through the states below. Create starts the sandbox inPending; from Running, you can suspend (named only), snapshot, or terminate. Ephemeral sandboxes follow the same flow but skip Suspending/Suspended.
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.
When should I use what?
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.- CLI
- Python
- TypeScript
- HTTP
Resources
Configure CPU, memory, and disk size per sandbox. These are fixed when the sandbox is created and cannot be changed afterwards — create a new sandbox if you need different resources.- CLI
- Python
- TypeScript
- HTTP
Timeout
timeout_secs is an idle threshold, not a wall-clock lifetime. A sandbox stays running as long as it is handling traffic through the sandbox proxy — an open SSH session, a connected WebSocket PTY, a request to an exposed user port, or any SDK/CLI call. Once no proxied traffic has been in flight for timeout_secs, the sandbox times out. What happens next depends on the sandbox type:
- Named sandboxes — suspend on timeout. Filesystem, memory, and running processes are preserved so you can resume later under the same name.
- Ephemeral sandboxes — terminate on timeout (final state). The sandbox cannot be resumed.
timeout_secs is not set, it goes with the default value which is 600 sec (10 minutes).
The maximum allowed timeout_secs depends on your plan: 1 hour on Free (unverified), 2 hours on Free (verified), and 24 hours on On-Demand (pay-as-you-go). Setting timeout_secs=0 requests the plan maximum. See tensorlake.ai/pricing for higher limits on committed plans.
- CLI
- Python
- TypeScript
- HTTP
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.- CLI
- Python
- TypeScript
- HTTP
connect to get an operable handle from either identifier.
- CLI
- Python
- TypeScript
- HTTP
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
Useget to check a single sandbox’s status and configuration, or list to see all sandboxes in your namespace.
- CLI
- Python
- TypeScript
- HTTP
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.- CLI
- Python
- TypeScript
- HTTP
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.
- CLI
- Python
- TypeScript
- HTTP
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.- CLI
- Python
- TypeScript
- HTTP
Sandbox object reference
Sandbox
TheSandbox object returned by Sandbox.create() and Sandbox.connect() exposes the following properties. Both are resolved from the server on first access and cached for the lifetime of the object.
SandboxInfo
TheSandboxInfo object returned by Sandbox.info() and Sandbox.list() contains:
Learn more
Snapshots
Save and restore sandbox filesystem, memory, and running processes.
Networking
Control internet access and blocked destinations.