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 / application-control-plane

Application control plane

ArcBox's application control plane is the host-facing layer that turns local user actions into managed VM, machine, sandbox, and workload operations. The abctl command-line tool, the long-running daemon, the Connect and Docker services, SSH access, host sandboxes, and the privileged helper share one ownership model while keeping normal runtime work outside the root privilege boundary.

Application roles

The applications have separate roles but share one runtime and one set of host state. The CLI selects a profile and entry point. The daemon owns long-running work. The API and Docker services expose that work to clients. SSH provides guest access. The host sandbox location can run sandbox workloads on the host when the platform supports it. The helper performs only the host changes that need elevated rights.

Command-line interface

abctl is the main user entry point for daemon control, machine and sandbox actions, Docker and Kubernetes integration, diagnostics, setup, System VM settings, and QEMU asset import. It validates command options, selects the active profile and sockets, then either talks to the daemon or performs a local integration task. app/…/mod.rs• L18-60 app/…/mod.rs• L136-234 app/…/main.rs• L45-180

The CLI keeps user-facing control separate from daemon ownership. For example, abctl daemon start launches arcbox-daemon, while the daemon owns its lock, process state, runtime, and shutdown. abctl system backend and abctl system resources send changes to the daemon because those changes affect the System VM and can stop running workloads. app/…/daemon.rs• L157-206 app/…/daemon.rs• L368-380 app/…/system.rs• L77-137

References: app/…/mod.rs• L18-60 app/…/mod.rs• L136-234 app/…/main.rs• L45-180 app/…/daemon.rs• L157-206 app/…/daemon.rs• L368-380 app/…/system.rs• L77-137

Daemon process

arcbox-daemon is the host process that owns ArcBox runtime state for one profile. It prepares host state, starts the control plane, admits machine operations, composes the optional host sandbox location, starts the optional System VM and its dependent services, reports readiness, and coordinates shutdown. app/…/main.rs• L218-272 app/…/pipeline.rs• L43-49 app/…/pipeline.rs• L219-237

Host admission and System VM readiness are separate. The daemon can keep machine and host services available when the System VM is disabled, cannot start, or is still preparing. A composed host sandbox location follows host admission and does not depend on the System VM. Docker and Kubernetes depend on the System VM and become available only after their endpoints are bound. See Daemon lifecycle and host orchestration. app/…/pipeline.rs• L150-170 app/…/pipeline.rs• L219-237 app/…/host_sandboxes.rs• L31-53

The daemon publishes setup progress through the control API. Clients should use the setup stream and the separate System runtime state instead of process logs or timing guesses. Every setup update remains observable, including fast phase changes during startup. app/…/system.rs• L27-48 app/…/system.rs• L68-110 app/…/system.rs• L177-193

References: app/…/main.rs• L218-272 app/…/pipeline.rs• L43-49 app/…/pipeline.rs• L150-170 app/…/pipeline.rs• L219-237 app/…/host_sandboxes.rs• L31-53 app/…/system.rs• L27-48 app/…/system.rs• L68-110 app/…/system.rs• L177-193

Host sandbox location

The host sandbox location is a second sandbox run location alongside the nested System VM. On supported macOS hosts, the daemon composes it before host admission and exposes it through the same Sandbox API model; it can therefore serve sandbox lifecycle and data operations while the System VM is stopped, disabled, or still starting. app/…/host_sandboxes.rs• L1-10 app/…/host_sandboxes.rs• L31-53 app/…/host_sandboxes.rs• L15-37

The API chooses the host location for new work when it is available. Existing sandbox and snapshot ownership decides the location for later operations. If the host location is unavailable, requests use the nested location when the System VM can support sandbox execution. The capability response tells clients which location is available and which features it supports. app/…/sandbox_route.rs• L1-13 app/…/sandbox_route.rs• L68-132 app/…/control.rs• L40-84

The host location has its own cleanup stream. The daemon keeps that stream active for the daemon lifetime and completes expired or idle sandbox cleanup work before it stops the host sandbox manager. A composition failure leaves the location unavailable instead of preventing the whole daemon from starting. app/…/host_sandboxes.rs• L31-64 app/…/host_sandboxes.rs• L107-158

