Introducing a new way to review your PRs.

Read the announcement

arcboxlabs / arcbox

Run AI agents on real and isolated machines — own kernel, filesystem, and network — with <100ms boot. Local first, OCI compatible, pure Rust.

View on GitHub

32 documents · Updated Nov 6, 2026

docs / computer-runtime

Computer runtime and sandbox orchestration

The computer runtime assembles and manages isolated computing environments. It can run a computer as a nested microVM inside the Linux System VM or as a host VM. It owns the computer lifecycle, guest workload session, writable root filesystem, network attachment, checkpoints, warm restore resources, and recovery record. The workload engine selects and uses these environments, while images and snapshots and storage and recovery describe related image and persistence concerns.

System boundary

The runtime is the layer that turns a computer request into a usable VM-backed environment. A composer supplies the VM, network, guest-agent, and storage capabilities. The runtime combines them, starts the guest agent, and exposes a computer that can run workloads.

flowchart LR
    Caller[Workload engine] --> Runtime[Computer runtime]
    Runtime --> VM[Computer VM]
    Runtime --> Net[Guest network]
    Runtime --> Disk[Writable rootfs]
    VM --> Agent[Guest agent]
    Agent --> Workload[Workload process]
    Net --> VM
    Disk --> VM

The runtime is not the host VMM that boots the System VM. In the nested path, the host VMM starts the System VM, and this runtime starts one computer VM for each isolated environment. In the host path, the same runtime model manages a VM on the host location. The arcbox-vm-agent process runs as the init process inside each computer and is reached through the guest-agent boundary.

References: computer/…/README.md• L3-29 computer/…/lib.rs• L1-27 computer/…/environment.rs• L69-96

Run locations

The runtime uses a placement to describe where computers run and which rules apply there. The nested placement keeps the existing System VM behavior. The host placement adds the rules needed when a computer has its own host VM.

Nested placement

Nested placement runs a computer microVM inside the Linux System VM. Its checkpoints do not bind to a host operating-system build. Dirty-page tracking and detached clock sync are available because the nested guest has the matching VM support.

References: computer/…/environment.rs• L69-77 computer/…/environment.rs• L99-109 computer/…/environment.rs• L137-154

Host placement

Host placement runs a computer VM directly on the host location. Its checkpoints can be bound to the host operating-system build, and a composer can block capture while the host VM session is not safe to save. The placement also tells the runtime whether the guest network or the VM driver publishes host ports.

References: computer/…/environment.rs• L79-96 computer/…/environment.rs• L111-135 computer/…/capabilities.rs• L12-68

Runtime composition

NodeEnvironment is the boundary between the common lifecycle and environment-specific services. The runtime does not choose a VMM, a network adapter, or block-device tools. The composition root supplies all four required capabilities.

CapabilityPurpose
VM driverCreates, boots, observes, checkpoints, restores, and stops the computer VM
Guest networkReserves and activates the computer network attachment and reconciles abandoned allocations
Guest-agent factoryReaches the guest agent and defines the guest readiness signal
Copy-on-write managerGives the computer an isolated writable view of its root filesystem

The driver may prepare a VM before boot and may stage files into a private VM area. If it cannot do either, the runtime supplies a common fallback shape: VM creation is deferred until boot, and host paths are used directly or copied into per-VM storage as required. This lets boot, restore, pause, and warm-resource flows use the same high-level contract across locations.

References: computer/…/environment.rs• L25-58 computer/…/vmm.rs• L1-20 computer/…/vmm.rs• L36-87

Computer model

A computer is a durable identity around one isolated VM environment. Its public state describes whether the environment is starting, ready, running a workload, stopping, stopped, paused, or failed. The workload is separate from the computer, so the workload can exit while the computer returns to Ready.

Lifecycle ownership

Each computer has one lifecycle owner that serializes commands and publishes a read view. Slow work such as boot, restore, checkpoint, and release runs outside the command loop and reports back to that owner. Data-plane calls read the published guest connection directly, so command execution and file access do not wait behind lifecycle work.

The owner also protects replacement and cancellation. A forced removal can preempt boot after its resources have been handed over, and completion results from an older lifecycle attempt cannot change a newer state.

References: computer/…/sandbox.rs• L83-129 computer/…/mod.rs• L1-29 computer/…/mod.rs• L562-709

Workload sessions

