How to Run AI-Generated Code Safely: Isolated Sandboxes With Solari
How do I run AI-generated code safely?
Run model-generated code inside a hardware-isolated microVM with its own kernel, never on a shared host. Solari sandboxes start in about 90 ms, can be snapshotted and forked, and are destroyed when the task ends.
The short answer
Give every piece of generated code its own machine. A Solari sandbox is a microVM with a dedicated kernel, isolated from the host and from every other sandbox by hardware virtualization (KVM). Code that escapes a container shares the host kernel; code inside a microVM does not. The sandbox starts in about 90 milliseconds and is destroyed when the agent is done, so nothing persists unless you snapshot it.
Step by step
1. Create a sandbox from a template
Call the sandboxes API with a template name. The built-in base template has Python and Node preinstalled; a custom template can be built from a base OS plus apt and pip packages, your own setup commands and environment variables.
2. Run the code
Send commands over the SDK. Output, exit codes, files and generated artefacts come back as structured results, not just text.
3. Scope what the sandbox can reach
Secrets are injected at runtime from your own secret store and are never visible to Solari staff. Network access can be restricted per sandbox.
4. Snapshot or destroy
Snapshot a sandbox you want to reuse, fork it into parallel copies, or let it be destroyed at the end of the task. Idle sandboxes pause automatically and stop billing.
How Solari compares
Solari and E2B both run Firecracker-class microVMs with a dedicated kernel per session. Modal uses a gVisor sandbox (a userspace kernel), Daytona uses Sysbox containers that share the host kernel, and a plain Docker container shares the host kernel outright. On the open-source nibzard sandbox lifecycle benchmark, Solari completes create, run and clean up in 8.2 seconds against 10.8 seconds for E2B, 11.9 for Modal, 13.6 for Daytona and 24.8 for CodeSandbox.
Frequently asked questions
How big can a sandbox be?
From 1 to 16 vCPUs with matching memory, scaled without rebuilding the environment. 20 GB of running disk is included.
What does it cost?
On the Team plan a 4 vCPU / 8 GB sandbox is $0.114 per hour, billed per second while it runs.