References: app/…/host_sandboxes.rs• L1-10 app/…/host_sandboxes.rs• L31-64 app/…/host_sandboxes.rs• L107-158 app/…/host_sandboxes.rs• L15-67 app/…/sandbox_route.rs• L1-13 app/…/sandbox_route.rs• L68-132 app/…/control.rs• L40-84

Public API

The public API is the daemon's general control surface for local tools and applications. It serves system status, machine operations, migration, Kubernetes, statistics, and sandbox services over one Connect router. The same service boundary supports Connect, gRPC, and gRPC-Web clients. app/…/mod.rs• L1-23 app/…/mod.rs• L260-315

Sandbox services keep a control-plane and data-plane split. Lifecycle, events, published ports, snapshots, and the template catalog manage sandbox state. Process execution and filesystem transfer carry workload data. Each request is routed to the host sandbox location or the nested System VM location, while the runtime keeps host-side lifecycle, storage, DNS, and port rules. app/…/mod.rs• L5-14 app/…/control.rs• L86-181 app/…/process.rs• L43-53 app/…/filesystem.rs• L23-28 app/…/snapshot.rs• L15-24 app/…/template.rs• L1-5 app/…/sandbox_host.rs• L1-11

The API uses separate runtime admission levels. Early diagnostics can answer while the System VM is not ready. Host services can manage machines and a composed host sandbox location. System services wait for the System VM. A request can select a local VM with the x-machine header, but Sandbox V1 accepts only the System VM transport identity and then applies its host-or-nested location routing. app/…/mod.rs• L74-78 app/…/mod.rs• L155-202 app/…/sandbox_route.rs• L68-132

Errors preserve client-visible meaning across the host and guest boundary. The API maps configuration, state, transport, and guest-agent failures to stable Connect codes. Sandbox failures can also carry a typed error detail with an action for the client, and unsupported nested virtualization is rejected before a guest call. app/…/error.rs• L44-108 app/…/sandbox_errors.rs• L17-50

See API and Docker compatibility for service and request details.

References: app/…/mod.rs• L1-23 app/…/mod.rs• L260-315 app/…/mod.rs• L74-78 app/…/mod.rs• L155-202 app/…/sandbox_route.rs• L68-132 app/…/control.rs• L40-181 app/…/process.rs• L43-53 app/…/filesystem.rs• L23-28 app/…/snapshot.rs• L15-24 app/…/template.rs• L1-5 app/…/sandbox_host.rs• L1-11 app/…/error.rs• L44-108 app/…/sandbox_errors.rs• L17-50

Docker compatibility

The Docker-compatible service gives the standard Docker CLI and other Docker clients a local socket that behaves like a Docker Engine endpoint. It is a compatibility boundary rather than a second container engine: ArcBox applies host-side policy and forwards container work to the guest Docker runtime. app/…/guest_docker.rs• L11-17 app/…/guest_docker.rs• L87-103

The daemon binds Docker only when the System VM path is enabled. It checks guest runtime readiness and the reported guest endpoint before treating Docker as ready. VM-host-only mode therefore keeps host control and machine access but has no Docker socket or Docker CLI integration. app/…/mod.rs• L101-164 app/…/guest_docker.rs• L35-63 app/…/initialization.rs• L64-79

Users enable this path through an ArcBox Docker context. Production integration may change the global Docker choice. Development profiles use an explicit context so an isolated instance does not redirect unrelated Docker work. The request, readiness, and forwarding rules are described in API and Docker compatibility. app/…/main.rs• L198-203 app/…/mod.rs• L186-204

References: app/…/guest_docker.rs• L11-17 app/…/guest_docker.rs• L35-63 app/…/guest_docker.rs• L87-103 app/…/mod.rs• L101-164 app/…/initialization.rs• L64-79 app/…/main.rs• L198-203 app/…/mod.rs• L186-204

SSH access

SSH access provides a direct path from the host to a managed guest. The CLI selects the target machine and connection settings, while the daemon's host services supply the reachable endpoint. SSH tunneling extends this path to local forwarding when a service must remain inside the guest network. See SSH access and tunneling for the access and tunnel model. app/…/ssh.rs• L1-120 app/…/tunnel.rs• L1-120 app/…/mod.rs• L31-81