Each computer has one active workload slot. The runtime claims that slot before it starts a process through the guest agent. Output is streamed to the caller while an exit watcher records the result, even when the caller stops reading. When the process ends, the computer becomes available for another workload unless its lifecycle policy removes or pauses it.

The guest-agent boundary also carries interactive input, terminal changes, signals, file operations, directory watches, clock sync, port readiness, and post-restore network setup. This keeps computer behavior independent of the transport used to reach the guest.

References: computer/…/mod.rs• L191-215 computer/…/boot.rs• L149-187 computer/…/agent.rs• L144-195

Computer lifecycle

The lifecycle turns a computer request into a ready environment, then keeps its resources consistent across workload use and teardown. It publishes Ready only after the VM and guest agent can serve the promised operations.

Computer creation

Creation applies defaults, reserves the computer identity, records durable ownership, obtains network state, prepares the writable rootfs, and starts the VM. The guest-agent readiness gate is armed before boot when the guest announces readiness by dialing out. After the guest answers, the runtime can run an initial command and a readiness probe before it reports the computer as ready.

The flow uses one VM shape for boot and restore: a kernel, one writable root disk, at most one network interface, a vsock guest-agent channel, and optional dirty-page tracking. The network supplies guest identity and connectivity. The storage service supplies the isolated disk. The driver starts the assembled shape.

sequenceDiagram
    participant Caller
    participant Runtime
    participant Network
    participant Storage
    participant Driver
    participant Guest as Guest agent

    Caller->>Runtime: Create computer
    Runtime->>Network: Reserve and activate network
    Runtime->>Storage: Create writable rootfs view
    Runtime->>Driver: Prepare, stage, and boot VM
    Runtime->>Guest: Wait for readiness
    Guest-->>Runtime: Ready
    Runtime->>Guest: Run initial command or probe
    Runtime-->>Caller: Starting, then Ready

References: computer/…/lifecycle.rs• L94-139 computer/…/boot.rs• L41-96 computer/…/spec.rs• L19-86

Computer teardown

Stop gives an active workload a bounded chance to exit, asks the guest to shut down, and then releases the VM, network, and writable storage. The durable computer record remains inspectable until removal. Remove ends the identity and clears the resources and internal lifecycle checkpoints.

Graceful process shutdown uses a handoff rather than stopping live computers. The next runtime process can then adopt them. If the handoff fails, the runtime reports that the affected computer will not survive process exit instead of claiming that it was saved.

References: computer/…/teardown.rs• L77-156 computer/…/lifecycle.rs• L530-663 computer/…/mod.rs• L176-214

Pause and resume

Pause captures a final checkpoint, keeps the writable disk, and releases the live VM and network allocation. The guest does not resume after capture because later guest writes would no longer match the retained memory image. Resume creates a new VM and network attachment from that saved state, then returns the same computer identity to Ready.

The disk path depends on the storage mode. A copy-on-write disk keeps its overlay. A copied rootfs is moved out of the VM area before the VM is released. Both paths preserve the exact state that resume needs.

References: computer/…/pause.rs• L1-29 computer/…/pause.rs• L39-52 computer/…/resume.rs• L32-54

Warm resources

Warm resources reduce the time needed to create a computer without changing the computer contract. They are ordinary checkpoint-backed resources with extra ownership and cleanup rules.

Warm snapshots

The warm cache stores a ready, idle computer snapshot for a repeatable boot shape. Its key includes the effective kernel, rootfs, boot arguments, VM size, input content fingerprints, and host build when the placement requires one. A matching create restores the snapshot. A cache miss cold-boots and publishes a snapshot after the guest is ready.

The cache accepts only shapes that can restore into a fresh VM. It excludes caller-pinned boot recipes, explicit guest addresses, bind mounts, SSH setup, and networkless computers. It limits the number of distinct keys and uses single-flight publication so concurrent creates do not build the same warm state.

References: computer/…/warm.rs• L19-30 computer/…/warm.rs• L59-130 computer/…/warm.rs• L103-151

Restore slots

The restore pool pre-stages the fixed work needed to restore a checkpoint. A slot contains a prepared VM, staged checkpoint data, and the writable rootfs view, but it has no network identity until a create claims it. This keeps one slot reusable across computer identities and lets network setup happen for the actual caller.

Successful restores can refill the pool in the background. A dead slot or a deleted source checkpoint is discarded, and its durable record lets startup recovery reclaim partial slots.

References: computer/…/pool.rs• L1-14 computer/…/pool.rs• L26-45 computer/…/pool.rs• L345-415

