Instant Sandboxes
Isolated microVMs that spin up in ~100ms with root access. No container overhead, no shared kernels — just fast, secure, disposable execution environments.
1from hopx_ai import Sandbox
2
3# Create an instant sandbox (~100ms)
4sandbox = Sandbox.create(
5 template="code-interpreter"
6)
7
8print(f"Sandbox ready: {sandbox.id}")
9print(f"Status: {sandbox.status}")
10
11# Execute code immediately
12result = sandbox.run_code("""
13import platform
14print(f"Python {platform.python_version()}")
15print(f"OS: {platform.system()} {platform.release()}")
16""")
17
18print(result.stdout)
19
20# Cleanup when done
21sandbox.kill()Why Instant Sandboxes?
Combine the speed of containers with the security of VMs
~100ms Cold Starts
Sandboxes boot from pre-built snapshots in milliseconds. No waiting for containers to pull or VMs to provision.
Hardware-Level Isolation
Each sandbox runs in its own Firecracker micro-VM with a dedicated kernel. Complete isolation from other workloads.
Auto-Cleanup
Configure automatic timeouts and resource cleanup. Sandboxes terminate gracefully when no longer needed.
Persistent Filesystem
Files persist across sessions within a sandbox. Write data, install packages, and maintain state.
How It Works
Create
Call Sandbox.create() with your template. The API returns in ~100ms with a ready sandbox.
Execute
Run code, execute commands, manage files. Full Linux environment with root access at your fingertips.
Destroy
Call sandbox.kill() or let auto-cleanup handle it. Resources are freed instantly.