SSH is a guest-access path rather than a replacement for the control API. Use the API for ArcBox state and lifecycle operations. Use SSH for shell access, guest-side commands, and local access to services through a tunnel. app/…/ssh.rs• L121-244 app/…/tunnel.rs• L121-244

References: app/…/ssh.rs• L1-120 app/…/tunnel.rs• L1-120 app/…/mod.rs• L31-81 app/…/ssh.rs• L121-244 app/…/tunnel.rs• L121-244

Privileged helper

The privileged helper is a small root-owned service for host mutations that the user daemon should not perform with root rights. Its boundary covers operations such as host routes, DNS resolver files, selected socket links, CLI links, and the managed host alias. The daemon and CLI use a client library rather than calling privileged operations directly. app/…/lib.rs• L1-21 app/…/lib.rs• L45-109 app/…/client.rs• L35-69

The helper is normally started on demand by launchd. In release mode it authenticates the connecting process before dispatching a request, and it checks its independent wire version before mutation calls proceed. This keeps the privilege boundary narrow and makes an old helper fail as an integration problem instead of receiving new requests with an unsafe meaning. See Privileged helper boundary for the authentication, installation, and ownership model. app/…/main.rs• L1-6 app/…/server.rs• L130-168 app/…/peer_auth.rs• L1-19 app/…/client.rs• L40-69

References: app/…/lib.rs• L1-21 app/…/lib.rs• L45-109 app/…/client.rs• L35-69 app/…/main.rs• L1-6 app/…/server.rs• L130-168 app/…/peer_auth.rs• L1-19

Client access paths

The applications expose distinct local entry points for distinct client needs. The control socket carries ArcBox API calls. The Docker socket carries Docker Engine calls. SSH uses guest access and forwarding paths. The helper socket is not a user API; it is an authenticated boundary used by trusted ArcBox processes for selected host mutations.

Control socket

The daemon's control socket is the common path for abctl machine, sandbox, migration, system, and diagnostic operations. The CLI selects the socket from explicit overrides, the active layout, or the Docker socket's instance, so all commands address the same profile when the user selects one instance. app/…/mod.rs• L18-60 app/…/main.rs• L48-114

One protocol-aware server accepts the control socket traffic. HTTP/2 supports native gRPC and streaming calls. HTTP/1.1 supports Connect and gRPC-Web, including local clients that do not have a gRPC toolchain. app/…/mod.rs• L1-4 app/…/control_plane.rs• L1-11 app/…/control_plane.rs• L32-68

The control socket is available before the slow VM work completes. Clients use setup status to observe startup, while normal runtime calls remain unavailable until their required runtime handle is admitted. app/…/mod.rs• L33-38 app/…/mod.rs• L282-315 app/…/mod.rs• L74-78

References: app/…/mod.rs• L18-60 app/…/main.rs• L48-114 app/…/mod.rs• L1-4 app/…/control_plane.rs• L1-11 app/…/control_plane.rs• L32-68 app/…/mod.rs• L33-38 app/…/mod.rs• L282-315 app/…/mod.rs• L74-78

Docker socket

The Docker socket is the stable host entry point for Docker tools. The daemon binds it only for a Linux System VM and records the listener before it publishes System readiness. This makes Docker readiness mean that the local endpoint and guest runtime are usable, not only that the daemon process exists. app/…/mod.rs• L101-164 app/…/guest_docker.rs• L35-63

Docker context state lives outside the daemon process. Enabling the context records the ArcBox endpoint and preserves the user's former choice for restoration. Production and development profiles use different integration rules so an isolated instance does not take over a global Docker selection. app/…/main.rs• L198-203 app/…/mod.rs• L186-204

References: app/…/mod.rs• L101-164 app/…/guest_docker.rs• L35-63 app/…/main.rs• L198-203 app/…/mod.rs• L186-204

SSH path

The SSH path carries interactive guest sessions and port-forward requests. It keeps guest access separate from control and Docker protocols while still using daemon state to find the right target. app/…/ssh.rs• L1-244 app/…/tunnel.rs• L1-244 app/…/mod.rs• L31-81

