cd /news/ai-agents/one-sdk-one-microvm-runtime-from-lap… · home › topics › ai-agents › article
[ARTICLE · art-180719] src=blog.boxlite.ai ↗ pub= topic=ai-agents verified=true sentiment=↑ positive

One SDK, one microVM runtime, from laptop to BoxLite Cloud

BoxLite released an open-source runtime that embeds the libkrun microVM library in-process, using macOS Hypervisor.framework on Apple Silicon and Linux KVM on Linux and WSL2, with no Docker daemon or root privileges required. The same SDK runs locally, against a self-hosted `boxlite serve` REST server on port 8100, or on managed BoxLite Cloud, where idle instances stop compute billing after 900 seconds by default (`auto_stop=900`) and wait up to 30 seconds for readiness on the next request. BoxLite positions the runtime against Docker's shared-kernel containers and Firecracker's Linux-only KVM dependency, citing Docker startup of about 100 to 500 milliseconds and E2B Pro pricing of a $150 monthly base fee plus roughly $0.166 to $0.17 per hour for a 2 vCPU, 4 GiB sandbox.

key takeaway

BoxLite's SDK runs the same libkrun-based microVM locally via Hypervisor.framework or KVM and in the cloud via a REST endpoint, and on BoxLite Cloud idle sandboxes stop compute billing after 900 seconds by default (auto_stop=900).

by read6 min views2 publishedDec 3, 2026

On macOS, Docker Desktop holds memory for a persistent Linux VM, while Firecracker only runs on Linux KVM and can't reproduce production locally. Moving development to cloud sandboxes solves isolation, and you end up paying by the second while the agent waits for LLM output or human approval. BoxLite embeds libkrun in-process and calls macOS Hypervisor.framework or Linux KVM with no external daemon. When you move to servers or BoxLite Cloud, an environment variable points the same SDK code to a REST endpoint. On BoxLite Cloud, idle instances stop compute billing after 900 seconds by default (auto_stop=900) and wait up to 30 seconds for readiness on the next request.

Running LLM-generated commands on bare macOS risks accidental file deletion. Docker Desktop keeps untrusted code off the host, though it needs a resident Linux VM and daemon, eats memory, and comes with commercial licensing limits. In production, cloud sandboxes use Firecracker for hardware isolation, which depends on Linux /dev/kvm and can't run on macOS. Running bare metal or Docker locally and cloud microVMs in production lets kernel versions, syscall behavior, and mount permissions drift apart.

Moving all development and debugging to cloud sandboxes creates a billing problem. Based on E2B public pricing, the Pro tier has a $150 monthly base fee plus per-second usage billing. The default 2 vCPU and 4 GiB setup runs about $0.166 to $0.17 per hour. A typical agent runs a command for 2 seconds, waits 20 seconds for model output, or s for several minutes during human approval. The sandbox keeps billing through those waits until it stops.

The tradeoffs come down to isolation boundaries and cross-platform support.

Approach Isolation boundary Local macOS Apple Silicon External daemon Best fit
Docker containers Shared host kernel (namespaces and cgroups) Requires Docker Desktop or Lima Requires dockerd Local build caching and trusted service development
Firecracker Hardware virtualization with separate guest kernel Unsupported, tied to Linux KVM Requires orchestration and control plane Multi-tenant Linux cloud sandboxes
BoxLite (via libkrun ) Hardware virtualization plus host OS jailer Native Hypervisor.framework None, embedded library Embedded local-first and cross-platform execution

Docker has mature build caching and fast startup. The BoxLite FAQ puts Docker startup at about 100 to 500 milliseconds. Because containers share the host kernel, Docker is a poor fit for running untrusted code. Firecracker is common for multi-tenant isolation on Linux clouds, and it can't run locally on a Mac.

BoxLite is designed like SQLite: it wraps libkrun as an open-source runtime library that embeds inside your app, with no Docker daemon and no root privileges. On Apple Silicon Macs, it calls Hypervisor.framework. On Linux and WSL2, it calls KVM. Both platforms run standard OCI images.

When a Box starts, ShimController spawns an isolated boxlite-shim child process. The host adds an OS jailer on top of hardware virtualization: namespaces, Seccomp BPF, and cgroups v2 on Linux, or Seatbelt (/usr/bin/sandbox-exec) and rlimits on macOS. Once an image is cached locally, startup completes in seconds, close to Docker in daily use.

BoxLite exposes three ways to run: the open-source local embedded runtime, a self-hosted boxlite serve REST server, and managed BoxLite Cloud. All three use the same SDK interface.

