The micro-VM for AI agents — light enough to embed on your laptop, elastic enough to power an agentic cloud.
Storage
Rootfs preparation
The rootfs builder assembles a container filesystem from OCI image layers:
Image Layers Rootfs Builder Box Rootfs
┌─────────┐ ┌─────────────┐ ┌─────────────┐
│ Layer 1 │────┐ │ │ │ /bin │
├─────────┤ │ │ Extract & │ │ /etc │
│ Layer 2 │────┼────▶│ Overlay │─────────▶│ /usr │
├─────────┤ │ │ │ │ /var │
│ Layer N │────┘ └─────────────┘ │ ... │
└─────────┘ └─────────────┘
Key operations:
- Layer extraction and overlay mounting
- DNS configuration injection
- Copy-on-write snapshot creation
The minimal guest rootfs is cached separately from the container rootfs. BoxLite checks artifact metadata (size, modification time, and inode, plus device and change time) to reuse an unchanged guest rootfs without rereading and validating the binaries or rebuilding the ext4 image. A cache miss triggers full artifact validation and a rebuild.
ext4 image disk cache
On a cache miss, concurrent requests in the same process for the same image digest and reserved disk space share one in-flight ext4 build. Once the build installs the disk in the cache, waiting requests reuse it. Cache hits and builds for other image digests or reserve sizes do not wait for that build.
Volume management
When neither volumes nor mount specs are configured, BoxLite skips volume resolution, including volume lookups and user mount setup.
Supported volume types:
| Type | Description | Use Case |
|---|---|---|
| virtiofs bind | Caller-selected host directory or file | Sharing a specific host path with a box |
| Named local volume | BoxLite-managed directory shared over virtio-fs | Persistent data shared independently of box lifecycle |
| QCOW2 disk | Copy-on-write disk image | Box-private root filesystem, kept while the box exists |
Named volume identity and payload are separate: {volume-id}/.metadata.json stores id, name, and
creation time, while only {volume-id}/_data/ is exposed to the guest. Box configuration stores the
canonical id rather than the host path. Volume removal is blocked while any persisted box
configuration references that id. See Mounting volumes.
QCOW2 features:
- Thin provisioning (allocate on write)
- Snapshot support
- Shared base images across Boxes
Online disk snapshots
A local libkrun box can take a snapshot of its managed ext4 container disk while it runs.
BoxLite attempts to freeze guest filesystems, sends SIGSTOP to the shim, and
copies the writable QCOW2 layer to snapshots/<name>/disk.qcow2 before sending
SIGCONT. The box continues to write its original disk.
Online copies share the source disk's existing backing images. Administrators must keep those images available and read-only for the lifetime of the snapshot.
Guest filesystem freezing is best effort. Snapshot restore requires a stopped box.
An interruption before registration in SQLite can leave a snapshot directory behind. Online and stopped snapshot creation both reject an existing directory with the requested name, even if the directory has no snapshot record.
Online disk clones
Cloning a running box uses the same QCOW2 copy operation. A batch shares one
base copy under bases/, and each clone writes to its own COW layer. The source
box resumes writing its original disk before the base and clones are registered.
Attempt guest freeze → SIGSTOP → synchronous QCOW2 copy → SIGCONT → thaw if frozen
On a single-threaded Tokio runtime, other tasks on that thread wait for the copy to finish.
Removing a box can reclaim its clone base when no registered box or managed disk still uses it. A clone being registered or an incomplete disk check leaves the base in place. If the batch fails before any clone registers, the base can remain on disk.
File copy conflicts
With CopyOptions::no_overwrite(), local copies add new files into existing
directories and reject existing files, symlinks, and incompatible entry types.
Existing bytes and directory metadata are preserved. Entries written before a
later conflict remain; extraction does not roll back the archive. Directories
created during extraction still receive permissions from later directory headers.
Guest extraction hands each object this copy creates to the box user the moment
it is created, by path. Objects that predate the copy keep their owner; existing
directories retain their ownership, and with overwrite=false their permissions
too. An archive's ./ header preserves an existing destination's permissions
when overwrite is false. A failed creation never changes ownership of the object
that occupied the name.
The upload trusts the box's own workload: ownership and permissions are applied
by path at creation, the way GNU tar and docker cp extract. A workload that
concurrently replaces a directory on the upload path can therefore redirect a
late metadata update onto its own replacement; uploads keep earlier writes after
a conflict. Request paths follow image directory symlinks such as
/lib -> /usr/lib.
REST runtimes refuse copy-in with overwrite=false when runner support cannot
be established. This prevents older runners from silently replacing files.
REST copy-out currently extracts with overwrite enabled and does not enforce
CopyOptions::no_overwrite().
Home directory
BoxLite keeps boxes, images, and its database under ~/.boxlite by default. The directory's
layout is in File formats.