SSH tunnels make a guest service available through a host-local endpoint without exposing that service as a control-plane API. The tunnel remains tied to the selected ArcBox instance, so profile and endpoint selection are part of the access contract. See SSH access and tunneling. app/…/tunnel.rs• L1-244

References: app/…/ssh.rs• L1-244 app/…/tunnel.rs• L1-244 app/…/mod.rs• L31-81

Helper socket

The helper socket carries only the privileged service contract. The main daemon connects to it when self-setup needs a protected host change, and the CLI uses it for installation or cleanup paths. A connection is checked for compatibility before the caller can use mutation methods. app/…/self_setup.rs• L25-67 app/…/install.rs• L30-75 app/…/client.rs• L40-69

The socket's file mode is not the release security model. The helper verifies the peer's code signature and allowed identity before it dispatches RPCs. Development builds can use a manually bound socket for local work, but release behavior keeps the peer check in the accept path. app/…/server.rs• L75-107 app/…/peer_auth.rs• L1-19 app/…/peer_auth.rs• L45-94

References: app/…/self_setup.rs• L25-67 app/…/install.rs• L30-75 app/…/client.rs• L40-69 app/…/server.rs• L75-107 app/…/peer_auth.rs• L1-19 app/…/peer_auth.rs• L45-94

Lifecycle flow

The applications form one control flow from a user action to a managed workload. The CLI selects the profile and sends a request. The daemon owns admission and shared runtime state. The API or Docker layer applies the right host policy. SSH provides a separate guest path. The host sandbox location or System VM performs sandbox work. The helper handles only protected host changes.

This diagram shows how host commands, local APIs, guest access, host sandbox work, and privileged host work meet at the daemon-owned runtime.

sequenceDiagram
    participant User as User or local tool
    participant CLI as abctl or Docker client
    participant D as arcbox-daemon
    participant API as Control API or Docker service
    participant SSH as SSH or tunnel path
    participant R as Host sandbox or System VM
    participant H as Privileged helper

    User->>CLI: Start, inspect, or run workload
    CLI->>D: Local control request
    D->>API: Route through public service
    API->>R: Apply admission and perform operation
    User->>SSH: Open guest session or tunnel
    SSH->>D: Resolve instance and endpoint
    SSH->>R: Reach guest or forwarded service
    API->>H: Request protected host change when required
    H-->>API: Authorized result
    R-->>API: Workload result and host-visible state
    API-->>CLI: Response or stream
    CLI-->>User: Status, output, or error

Startup follows a phased handoff. The control plane starts early, host state and the host sandbox location become available before the optional System VM, and Docker or Kubernetes listeners bind before System readiness is published. Shutdown cancels new work, drains service tasks, stops the host sandbox manager, and then stops the runtime. app/…/main.rs• L254-272 app/…/pipeline.rs• L150-237 app/…/host_sandboxes.rs• L56-64 app/…/shutdown.rs• L43-94

References: app/…/main.rs• L254-272 app/…/pipeline.rs• L150-237 app/…/host_sandboxes.rs• L56-64 app/…/shutdown.rs• L43-94 app/…/system.rs• L27-48

Operating modes

The control plane supports more than one host setup without changing the core ownership model. Profile selection separates production state from development instances. VM-host-only mode removes Linux workload services. The System VM backend can use HV, VZ, or QEMU when the host and configuration select it. The host sandbox location is an independent macOS option and does not use QEMU.

Production profile

The production profile is the normal user path. Its daemon may enable Docker integration after startup recovery, and its launchd registration keeps the daemon available as a user service. Protected host setup remains outside the daemon process. app/…/main.rs• L198-203 app/…/mod.rs• L186-204 app/…/install.rs• L179-297

References: app/…/main.rs• L198-203 app/…/mod.rs• L186-204 app/…/install.rs• L179-297

Development profile

The development profile supports isolated daemon instances for parallel work. Its data directory, sockets, DNS domain, and Docker context can be selected independently. This lets a developer run a separate control plane without taking over the production Docker choice. app/…/main.rs• L48-114 app/…/mod.rs• L38-114 app/…/mod.rs• L318-345

References: app/…/main.rs• L48-114 app/…/mod.rs• L38-114 app/…/mod.rs• L318-345

VM-host-only mode

