Overview
BoxLite is a local-first micro-VM sandbox for AI agents. It follows the SQLite philosophy: a library that can be embedded directly into applications without requiring a daemon or external service. Boxes are stateful — they retain packages, files, and environment across stop/restart cycles.Throughout this documentation, we use “Box” to refer to an isolated execution
environment (the underlying implementation uses a lightweight VM). A Box provides hardware-level
isolation while presenting a simple, container-like interface.
Core Design Philosophy
BoxLite is built around several key principles:- Stateful workspaces — Boxes retain state across stop/restart, no rebuilding on every interaction
- Embeddable library model — no daemon or external service required, just link and use
- Hardware-level isolation — each Box runs in a lightweight VM for strong security boundaries
- Container-like interface — familiar OCI image and exec workflows despite VM-backed isolation
- Lazy initialization — heavy work (image pulling, Box startup) is deferred until first use
- Defense-in-depth security — OS-level sandboxing layered on top of hardware virtualization
High-Level Architecture
The architecture spans multiple layers: host runtime, subprocess isolation, OS-level sandboxing, and guest VM execution.Concurrency Model
Thread Safety
BoxliteRuntime:Send + Sync, safely shareable across threadsLiteBox:Send + Sync, handles can be passed between threads- Single
RwLockprotects all mutable runtime state - Metrics use
AtomicU64for lock-free updates
Single Lock Design
BoxLite uses oneRwLock for all mutable state:
- Eliminates nested locking complexity
- Simplifies reasoning about concurrency
- Filesystem lock prevents multiple runtimes using same
BOXLITE_HOME
Async Design
- All I/O operations are async (Tokio runtime)
- Streaming operations use
futures::Stream - gRPC uses tonic’s async support
Error Handling
All public APIs returnBoxliteResult<T> which is an alias for Result<T, BoxliteError>.
Directory Layout
Default home directory:~/.boxlite
SDK Architecture
BoxLite provides language-specific SDKs built on the core Rust library.Shared Library
Theboxlite-shared crate contains data types, error definitions, and constants shared between the
host runtime, the shim, and the guest agent.
Location: boxlite-shared/
Key Components:
BoxliteError: Centralized error typeConstants: Shared constants (e.g. socket paths, default ports)Transport: gRPC transport utilities
Explore the Architecture
Core Components
Deep dive into BoxliteRuntime, LiteBox, ShimController, Jailer, Guest Agent, and the VMM abstraction layer.
Security & Isolation
Understand the defense-in-depth security model, OS-level sandboxing, and platform-specific isolation mechanisms.
Networking & Storage
Learn about network backends, port forwarding, image management, rootfs assembly, and volume types.