flowchart TB
    App["Agent code (Python / Node / Go / Rust)"]
    SDK["BoxLite SDK (SimpleBox / Boxlite)"]
    Local["Local embedded Boxlite.default()"]
    Serve["Self-hosted REST boxlite serve :8100"]
    Cloud["BoxLite Cloud (managed service)"]
    Runner["Cloud runner node (embedded BoxLite)"]
    Mac["Apple Silicon (Hypervisor.framework + Seatbelt)"]
    Linux["Linux / WSL2 (KVM + Namespaces / Seccomp)"]
    AutoStop["AutoStop / AutoResume (default 900s idle stop, waits up to 30s on resume)"]

    App --> SDK
    SDK --> Local
    SDK --> Serve
    SDK --> Cloud
    Local --> Mac
    Local --> Linux
    Serve --> Mac
    Serve --> Linux
    Serve -.-> AutoStop
    Cloud --> AutoStop
    Cloud --> Runner
    Runner --> Linux

Your execution code stays the same between local development and remote runs. An environment variable picks the target runtime:

import os
from boxlite import Boxlite, BoxliteRestOptions, SimpleBox

def get_runtime() -> Boxlite:
    if os.getenv("BOXLITE_REST_URL"):
        return Boxlite.rest(BoxliteRestOptions.from_env())
    return Boxlite.default()

async def run_agent_task(code: str) -> str:
    async with SimpleBox(image="python:slim", runtime=get_runtime()) as box:
        result = await box.exec("python", "-c", code)
        return result.stdout

When BOXLITE_REST_URL is unset locally, your laptop runs an embedded microVM with no cloud meter running during long human-approval waits. When you point it at boxlite serve or BoxLite Cloud, the REST runtime handles idle reclamation.

On BoxLite Cloud, defaults are auto_stop=900 (stop after 900 idle seconds), auto_delete=0 (keep the box instead of auto-deleting), and auto_resume=True. Stopping a box halts compute billing (vCPU and memory), while stopped boxes with auto_delete=0 still accrue disk charges until deleted. Note that idle means no SDK, terminal, or preview traffic, so background work running inside a box doesn't count as activity and can still be stopped.

A cloud reaper checks for idle boxes every 10 seconds using locks and conditional updates to avoid concurrent overwrites. Once a Box enters STOPPED, the next command, file transfer, or WebSocket connection goes through BoxAutoResumeService, which triggers a start, waits up to 30 seconds for readiness over Redis state events, and forwards the request. Metrics scraping (metrics) and standalone port proxies don't refresh the activity timer or trigger auto-resume, so monitoring probes won't keep idle boxes alive.

You can also shorten the idle timeout on the REST side for shorter workloads:

from boxlite import ApiKeyCredential, Boxlite, BoxOptions, BoxliteRestOptions

rt = Boxlite.rest(BoxliteRestOptions(
    url="http://localhost:8100",
    credential=ApiKeyCredential("local-dev-key"),
))
opts = BoxOptions(
    image="python:slim",
    auto_stop=300,
    auto_resume=True,
    auto_delete=0,
)
box = await rt.create(opts, name="agent-session")

AutoStop keeps persistent disk and volume data intact. When the next request wakes the Box, disk state is preserved, while in-memory processes start fresh.

Pick the mode that fits your deployment scale and ops budget.

Dimension OSS local embedded boxlite serve BoxLite Cloud
Role and deployment Apache-2.0 in-process library, zero local dependencies, no daemon Single-host self-hosted REST server, listens on 127.0.0.1:8100 by default (0.0.0.0 requires--api-key ) Managed cloud service on GCP, no self-managed ops
Lifecycle and sleep Host app controls start and stop Auto-stop and resume with in-memory policy and 30-second scans AutoStop and AutoResume with Redis event resumes, default 900-second idle stop
Disk snapshots and migration QCOW2 disk snapshots, clone, and .boxlite import and export QCOW2 disk snapshots, clone, and .boxlite import and export Managed platform handles instance lifecycle
Storage and networking Host path mounts, local TCP port forwarding, and tunnel Persistent instance disks and REST API access Managed volumes ( managed_volume ),network/tunnel , and preview proxy
Observability Per-Box and global metrics Per-Box and global metrics Per-Box metrics

BoxLite supports Apple Silicon macOS 12 and later, Linux with /dev/kvm, and Windows WSL2 with KVM enabled.

── more in #ai-agents 4 stories · sorted by recency
── more on @boxlite 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/one-sdk-one-microvm-…] indexed:0 read:6min 2026-12-03 · —