VM-host-only mode prepares the host and keeps machine, host-facing control services, and a supported host sandbox location available without booting the default Linux System VM. Because Docker and Kubernetes depend on that VM, their socket and proxy are not started in this mode. macOS guest management remains available. app/…/config.rs• L271-294 app/…/config.rs• L612-632 app/…/initialization.rs• L64-79 app/…/mod.rs• L101-145

References: app/…/config.rs• L271-294 app/…/config.rs• L612-632 app/…/initialization.rs• L64-79 app/…/mod.rs• L101-145

QEMU backend

The QEMU backend provides an emulated System VM path for hosts that cannot use hardware virtualization or for configurations that select QEMU. The daemon installs the pinned build during System startup when needed. An operator can provide a local archive with abctl qemu import, or set an explicit QEMU binary path. Host sandboxes do not run on QEMU. app/…/system.rs• L131-149 app/…/qemu.rs• L21-43 app/…/qemu.rs• L17-50 app/…/qemu.rs• L11-17 app/…/host_sandboxes.rs• L67-99

Changing the System VM backend or its resource limits is a lifecycle operation. The daemon persists the choice and recreates the System VM, so running containers stop as part of applying the change. app/…/system.rs• L11-37 app/…/system.rs• L640-688

References: app/…/system.rs• L131-149 app/…/qemu.rs• L21-43 app/…/qemu.rs• L17-50 app/…/qemu.rs• L11-17 app/…/host_sandboxes.rs• L67-99 app/…/system.rs• L11-37 app/…/system.rs• L640-688

Change checklist

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

  • Keep CLI socket, data-directory, profile, and DNS selection aligned with daemon layout resolution. A client can otherwise send a valid request to a different instance than the one the user started.
  • Keep the phased startup chain, runtime admission handles, setup-status updates, and listener binding aligned. A phase or endpoint that is declared but never published can make clients wait forever or report a false ready state.
  • Keep host readiness separate from System VM and Docker readiness. Host and machine access must remain useful when System startup fails or is disabled.
  • Keep host sandbox composition before host admission and keep its cleanup stream alive until host runtime shutdown. A location that is composed too late cannot serve work during System startup.
  • Keep the host and nested sandbox routing rules aligned with ownership checks, snapshot ownership, default-location behavior, and the x-machine contract. A sandbox or snapshot can otherwise be sent to the wrong location.
  • Keep the capability response aligned with the actual host sandbox backend and current pause, port, bind-mount, and warm-start support.
  • Keep Docker context changes production-only when they affect the global Docker choice. Development instances must remain explicit.
  • Keep the guest Docker readiness signal and reported endpoint aligned with the configured vsock endpoint. A live VM is not enough to promise Docker access.
  • Keep the x-machine routing contract aligned with the services that accept it. Sandbox V1 must continue to reject non-System machines.
  • Keep typed sandbox error details aligned with the guest error codes and messages. A changed guest message can silently remove useful client actions.
  • Keep QEMU artifact selection, download progress, import behavior, and System VM backend reporting aligned. A configured backend must have a usable executable before boot.
  • Keep helper RPC method order, independent helper version checks, and daemon self-setup behavior aligned. A wire change can affect a separately installed root helper.
  • Keep privileged setup ownership aligned between launchd installation, daemon self-setup, and uninstall paths. User-level hooks cannot safely replace root-owned cleanup.

Important failure modes

