Key Features
- Isolation — each sandbox runs in its own container, fully isolated from other sandboxes and your infrastructure
- Resource control — configure CPU, memory, and ephemeral disk per sandbox
- Network restrictions — allow or deny internet access, control outbound destinations
- Timeouts — set execution time limits to prevent runaway processes
- Warm pools — pre-warm containers for low-latency sandbox creation
- Secrets — inject secrets as environment variables without exposing them in code
SandboxClient
TheSandboxClient is the Python SDK for managing sandboxes:
When to Use Sandboxes
| Use Case | Approach |
|---|---|
| Agent tool calls with different dependencies | Use @function() — built-in isolation per function |
| Executing LLM-generated code | Use Sandboxes — dynamic creation with network restrictions |
| Batch processing with bounded resources | Use @function() with max_containers |
| Interactive code execution (notebooks, REPLs) | Use Sandboxes — create on demand, inspect, and tear down |
| Untrusted user-submitted code | Use Sandboxes — network restrictions and resource limits |
@function() in Tensorlake Applications, you don’t need standalone sandboxes. Sandboxes are for cases where you need dynamic, on-demand container creation with fine-grained control.