Workload contract

The workload contract turns image settings and a create request into the small process description that the guest agent can run. It uses the OCI model as input, but the computer VM is the isolation boundary rather than an in-guest container runtime.

OCI workload translation

Image entrypoint, command, environment, working directory, user, terminal size, and bind mounts become one OCI config.json and then a guest-agent start command. Named users and groups resolve against the image account files before the command starts. A workload with no process arguments boots the computer and waits for a later execution request.

The runtime refuses fields that it cannot honor. This includes in-guest namespaces, seccomp, capabilities, resource limits, devices, hooks, and other unsupported process or mount settings. It fails closed instead of silently running with weaker behavior.

References: computer/…/workload.rs• L1-19 computer/…/spec.rs• L61-163 computer/…/start.rs• L21-40 computer/…/check.rs• L8-24

Image inputs

The workload layer can qualify Docker-style image references and pull an image for the Linux guest platform when registry support is enabled. The resolved image keeps its runtime configuration and manifest identity so the image can produce both a rootfs and a matching workload request.

References: computer/…/image.rs• L7-20 computer/…/image.rs• L22-77 computer/…/image.rs• L101-135

Rootfs and VM staging

The rootfs path supplies a bootable writable disk and the init agent that makes the guest controllable. The VM staging path then places the kernel, disk, and checkpoint data where the selected VM driver can read them.

Rootfs images

RootfsBuilder converts an OCI layout, an overlay2 source, or a resolved image into ext4. It injects the static Linux vm-agent at the standard init path and links guest DNS state into the runtime filesystem. It also builds a default busybox image when no rootfs is supplied.

Converted images are cached by their source and agent content. Durable computer records, checkpoints, and templates keep source images pinned while they may still be needed. Caller-owned rootfs builds publish atomically and keep an existing destination when conversion or cancellation fails.

References: computer/…/rootfs.rs• L1-27 computer/…/rootfs.rs• L138-228 computer/…/build.rs• L31-107 computer/…/vm_agent.rs• L18-81

Writable storage

Each live computer receives an isolated writable view of its base rootfs. The runtime prefers copy-on-write storage and falls back to a private rootfs copy when the environment cannot stage the copy-on-write device. The source image remains unchanged.

The same storage choice controls pause and resume. Copy-on-write state is detached and retained. A private copy is parked and later handed back into a fresh VM. Storage accounting reports the retained overlay or parked rootfs and adds the pause checkpoint while the computer is paused.

References: computer/…/boot.rs• L139-221 computer/…/pause.rs• L39-143 computer/…/storage.rs• L1-18

VM staging

The runtime gives every driver a prepared-VM view. A driver with a private staging area receives files there. A driver that reads host paths uses those paths for read-only inputs and a per-computer area for writable disks. This preserves the rule that a guest must not write into a caller's base image.

The VM specification keeps disk names, boot paths, guest networking, vsock, and checkpoint inputs aligned. This common shape prevents boot, restore, and resume from describing different computers to the driver.

References: computer/…/host_staging.rs• L1-13 computer/…/host_staging.rs• L58-96 computer/…/spec.rs• L89-129

Checkpoints and recovery

Checkpoints preserve a computer's VM memory and disk relationship for later restore. Durable records describe the resources that must be reclaimed if the runtime stops at any point. The checkpoint catalog, rootfs manager, and template catalog share this lineage with the wider snapshot system described in images and snapshots.

Checkpoint rules

User checkpoints restore into a new computer identity with the checkpoint's kernel, rootfs, and VM geometry. A pause checkpoint is different: it belongs to the original computer and retains its writable disk, so the normal restore path refuses to clone it. Host checkpoints can also carry the host operating-system build and refuse restore on a different build.

Checkpoint capture is allowed only when the selected driver and placement can restore it. A host placement can ask a checkpoint gate before every capture. Bind-mounted computers cannot pause because the shared host state is not part of the VM checkpoint.

References: computer/…/checkpoint.rs• L54-73 computer/…/checkpoint.rs• L179-223 computer/…/capabilities.rs• L35-105

Startup reconciliation

On startup, the runtime first reconciles abandoned VM, network, storage, and staging resources. It adopts a live computer only when its durable record, VM handle, guest-agent path, network state, and writable disk state agree. An incomplete or unusable record is released or left in a state that can be inspected and removed.

