A single-binary Rust microVM for AI-agent code execution.
Rust 1.94+ Linux + macOS x86_64 + aarch64 Apache-2.0 / MIT
* For minimal-footprint guests. Measured on an i5 laptop, 8 GiB RAM, vanilla Linux + KVM.
Reproduce with cargo run -p bench --features kvm --release -- --count 100 --alive 50.
Every AI coding agent — Claude Code, Cursor, Devin, OpenHands, aider, SWE-bench-style evals — needs to run generated code somewhere safe and cheaply. Today the options force a bad trade-off:
A single-binary Rust VMM + guest agent + REST control plane,
snapshot-first, with snapshot → fork as a first-class primitive.
An eval pipeline can spawn 1000 variants of a base image at ~12 ms each.
The kernel keeps the shared 6–7 MiB golden image actually shared across
all of them via MAP_PRIVATE copy-on-write.
| Axis | E2B | Firecracker | rust-nano-vm |
|---|---|---|---|
| Cold start (p50) | 150–400 ms | ~125 ms | ~12 ms |
| Snapshot → fork | service-side | not native | first-class |
| Per-fork memory | opaque | ~5 MiB+ RSS | ~0.5 MiB Pss |
| Distribution | SaaS only | VMM + jailer + your code | one binary |
| License | proprietary | Apache-2.0 | Apache-2.0 / MIT |
| Control plane | included (proprietary) | bring your own | included (axum) |
mmap away. Fork doesn't re-boot a
kernel — it maps the snapshot's RAM file MAP_PRIVATE and lets
the kernel serve the read-only golden pages to every child.
Read the write-up →kvm-bindings's serde feature.
Read the write-up →/proc/self/smaps_rollup), not RSS.
RSS double-counts shared pages and overstates fork cost by 5–10×./fork route,
per-caller usage metering, Prometheus /metrics endpoint.
~330 lines of axum, no magic.Boots an in-process control plane on a free port, drives the full create → snapshot → fork lifecycle, prints a report. Works identically on Linux, macOS, and Windows. Only prerequisite is a Rust toolchain (rustup).
git clone https://github.com/ip888/Rust-nano-vm.git
cd Rust-nano-vm
cargo run -p control-plane --example demo --release
To see the wire calls instead, see the "Driving the REST API by hand" section of the README.
Every tagged release ships native-built binaries for three targets, each with a sidecar SHA256 you can verify before deployment. Browse all assets on the latest release page.
| Target | Use it on | Real KVM backend |
|---|---|---|
x86_64-unknown-linux-gnu | Generic Linux servers, AWS x86 instances, dev laptops | ✅ |
aarch64-unknown-linux-gnu | AWS Graviton, Ampere Altra, Oracle A1, Linux on RPi-class | planned |
aarch64-apple-darwin | Apple Silicon Macs (M1/M2/M3/M4) for dev | n/a (macOS has no /dev/kvm) |