After you run tl login, you can manage your sandboxes in the Tensorlake Dashboard. You can also create API keys there for sandbox connections. See Authentication for the full API key setup flow.
Create a tiny sandbox for a quick task, or provision one with more CPU and memory for heavier workloads.
CLI
Python
TypeScript
# Create an ephemeral sandbox (no name — terminates when done, cannot be suspended)tl sbx create# Run code inside the sandboxtl sbx exec <sandbox-id> python -c 'print("Hello from sandbox")'# Copy files in or out as the sandbox accumulates statetl sbx cp local-file.txt <sandbox-id>:/workspace/local-file.txt
from tensorlake.sandbox import Sandbox# Ephemeral sandbox — no name, terminates when done, cannot be suspendedsandbox = Sandbox.create()# Run code inside the sandboxresult = sandbox.run("python", ["-c", "print('Hello from sandbox')"])print(result.stdout)# Copy files in or out as the sandbox accumulates statesandbox.write_file("/workspace/local-file.txt", b"example content")file_bytes = bytes(sandbox.read_file("/workspace/local-file.txt"))print(file_bytes.decode("utf-8"))
import { Sandbox } from "tensorlake";// Ephemeral sandbox — no name, terminates when done, cannot be suspendedconst sandbox = await Sandbox.create();console.log(sandbox.sandboxId, sandbox.status);for (const sb of await Sandbox.list()) { console.log(sb.sandboxId, sb.status);}// Run code inside the sandboxconst result = await sandbox.run("python", { args: ["-c", "print('Hello from sandbox')"],});console.log(result.stdout);// Copy files in or out as the sandbox accumulates stateawait sandbox.writeFile( "/workspace/local-file.txt", new TextEncoder().encode("example content"),);const fileBytes = await sandbox.readFile("/workspace/local-file.txt");console.log(new TextDecoder().decode(fileBytes));
You can specify CPU, memory, disk, and timeout parameters when creating sandboxes. The defaults are 1 CPU, 1024 MB memory, 10 GB disk, and 300 seconds timeout.
Tensorlake sandboxes can be suspended and resumed. A resumed sandbox continues from the exact memory and file system state, it was suspended.
This is useful when you want to preserve the sandbox state without paying for idle compute time.You have to name a sandbox to make them suspendable after timeout. Sandboxes without a name are ephemeral and thrown away after the timeout.
You can also SSH into your sandboxes for an interactive terminal experience.
tl sbx ssh <sandbox-id>
This uses a websocket based PTY session to connect you to the sandbox.For programmatic access, you can create and control PTY session with the Python and TypeScript SDKs.