The Python SDK ships an async-native variant of the sandbox API on top of asyncio. Every method on the syncDocumentation Index
Fetch the complete documentation index at: https://docs.tensorlake.ai/llms.txt
Use this file to discover all available pages before exploring further.
Sandbox handle has a one-to-one async counterpart on AsyncSandbox — same names, same parameters, just async def and awaited.
When to use it
Reach for the async API when:- You’re driving multiple sandboxes concurrently (e.g. fanning out work with
asyncio.gather). - Your application is already asyncio-based — FastAPI, aiohttp, an LLM agent loop, etc. — and you don’t want to mix in blocking calls.
- You’re streaming output from many processes at once.
Sandbox API is simpler and equivalent.
The shape of the API
AsyncSandbox is the runtime handle for a single sandbox. Use await AsyncSandbox.create(...) to provision and connect, or await AsyncSandbox.connect(sandbox_id) to attach to an existing one. Every instance method is awaited:
Create and run
AsyncSandbox is also an async context manager — use async with to terminate the sandbox automatically when the block exits:
Run many sandboxes in parallel
The async API is designed for fan-out. Useasyncio.gather to start and run sandboxes concurrently:
evaluate call creates, executes against, and terminates its own sandbox in parallel with the others.
Connect to an existing sandbox
Reattach to a named sandbox afterresume, or operate on a sandbox another process created:
Unlike the sync
Sandbox.sandbox_id property, which transparently fetches
sandbox info on first access, the async AsyncSandbox.sandbox_id cannot
block on a network call. Call await sandbox.info() (or any other awaited
method that resolves the sandbox, like status()) once before reading
sandbox.sandbox_id on a freshly connected handle.Background processes and streaming output
Start a process, keep the handle, and collect its output once it finishes:follow_output first, since it would block waiting for the process to exit:
File operations
Suspend, resume, and snapshot
Suspend and resume require a named sandbox — passname= at creation time. checkpoint works on any sandbox, including ephemeral ones.
Learn more
SDK Reference
Full method list — applies to both sync and async APIs.
Lifecycle
State machine, suspend/resume, timeouts.
Process Management
Background processes, stdin, signals.
Snapshots
Capture and restore full VM state.