This startup barrier runs before create and restore allocate per-computer resources. It prevents a new computer from reusing an identity while recovery is still cleaning resources with the same deterministic names.

References: computer/…/sandbox.rs• L216-305 computer/…/sandbox.rs• L372-409 computer/…/mod.rs• L477-487

Guest readiness

The guest-agent port defines three readiness patterns: guest dial-out, host polling, and an agent probe. The boot flow arms a dial-out listener before VM start, or waits through the selected poll or probe path after start. A computer is not ready only because the VM process exists; it is ready when the guest agent serves requests.

After boot, restore, or resume, the runtime synchronizes guest time. Nested guests can do this in the background because their platform supplies a guest clock source. Host guests wait for the sync because it is their only clock source.

References: computer/…/agent.rs• L42-100 computer/…/boot.rs• L41-96 computer/…/clock.rs• L20-60

Capability checks

The runtime reports whether a placement can support pause, resume, warm restore, port publishing, and bind mounts. These answers combine the selected driver capabilities with placement rules, so callers can reject an impossible request before creating a computer.

References: computer/…/capabilities.rs• L12-68 computer/…/environment.rs• L69-96

Change checklist

When these files or sections are changed, remember to consider these:

  • A new VM feature must be represented by the driver capability contract and supplied by every composition that claims to support it.
  • Changes to placement must keep checkpoint build binding, checkpoint gating, clock behavior, and port publication aligned with the selected location.
  • Changes to readiness must keep the selected guest-agent signal armed and observed in the correct order.
  • Changes to boot or restore staging must preserve the shared root-disk name and the distinction between writable copies and copy-on-write views.
  • Changes to warm keys must include every input that can make a memory snapshot unsafe to reuse, including image content and host build where relevant.
  • Changes to pause or resume must preserve the retained disk and pause checkpoint as one recoverable state.
  • Changes to workload fields must update both OCI-to-workload validation and the guest-agent start command contract; unsupported fields must not be ignored.
  • Changes to rootfs agent injection must keep the guest init path, guest architecture, static linking, and DNS filesystem convention aligned.
  • Changes to durable records or staging names must preserve startup reconciliation and adoption of resources after restart.

Important failure modes

TriggerConsequenceGuard
The supplied driver lacks the guest-agent or readiness capabilityA computer cannot reach ReadyConstruction validates the required driver capabilities
A dial-out readiness listener is armed after VM startThe guest's one readiness event can be lostReadiness is armed before boot
Copy-mode pause releases the VM before parking the rootfsResume has no writable diskThe rootfs is removed from the VM area before release
A warm key omits a changed kernel, rootfs, geometry, or host buildA stale memory snapshot can be restoredThe key includes boot shape, input fingerprints, geometry, and placement build
A workload asks for isolation or a guest-agent field the runtime cannot applyThe workload would run with weaker behaviorThe workload contract rejects the field
A process stops before startup reconciliation finishesNew resources can collide with resources being reclaimedCreate and restore wait for the reconciliation barrier
A rootfs build is cancelled during conversionA partial image could replace a valid imageThe build finishes or removes its temporary image before publication
A checkpoint is restored on an incompatible host buildThe VM state may not be usable on that hostHost placement records and checks the operating-system build

Key files

FileWhy to read it
computer/…/lib.rsDefines the runtime boundary and public computer concepts
computer/…/environment.rsExplains nested and host placement and the supplied capabilities
computer/…/sandbox.rsShows manager ownership, startup reconciliation, and public computer state
computer/…/lifecycle.rsShows create, stop, remove, inspect, and handoff behavior
computer/…/mod.rsShows serialized lifecycle ownership and task preemption
computer/…/boot.rsShows VM boot and guest readiness
computer/…/pause.rsShows how pause preserves writable state
computer/…/restore.rsShows checkpoint restore and network reattachment
computer/…/resume.rsShows in-place resume and failure unwind
computer/…/pool.rsShows pre-warmed restore slots
computer/…/warm.rsShows warm-cache identity and eligibility
computer/…/workload.rsDefines the workload contract and fail-closed behavior
computer/…/spec.rsShows image and request composition into an OCI spec
computer/…/rootfs.rsShows rootfs conversion, caching, and default image creation
computer/…/boot.rsShows copy-on-write and copy fallback for writable disks
computer/…/vmm.rsShows the common VM preparation and staging view
computer/…/agent.rsDefines guest readiness and guest operations
computer/…/README.mdGives the crate-level boundary and deployment model