Execute untrusted code in isolated microVMs

Each client.execute() call runs inside a Firecracker microVM with its own kernel and filesystem. State persists across calls within a session, then tears down automatically. Egress is deny-by-default.

<200ms

P95 cold start

<10ms

Warm reuse

1–8 vCPU

Per VM

code execution

$instavm execute --code "import sys; print(sys.version)"

provisioning firecracker vm (2 vcpu, 512mb)

vm ready in 147ms | kernel isolated

3.11.7 (main, Dec 8 2024)

$instavm execute --code "pip install pandas && python analysis.py"

session reuse: 4ms | packages persist from previous call

{"status":"ok","records":1240,"risk_score":0.07}

$instavm session close

vm terminated | filesystem destroyed

$

Capabilities

Dedicated kernel per run

Each sandbox runs inside a Firecracker microVM — not a container. Own kernel, filesystem, memory, and network stack. No cross-tenant leakage.

Session state persistence

Variables, files, and installed packages persist across execute() calls within a session. New session starts clean.

Deny-by-default egress

Outbound traffic is blocked unless explicitly allowed. Whitelist specific domains, CIDR ranges, or enable package managers per session or VM.

Stdout, stderr, and file capture

Every execute() returns stdout, stderr, and execution_time. Use upload_file() and download_file() to move artifacts in and out of the VM.

SDK reference

code-execution.py
pythonExecute + result
1from instavm import InstaVM
2
3client = InstaVM(api_key="sk_instavm_...")
4
5# State persists across calls in the same session
6client.execute("pip install pandas numpy")
7result = client.execute("import pandas; print(pandas.__version__)")
8
9print(result["stdout"]) # "2.1.4"
10print(result["execution_time"]) # 0.043
11
12client.close_session()

How it works

Three API calls from code to output

01

Create a client

InstaVM(api_key=...) provisions a Firecracker VM and returns a session. Specify cpu_count, memory_mb, and env if needed.

02

Call execute()

Pass any string of Python or Bash. Returns stdout, stderr, and execution_time. Packages installed here persist for subsequent calls.

03

Close or let it expire

client.close_session() tears down immediately. Or set timeout (vm_lifetime_seconds) and the VM auto-terminates.

Get started with InstaVM

Free tier available. No credit card required. VMs provision in under 200ms.

We use cookies
We use cookies to ensure you get the best experience on our website. For more information on how we use cookies, please see our cookie policy.

By clicking Accept, you agree to our use of cookies.

Learn more