TriggerConsequenceGuard
abctl and the daemon resolve different profiles, data directories, or socket pathsThe CLI reports one instance while requests reach another instance or no listenerShare layout and profile resolution rules between CLI and daemon.
The daemon publishes host or System readiness before its promised listener bindsClients see a usable service but receive connection errorsBind each required listener before publishing its admission or readiness state.
Host sandbox composition runs after host admission or its cleanup task is not retainedHost sandbox requests fail during startup or expired sandbox state remains on the hostCompose before host admission and retain the cleanup watcher through shutdown.
A sandbox request uses a location that does not own the sandbox or snapshotThe operation returns not-found or changes state in the wrong runtimeRoute existing IDs by ownership and route snapshots by their recorded location.
A client treats a live VM or agent as Docker-readyDocker calls fail while the guest container runtime is still startingWait for the guest runtime readiness signal and validate its reported endpoint.
VM-host-only mode starts a Docker or Kubernetes client pathClients receive an endpoint with no Linux workload service behind itGate Docker and Kubernetes on System VM autostart and service binding.
A development daemon changes the global Docker contextWorktree commands can redirect unrelated Docker workloadsAllow global Docker integration only for the production profile.
A sandbox call reaches a guest without nested virtualization supportThe client gets a misleading guest error or a failed transport callCheck capabilities at the daemon boundary and return the typed precondition error.
A non-System machine is selected for Sandbox V1The request can target a machine that does not provide the sandbox contractEnforce the System VM routing rule before location routing.
An old or unrecognized helper receives new mutation callsSelf-setup is skipped or the wire request is unsafe to interpretCheck helper compatibility before mutation and replace incompatible installs.
An untrusted process reaches the helper socket in a release buildA root service could perform host mutations for the wrong callerAuthenticate the peer by code signature before dispatch.
Startup or shutdown is interrupted while a VM or host sandbox manager still existsVM helpers, sandbox workers, or disk resources can remain owned by an exited daemonRetain early runtime and cleanup handles through cancellation and join them before exit.

Key files

FileWhy to read it
app/…/main.rsShows how abctl applies profile and socket selection before dispatch.
app/…/mod.rsDefines the user-facing command groups and local socket rules.
app/…/daemon.rsShows how the CLI starts, stops, and checks the daemon without owning daemon state.
app/…/system.rsShows the user contract for System VM backend and resource changes.
app/…/qemu.rsShows the offline import path for the emulated System VM backend.
app/…/ssh.rsShows the host-to-guest shell access path.
app/…/tunnel.rsShows local forwarding through the guest access path.
app/…/main.rsShows daemon ownership, signal handling, and the ordered startup handoff.
app/…/pipeline.rsShows the typed startup stages and the point where host and System admission split.
app/…/host_sandboxes.rsShows host sandbox composition, cleanup supervision, and shutdown ownership.
app/…/mod.rsShows layout resolution, runtime admission, and the startup phases.
app/…/system.rsShows independent System VM supervision and recovery.
app/…/qemu.rsShows how the QEMU backend becomes available and reports progress.
app/…/mod.rsShows the relationship between host listeners, Docker, Kubernetes, and readiness.
app/…/control_plane.rsShows the shared local endpoint for Connect, gRPC, and gRPC-Web.
app/…/shutdown.rsShows service drain, host sandbox shutdown, runtime stop, and cleanup order.
app/…/mod.rsShows service registration, runtime admission, machine routing, and shutdown checks.
app/…/sandbox_route.rsShows host-versus-nested sandbox location selection and ownership routing.
app/…/system.rsShows setup status, System VM control, and diagnostics during startup.
app/…/control.rsShows sandbox lifecycle, capability reporting, and published-port requests.
app/…/process.rsShows sandbox execution and stream requests.
app/…/filesystem.rsShows sandbox file transfer and data-plane requests.
app/…/snapshot.rsShows sandbox checkpoint and restore access.
app/…/template.rsShows the location-backed sandbox template catalog.
app/…/sandbox_errors.rsShows capability checks and typed sandbox failure details.
app/…/error.rsShows how host and guest errors become stable client-visible codes.
app/…/lib.rsShows the role of Runtime between applications and engine, image, and network services.
app/…/config.rsShows profile, System VM, network, Docker, QEMU, and host sandbox configuration choices.
app/…/runtime.rsShows Runtime ownership of VM lifecycle, networking, admission, and host sandbox state.
app/…/host_sandboxes.rsShows how Runtime exposes the host location through the common agent boundary.
app/…/sandbox_host.rsShows the host-state and agent seam used by sandbox services.
app/…/initialization.rsShows host preparation, optional System VM startup, and VM-host-only behavior.
app/…/guest_docker.rsShows the guest runtime readiness boundary for Docker compatibility.
app/…/qemu.rsShows QEMU executable selection and failure guidance.
app/…/lib.rsDefines the narrow privileged operation contract.
app/…/client.rsShows how trusted ArcBox processes connect and check helper compatibility.
app/…/server.rsShows launchd or development socket ownership and request dispatch.
app/…/peer_auth.rsDefines the release peer-authentication boundary for root operations.