Lifecycle
Use sandboxes when your agent needs to execute user-provided code, run a data transformation step, call a shell tool, or do any work that should be isolated and disposable. Common examples: an LLM agent that writes and runs Python to answer a data question, a CI tool that tests generated code, or a pipeline step that processes a file and discards the environment afterward. A sandbox moves through three states:
Allocated sandboxes have a default TTL of 3600 seconds (1 hour). Extend it with
renew, or release the sandbox when done.
SDK methods
Allocate a sandbox
- Python
- TypeScript
- CLI
- curl
Request parameters
string
required
Compute tier:
micro, standard, large, or gpu.integer
Time-to-live in seconds. Defaults to
3600.Response
string
Unique identifier for the allocated sandbox.
string
Always
allocated on success.string
URL:
https://sandbox-<id>.compute.hexelstudio.comstring
The tier allocated.
string
ISO 8601 timestamp when the sandbox will be terminated if not renewed.
Execute code
- Python
- TypeScript
- CLI
- curl
Execute parameters
string
Source code to execute. Provide either
code or command, not both.string
Language for the code (e.g.,
python). Required when code is provided.string
Shell command to execute. Provide either
command or code, not both.Renew and release
List and get
Reach a running sandbox
An allocated sandbox is reachable at:What happens when the TTL expires?
What happens when the TTL expires?
The sandbox transitions to
terminated. Any running process is killed and local storage is destroyed. Extend the TTL with renew before expiry if you need more time.Can I reuse a released sandbox?
Can I reuse a released sandbox?
No. Sandboxes are single-use. After release or termination, allocate a new one.
How do I persist data across sandboxes?
How do I persist data across sandboxes?
Use a filesystem attached to a session. Sandbox-local storage is destroyed on termination.
Limits & quotas
Numeric limits depend on your plan — see the Console.
Errors
Security
Common mistakes
- Reusing a released sandbox. Released sandboxes are terminated; allocate a new one.
- Letting work outlive the TTL. Renew before the 1-hour default expires, or the sandbox terminates mid-execution.
- Storing data you need to keep in a sandbox. Local storage is lost on termination — use a filesystem for persistence.
Best practices
- Release sandboxes as soon as you’re done to free capacity.
- Pick the smallest tier that fits the workload.
- Use a persistent session with a filesystem when you need state across sandboxes.
Related pages
Sessions & Filesystems
Persist data across sandboxes.
Compute Overview
Tiers and the compute model.
Agents
Long-running deployments instead of on-demand sandboxes.
Quickstart
Run your first sandbox.

