### Build, sign, and run macOS install example Source: https://github.com/arcboxlabs/arcbox/blob/master/docs/macos-guest.md Commands to build the `macos_install` example, sign it with Developer ID and entitlements, then run it with an IPSW path. Do not pass `--options runtime` because nix-built binaries link a nix-store `libiconv` that fails hardened-runtime validation (exit 134). ```sh direnv exec . cargo build -p arcbox-vz --example macos_install codesign --force --entitlements bundle/arcbox.entitlements \ -s "Developer ID Application: …" target/debug/examples/macos_install ./target/debug/examples/macos_install /path/to/UniversalMac_xx.ipsw ``` -------------------------------- ### Verify signing setup with security, codesign, and make run-daemon Source: https://github.com/arcboxlabs/arcbox/blob/master/CONTRIBUTING.md Verifies the signing setup: checks the certificate is installed, confirms entitlements are embedded, and starts the daemon to confirm it runs. Expected outputs are shown in comments. ```bash # 1. Confirm the certificate is installed security find-identity -v -p codesigning | grep "ArcBox" # Expected: "Developer ID Application: ArcBox, Inc. (422ACSY6Y5)" # 2. Confirm entitlements are embedded codesign -d --entitlements - target/debug/arcbox-daemon # Should list com.apple.security.virtualization, com.apple.vm.networking, etc. # 3. Confirm the daemon starts make run-daemon # Should print startup logs (Ctrl+C to stop) ``` -------------------------------- ### Async hello world with AsyncSandbox Source: https://github.com/arcboxlabs/arcbox/blob/master/sdk/python/README.md Async mirror of the hello-world example using `AsyncSandbox`, `async with`, and `async for`. Requires the daemon running via `abctl daemon start`. ```python from arcbox import AsyncSandbox async def main() -> None: sandbox = await AsyncSandbox.create("", ttl=300) async with sandbox: await sandbox.files.write_text("/tmp/hello.txt", "hello from arcbox\n") result = await sandbox.commands.run(["/bin/cat", "/tmp/hello.txt"]) print(result.expect().stdout) ``` -------------------------------- ### Install and start ArcBox with Homebrew or script Source: https://github.com/arcboxlabs/arcbox/blob/master/README.md Install ArcBox via Homebrew cask or the install script, then start the daemon and enable Docker compatibility. Finally, run a container and test it with curl. ```bash # Install with Homebrew brew install --cask arcboxlabs/tap/arcbox # or with the install script curl -fsSL https://get.arcbox.dev | bash # Start the daemon and enable Docker compatibility abctl daemon start abctl docker enable # Run a container docker run -d -p 8080:80 nginx curl http://localhost:8080 ``` -------------------------------- ### Fresh launchd install of helper Source: https://github.com/arcboxlabs/arcbox/blob/master/CONTRIBUTING.md Performs a fresh launchd install from scratch: builds, installs the binary, registers the plist, and bootstraps. ```bash make install-helper # build → install binary → register plist → bootstrap ``` -------------------------------- ### Start macOS VM with abctl macos start Source: https://github.com/arcboxlabs/arcbox/blob/master/docs/macos-guest.md Per-VM start hot path. Builds the VirtualMachineConfiguration with boot loader, platform, storage, NAT network, and graphics, then starts the VM and waits for the Running state. ```text abctl macos start → MacVm.build → arcbox-vz VirtualMachineConfiguration boot_loader = MacOSBootLoader platform = MacPlatform{ hardware_model, machine_id, aux_storage } storage = cloned disk.img (StorageDeviceConfiguration) network = NAT (vmnet shared) (DHCP + outbound internet, no host setup; MAC pinned from the machine record) graphics = MacGraphicsDeviceConfiguration → vm.start().await (serial dispatch queue + ObjC completion block -> Rust oneshot) → ready = VZ state == Running (+ optional SSH probe); no in-guest ArcBox agent ``` -------------------------------- ### Build and install arcbox-helper in production Source: https://github.com/arcboxlabs/arcbox/blob/master/CONTRIBUTING.md Builds the CLI and helper in release mode, then installs the helper via sudo. This copies the helper to /usr/local/libexec/arcbox-helper, writes the launchd plist to /Library/LaunchDaemons/com.arcboxlabs.desktop.helper.plist, and runs launchctl bootstrap system . ```bash cargo build --release -p arcbox-cli -p arcbox-helper sudo ./target/release/abctl _install ``` -------------------------------- ### Prompt agent to clone a repo into /workspace Source: https://github.com/arcboxlabs/arcbox/blob/master/docs/agent-sandbox.md Example prompt given to the agent inside the sandbox. /workspace starts empty and nothing on the host is mounted into the sandbox, so the agent brings code in itself. ```text > clone https://github.com/some/repo into /workspace and fix the failing test ``` -------------------------------- ### Rust usage example for arcbox_net Source: https://github.com/arcboxlabs/arcbox/blob/master/virt/arcbox-net/README.md Shows how to create a NetworkManager with a NAT configuration, start it, and allocate an IP for a VM. The config uses default MAC auto-generation, MTU 1500, and single queue. ```rust use arcbox_net::{NetworkManager, NetConfig, NetworkMode}; let config = NetConfig { mode: NetworkMode::Nat, mac: None, // Auto-generated mtu: 1500, bridge: None, multiqueue: false, num_queues: 1, }; let manager = NetworkManager::new(config); manager.start()?; // Allocate IP for a VM let ip = manager.allocate_ip(); ``` -------------------------------- ### Create and start a VM with arcbox_hypervisor Source: https://github.com/arcboxlabs/arcbox/blob/master/virt/arcbox-hypervisor/README.md Shows the basic usage of the crate: creating a platform-appropriate hypervisor, configuring a VM with 4 vCPUs and 4GB memory, and starting it. Requires the arcbox_hypervisor crate and a supported platform backend. ```rust use arcbox_hypervisor::{create_hypervisor, VmConfig}; // Create platform-appropriate hypervisor let hypervisor = create_hypervisor()?; // Configure VM let config = VmConfig::builder() .vcpu_count(4) .memory_size(4 * 1024 * 1024 * 1024) // 4GB .build(); // Create and start VM let vm = hypervisor.create_vm(config)?; ``` -------------------------------- ### Install pre-commit hooks Source: https://github.com/arcboxlabs/arcbox/blob/master/sdk/python/README.md Install optional pre-commit hooks scoped to sdk/python using prek or classic pre-commit. ```sh prek install -c sdk/python/prek.yaml ``` -------------------------------- ### Create and start a virtual machine with arcbox-vz Source: https://github.com/arcboxlabs/arcbox/blob/master/virt/arcbox-vz/README.md Shows the basic usage of arcbox-vz: check support, configure a VM with CPU count, memory size, and a Linux boot loader, then build, start, and request a graceful stop. Requires macOS 13+ and the com.apple.security.virtualization entitlement for binaries that create VMs. ```rust use arcbox_vz::{LinuxBootLoader, VirtualMachineConfiguration, VZError}; #[tokio::main] async fn main() -> Result<(), VZError> { if !arcbox_vz::is_supported() { return Err(VZError::OperationFailed("virtualization unsupported".into())); } let mut config = VirtualMachineConfiguration::new()?; config .set_cpu_count(2) .set_memory_size(512 * 1024 * 1024); config.set_boot_loader(LinuxBootLoader::new("/path/to/kernel")?); let vm = config.build()?; vm.start().await?; vm.request_stop()?; Ok(()) } ``` -------------------------------- ### Hello world with Sandbox.create and commands.run Source: https://github.com/arcboxlabs/arcbox/blob/master/sdk/python/README.md Create a sandbox with a 300-second TTL, write a file, run a foreground command, and run a background command while streaming its output. The context manager kills the sandbox on exit. Requires the daemon running via `abctl daemon start`. ```python from arcbox import Sandbox # Local daemon over ~/.arcbox/run/arcbox.sock — zero config. with Sandbox.create("", ttl=300) as sandbox: sandbox.files.write_text("/tmp/hello.txt", "hello from arcbox\n") check = sandbox.commands.run(["/bin/cat", "/tmp/hello.txt"]) print(check.expect().stdout, "→ exit", check.exit_code) job = sandbox.commands.run("for i in 1 2 3; do echo line$i; done", background=True) for chunk in job.output: print(chunk.data.decode(), end="") print("background job exited", job.wait_for_exit().exit_code) # context exit: sandbox killed, nothing leaked ``` -------------------------------- ### Cross-compile and install guest agent Source: https://github.com/arcboxlabs/arcbox/blob/master/CONTRIBUTING.md Install the musl-cross toolchain and add the aarch64-unknown-linux-musl target, then build the guest agent and copy it to ~/.arcbox/bin so the daemon can find it. The agent is required for the VM to boot. ```bash # One-time toolchain setup brew install FiloSottile/musl-cross/musl-cross rustup target add aarch64-unknown-linux-musl # Build the agent (always builds in release mode) make build-agent # Copy to the data directory so the daemon can find it mkdir -p ~/.arcbox/bin cp target/aarch64-unknown-linux-musl/release/arcbox-agent ~/.arcbox/bin/ ``` -------------------------------- ### Bash commands to reproduce network performance limits Source: https://github.com/arcboxlabs/arcbox/blob/master/docs/net-perf-limits.md Run these commands in order to set up and test network performance. Starts a clean daemon with 'abctl daemon start', runs an iperf3 server in a Docker container, then executes headline throughput tests expecting ≥20 Gbps single stream and ≥15 Gbps for VM→Host. The collapse reproducer with 2 parallel flows at 6 Gbps each expects one flow to survive while others drop, and the rate-limited test with 4 parallel flows at 2 Gbps should work cleanly. ```bash # Start a clean daemon. abctl daemon start # Run an iperf3 server in a guest container. docker run -d --rm --name iperf3-srv -p 5201:5201 networkstatic/iperf3 -s # Headline tests. iperf3 -c 127.0.0.1 -p 5201 -t 10 # single stream (expect ≥20 Gbps) iperf3 -c 127.0.0.1 -p 5201 -R -t 10 # VM→Host (expect ≥15 Gbps) iperf3 -c 127.0.0.1 -p 5201 -R -P 4 -t 10 # VM→Host parallel (expect ≥15 Gbps sum) # Collapse reproducer (each flow 6 Gbps — expect one survives, others drop). iperf3 -c 127.0.0.1 -p 5201 -P 2 -b 6G -t 10 # Rate-limited works clean. iperf3 -c 127.0.0.1 -p 5201 -P 4 -b 2G -t 10 ``` -------------------------------- ### Install arcbox with uv or pip Source: https://github.com/arcboxlabs/arcbox/blob/master/sdk/python/README.md Install the arcbox Python SDK. Requires Python ≥ 3.10. ```sh uv add arcbox # or: pip install arcbox ``` -------------------------------- ### Start and enable native Kubernetes cluster Source: https://github.com/arcboxlabs/arcbox/blob/master/README.md Start a local k3s cluster and enable kubectl integration. Use abctl k8s kubeconfig to print the kubeconfig separately. ```bash abctl k8s start abctl k8s enable # installs kubectl, merges the kubeconfig, switches context kubectl get nodes ``` -------------------------------- ### StartExecution Source: https://github.com/arcboxlabs/arcbox/blob/master/docs/sandbox-api.md Starts a new execution in a sandbox. Requires READY state; idempotent with caller-supplied execution_id. ```APIDOC ## StartExecution ### Description Starts a new execution in a sandbox. Requires the sandbox state to be READY; a RUNNING sandbox returns FAILED_PRECONDITION. A caller-supplied execution_id makes the start idempotent. ### Method rpc ### Endpoint StartExecution(StartExecutionRequest) returns (Execution) ### Parameters #### Request Body - **execution_id** (string) - Optional - Caller-supplied ID for idempotent start. - **command** (string) - Required - Command to execute. - **stdin** (bool) - Optional - If false, starts the process with stdin already at EOF (run semantics). - **tty** (bool) - Optional - If true, allocates a PTY. - **user** (string) - Optional - Docker-style user spec (uid, uid:gid, name, name:group) resolved against the sandbox rootfs. ### Response #### Success Response - **Execution** - The started execution object. #### Error Responses - **FAILED_PRECONDITION** - Sandbox is RUNNING (one execution at a time in V1). - **exit code 126/127** - Failed spawn or user resolution, with a stderr chunk. ``` -------------------------------- ### Run tun_proxy proof with local SOCKS5 and seeded mapping Source: https://github.com/arcboxlabs/arcbox/blob/master/docs/surge-tun-proxy.md Verified Gate C run: starts the harness with a private utun address and a seeded IP→domain mapping, routes a TEST-NET-2 destination onto the utun, and drives a host HTTP flow. Expect the body to return and the harness to log the full lifecycle (SYN gated → passive-open registered → SOCKS5 tunnel established target=example.test → fast-path promotion → response → FIN); the SOCKS5 proxy logs CONNECT example.test:80. ```sh sudo cargo run -p arcbox-net --example tun_proxy -- \ --socks 127.0.0.1:1080 --addr 10.99.0.1 --peer 10.99.0.2 \ --map 198.51.100.7=example.test & # 3) route the (TEST-NET-2) destination onto the harness's utunN, then drive a flow: sudo route add -host 198.51.100.7 -interface utunN curl --resolve example.test:80:198.51.100.7 http://example.test/ ``` -------------------------------- ### Usage: Create a Container with ContainerConfig Source: https://github.com/arcboxlabs/arcbox/blob/master/runtime/arcbox-container/README.md Shows how to construct a Container using ContainerConfig and verify its initial state. The example imports the necessary types and uses the with_config constructor, then asserts the container state is Created. ```rust use arcbox_container::{Container, ContainerConfig, ContainerState}; let config = ContainerConfig { image: "alpine:latest".to_string(), cmd: vec!["sh".to_string()], ..Default::default() }; let container = Container::with_config("demo", config); assert_eq!(container.state, ContainerState::Created); ``` -------------------------------- ### Install @arcbox/sandbox Source: https://github.com/arcboxlabs/arcbox/blob/master/sdk/typescript/README.md Install the @arcbox/sandbox package. Requires Node.js version 22 or higher. ```sh npm install @arcbox/sandbox ``` -------------------------------- ### Usage example for arcbox_protocol types Source: https://github.com/arcboxlabs/arcbox/blob/master/rpc/arcbox-protocol/README.md Shows how to construct CreateContainerRequest and PullImageRequest using the crate's re-exports. The example sets fields and uses Default::default() for unspecified fields, then asserts the values. ```rust use arcbox_protocol::{CreateContainerRequest, PullImageRequest}; let create = CreateContainerRequest { name: "demo".to_string(), image: "alpine:latest".to_string(), cmd: vec!["echo".to_string(), "hello".to_string()], tty: false, stdin_open: false, ..Default::default() }; let pull = PullImageRequest { reference: "nginx:latest".to_string(), ..Default::default() }; assert_eq!(create.image, "alpine:latest"); assert_eq!(pull.reference, "nginx:latest"); ``` -------------------------------- ### Create and manage Linux VMs with abctl machine Source: https://github.com/arcboxlabs/arcbox/blob/master/README.md Use these commands to create, start, SSH into, execute one-shot commands, and list Linux VMs. Supports Ubuntu and Alpine with directory mounts, interactive shells, and command execution. ```bash abctl machine create dev --image ubuntu --disk 50 --mount ~/code:/code abctl machine start dev abctl machine ssh dev # interactive shell abctl machine exec dev -- cargo build # one-shot command abctl machine ls ``` -------------------------------- ### abctl CLI usage examples Source: https://github.com/arcboxlabs/arcbox/blob/master/app/arcbox-cli/README.md Shows the main abctl commands for machine management, runtime migration, daemon lifecycle, Docker context, Kubernetes integration, and running containers. Includes flags like --dry-run, --json, --source-socket, --no-start, and --yes. ```bash # Machine (VM) operations abctl machine create myvm abctl machine start myvm abctl machine list abctl machine stop myvm # Runtime migration abctl migrate from orbstack --dry-run # inspect the plan, change nothing abctl migrate from orbstack --dry-run --json # same plan, machine-readable abctl migrate from docker-desktop abctl migrate from orbstack --source-socket ~/.orbstack/run/docker.sock --yes abctl migrate from orbstack --no-start # recreate but leave stopped # Daemon management abctl daemon start # Start daemon in background abctl daemon stop # Stop daemon abctl info # System info abctl version # Version info # Docker context integration abctl docker enable # Set ArcBox as Docker context abctl docker disable # Reset to default context # Native Kubernetes integration abctl k8s start # Start the ArcBox Kubernetes cluster abctl k8s enable # Install kubectl + add the ArcBox kube context # Development contexts are not activated globally; select one with kubectl config use-context. kubectl get nodes # Run containers through Docker CLI docker run hello-world ``` -------------------------------- ### Initialize FuseDispatcher with PassthroughFs Source: https://github.com/arcboxlabs/arcbox/blob/master/virt/arcbox-fs/README.md Rust example showing how to configure and instantiate the arcbox-fs service. Creates a PassthroughFs with default configuration and wraps it in a FuseDispatcher. ```rust use arcbox_fs::{FsConfig, FuseDispatcher, PassthroughConfig, PassthroughFs}; let config = FsConfig { tag: "arcbox".to_string(), source: "/path/to/share".to_string(), num_threads: 4, writeback_cache: true, cache_timeout: 1, }; let fs = PassthroughFs::new(PassthroughConfig::default())?; let dispatcher = FuseDispatcher::new(fs); ``` -------------------------------- ### Execution RPC definitions Source: https://github.com/arcboxlabs/arcbox/blob/master/docs/sandbox-api.md Defines the gRPC service methods for managing sandbox executions: start, attach, stdin write/stream, stdin status, signal, resize TTY, and wait. Start requires state READY; a RUNNING sandbox returns FAILED_PRECONDITION (one execution at a time in V1). ```protobuf rpc StartExecution(StartExecutionRequest) returns (Execution) rpc AttachExecution(AttachExecutionRequest) returns (stream ExecutionEvent) rpc WriteStdin(WriteStdinRequest) returns (StdinStatus) rpc StreamStdin(stream WriteStdinRequest) returns (StdinStatus) rpc GetStdinStatus(GetStdinStatusRequest) returns (StdinStatus) rpc SignalExecution(SignalExecutionRequest) returns (google.protobuf.Empty) rpc ResizeExecutionTty(ResizeExecutionTtyRequest) returns (google.protobuf.Empty) rpc WaitExecution(WaitExecutionRequest) returns (Execution) ``` -------------------------------- ### Use ArcBox E2B-compatible Sandbox with @arcbox/sandbox/e2b Source: https://github.com/arcboxlabs/arcbox/blob/master/sdk/typescript/README.md Shows how to replace the E2B import with the ArcBox E2B-compatible surface. No API key or network is required; E2B connection options are accepted and ignored. The example creates a sandbox, writes a file, runs a command, and kills the sandbox. ```typescript import { Sandbox } from '@arcbox/sandbox/e2b'; // was: from 'e2b' const sandbox = await Sandbox.create({ timeoutMs: 300_000 }); await sandbox.files.write('/tmp/hello.txt', 'hello\n'); console.log((await sandbox.commands.run('cat /tmp/hello.txt')).stdout); await sandbox.kill(); ``` -------------------------------- ### Create and use ArcBox Docker context Source: https://github.com/arcboxlabs/arcbox/blob/master/app/arcbox-docker/README.md Creates and activates an ArcBox Docker context pointing to the Unix socket at $HOME/.arcbox/docker.sock, then verifies the setup with docker ps, docker run, and docker images. ```bash # Create and use ArcBox Docker context docker context create arcbox --docker "host=unix://$HOME/.arcbox/docker.sock" docker context use arcbox # Now Docker CLI uses ArcBox docker ps docker run alpine echo hello docker images ``` -------------------------------- ### rpc Create(CreateSandboxRequest) returns (CreateSandboxResponse) Source: https://github.com/arcboxlabs/arcbox/blob/master/docs/sandbox-api.md Creates a new sandbox asynchronously. Returns immediately with state STARTING; wait for readiness via Events(kind: READY) or polling Inspect. The request supports idempotent creation with caller-supplied IDs and various configuration options for limits, template, commands, networking, and lifecycle. ```APIDOC ## rpc Create(CreateSandboxRequest) returns (CreateSandboxResponse) ### Description Creates a new sandbox asynchronously. Returns immediately with state `STARTING`; wait for readiness via `Events(kind: READY)` or by polling `Inspect`. ### Method Create (gRPC) ### Request #### Request Fields - **id** (string) - Optional - Caller-supplied for durable retry idempotency; empty → a fresh UUID on every attempt. - **limits.vcpus** (int) - Optional - Number of vCPUs; 0 → daemon defaults (1 vCPU). - **limits.memory_mib** (int) - Optional - Memory in MiB; 0 → daemon defaults (512 MiB). - **template** (string) - Required - Opaque reference to what boots; see Templates. - **cmd** (repeated string) - Optional - Initial workload command launched automatically once ready; exit returns the sandbox to `READY` with an `IDLE` event. - **env** (map) - Optional - Environment variables for the initial workload. - **working_dir** (string) - Optional - Working directory for the initial workload. - **user** (string) - Optional - User for the initial workload process. - **no_default_cmd** (bool) - Optional - Explicit-empty override of catalog template's default cmd (proto3 repeated fields cannot distinguish omitted from empty). - **no_default_env** (bool) - Optional - Explicit-empty override of catalog template's default env (proto3 map fields cannot distinguish omitted from empty). - **network.mode** (enum) - Optional - `NETWORK_MODE_ENABLED` (default, IP from 172.20.0.0/16) or `NETWORK_MODE_NONE`. - **ttl_seconds** (int64) - Optional - Hard maximum lifetime from creation (not reset by activity; re-armable via `SetLifecycle`); always destroys. - **idle_timeout_seconds** (int64) - Optional - Idle reaping after this many seconds without a running execution: `KILL` (default) destroys, `PAUSE` checkpoints (CORE-21); both knobs replaceable via `SetLifecycle`. - **on_idle** (enum) - Optional - Action on idle timeout: `KILL` (default) or `PAUSE`. - **mounts** (list) - Rejected in V1 with `FAILED_PRECONDITION`. - **ssh_public_key** (string) - Rejected in V1 with `FAILED_PRECONDITION`. ### Response Returns immediately with `state: STARTING`; no further response schema details are provided. ``` -------------------------------- ### Sign daemon and verify with codesign Source: https://github.com/arcboxlabs/arcbox/blob/master/docs/code-signing-troubleshooting.md Signs the daemon using make (auto-detects identity) and then verifies the signature with strict verification. A correct setup shows the full chain to a self-signed root. ```bash make sign-daemon # auto-detects the identity from keychain ``` ```bash codesign --verify --strict --verbose=2 target/debug/arcbox-daemon ``` -------------------------------- ### Run amd64 image on Apple Silicon Source: https://github.com/arcboxlabs/arcbox/blob/master/README.md Run linux/amd64 images on Apple Silicon with FEX translation. The example shows uname -m returning x86_64. ```bash docker run --platform linux/amd64 alpine uname -m # x86_64 ``` -------------------------------- ### Create a ListMachinesRequest for MachineServiceClient Source: https://github.com/arcboxlabs/arcbox/blob/master/rpc/arcbox-grpc/README.md Shows how to construct a tonic request for the MachineServiceClient using the ListMachinesRequest message from arcbox_protocol. The actual call is commented out; the example only builds the request and keeps it alive with a hidden let binding. ```rust use arcbox_grpc::MachineServiceClient; use arcbox_protocol::v1::ListMachinesRequest; let request = tonic::Request::new(ListMachinesRequest { all: true }); // client.list(request).await?; # let _ = request; ``` -------------------------------- ### Rust: Set up TapNetwork with quarantine Source: https://github.com/arcboxlabs/arcbox/blob/master/virt/arcbox-tap-net/README.md Shows how to create a TapNetwork with a quarantine directory, reserve an address, activate it, and quarantine a VM. Requires CAP_NET_ADMIN and Linux. ```rust use std::sync::Arc; use arcbox_tap_net::{AttachMode, Datapath, IptablesLegacy, TapNetwork}; let network = TapNetwork::with_quarantine_dir( "172.20.0.0/16", "172.20.0.1", vec![], data_dir.join("sandbox-network-quarantine"), Datapath::default(), // eBPF, packet-filter fallback Arc::new(IptablesLegacy::default()), // or `Nftables::discover()?` )?; let allocation = network.reserve("box-1")?; // journal it, then: network.activate(&allocation, AttachMode::Invariant)?; // ... boot the VM on `allocation.tap_name` ... network.quarantine_checked("box-1", &allocation)?; // address held until the host finalizes ``` -------------------------------- ### Manage macOS guests with abctl macos Source: https://github.com/arcboxlabs/arcbox/blob/master/README.md Pull a base image once, then create, start, and get the IP of a macOS guest. Requires APFS data directory and is limited to 2 guests per host by Apple's license. ```bash abctl macos image pull tahoe-base # once (multi-GB, progress streams) abctl macos create ci --image tahoe-base --disk 64 abctl macos start ci abctl macos ip ci --wait 30 # reach it over the network ``` -------------------------------- ### Build and run from source with make Source: https://github.com/arcboxlabs/arcbox/blob/master/CONTRIBUTING.md Clone the repository and use the Makefile to build, sign, and run the daemon and the privileged helper. Requires a Developer ID certificate for the daemon and sudo for the helper. ```bash git clone https://github.com/arcboxlabs/arcbox.git cd arcbox # Build, sign, and run the daemon (requires Developer ID certificate) make run-daemon # In another terminal, run the privileged helper (requires sudo) make run-helper ``` -------------------------------- ### Start Claude Code in an ArcBox sandbox Source: https://github.com/arcboxlabs/arcbox/blob/master/docs/agent-sandbox.md Sets the Anthropic API key in the shell and starts Claude Code inside a dedicated ArcBox sandbox (a Firecracker microVM). Permission prompts are switched off because the microVM is the isolation boundary. The first run builds the agent image (a couple of minutes); later runs reuse it and start in about a second. ```console $ export ANTHROPIC_API_KEY=sk-... $ abctl claude ``` -------------------------------- ### Booting and interacting with a VM Source: https://github.com/arcboxlabs/arcbox/blob/master/virt/arcbox-vm-driver/README.md Demonstrates how to use a VmDriver to boot a VM, interact with optional capabilities like vsock and checkpointing, and perform a graceful shutdown. ```rust let driver: Arc = root.pick_driver(); // composition root let vm = driver.boot(spec, &runtime_dir).await?; // Box let mut events = vm.events(); if let Some(vsock) = vm.vsock() { let conn = vsock.dial(AGENT_PORT).await?; // conn.mode picks the transport } if let Some(cp) = vm.checkpoint() { let image = cp.checkpoint(&dir, CheckpointOptions::default()).await?; } vm.shutdown(ShutdownMode::Graceful { timeout: Duration::from_secs(5) }).await?; ``` -------------------------------- ### Initialize and run a VM with VmBuilder Source: https://github.com/arcboxlabs/arcbox/blob/master/virt/arcbox-vmm/README.md Use the VmBuilder fluent API to configure VM parameters such as name, CPU count, memory, kernel path, and devices, then execute the VM. ```rust use arcbox_vmm::builder::VmBuilder; let vm = VmBuilder::new() .name("my-vm") .cpus(4) .memory_gb(2) .kernel("/path/to/vmlinux") .cmdline("console=hvc0 root=/dev/vda") .block_device("/path/to/disk.img", false) .network_device(None, None) .build()?; vm.run().await?; ``` -------------------------------- ### GetStdinStatus Source: https://github.com/arcboxlabs/arcbox/blob/master/docs/sandbox-api.md Gets current stdin status for resynchronization. ```APIDOC ## GetStdinStatus ### Description Retrieves the current stdin status for an execution, used to resync after OUT_OF_RANGE errors. ### Method rpc ### Endpoint GetStdinStatus(GetStdinStatusRequest) returns (StdinStatus) ### Parameters #### Request Body - **execution_id** (string) - Required - The execution to query. ### Response #### Success Response - **StdinStatus** - Current stdin status. ``` -------------------------------- ### Sandbox state machine diagram Source: https://github.com/arcboxlabs/arcbox/blob/master/docs/sandbox-api.md State machine diagram for sandbox lifecycle. Shows transitions between STARTING, READY, RUNNING, STOPPING, STOPPED, PAUSING, PAUSED, and FAILED states, including the IDLE event on execution exit and the Resume path back to STARTING with the same ID. ```text STARTING ──► READY ──► RUNNING ──► READY (execution exited; IDLE event) │ │ ├──────────┴──► STOPPING ──► STOPPED │ ├──► PAUSING ──► PAUSED ──(Resume)──► STARTING (same ID) │ │ └──────────┴──► FAILED (error + failed_at set) ``` -------------------------------- ### Initialize SandboxManager Source: https://github.com/arcboxlabs/arcbox/blob/master/computer/arcbox-computer-runtime/README.md Demonstrates how to create a new SandboxManager instance and spawn a sandbox with specific resource requirements. ```rust use std::sync::Arc; use arcbox_computer_runtime::{NodeEnvironment, RuntimeConfig, SandboxManager, SandboxSpec}; // `environment` is the composer's; see below. let manager = Arc::new(SandboxManager::new(RuntimeConfig::default(), environment)?); let (id, ip) = manager .create_sandbox(SandboxSpec { vcpus: 1, memory_mib: 512, ..Default::default() }) .await?; ``` -------------------------------- ### Create sandbox and run commands Source: https://github.com/arcboxlabs/arcbox/blob/master/sdk/typescript/README.md Create a sandbox with a 300-second TTL, write a file, run a foreground command, and run a background command. Non-zero exit codes are returned as data, not exceptions; `expect()` throws on failure. The `await using` scope automatically kills the sandbox on exit. ```ts import { Sandbox } from '@arcbox/sandbox'; // Local daemon over ~/.arcbox/run/arcbox.sock — zero config. await using sandbox = await Sandbox.create('', { ttlMs: 300_000 }); await sandbox.files.writeText('/tmp/hello.txt', 'hello from arcbox\n'); const check = await sandbox.commands.run(['/bin/cat', '/tmp/hello.txt']); console.log(check.expect().stdout, '→ exit', check.exitCode); const job = await sandbox.commands.run('for i in 1 2 3; do echo line$i; done', { background: true, }); for await (const chunk of job.output) { process.stdout.write(chunk.data); } const done = await job.waitForExit(); console.log('background job exited', done.exitCode); // scope exit: await using → sandbox killed, nothing leaked ``` -------------------------------- ### Run Claude Code in a sandbox with abctl claude Source: https://github.com/arcboxlabs/arcbox/blob/master/README.md Starts a disposable microVM and attaches your terminal to Claude Code inside it, with permission prompts disabled. The first run builds the image; later runs start in about a second. Use `--id` for a second independent session, and pass agent arguments after `--`. ```bash export ANTHROPIC_API_KEY=sk-... abctl claude # first run builds the image; later runs start in ~1s abctl claude --id review # a second, independent session abctl claude -- --model opus # everything after -- goes to the agent ``` -------------------------------- ### macOS vs Linux startup path diagram Source: https://github.com/arcboxlabs/arcbox/blob/master/docs/macos-guest.md Shows the separate startup paths for Linux and macOS guests. The macOS path uses arcbox-vz and Virtualization.framework exclusively, while the Linux path uses arcbox-vmm and the custom HV VMM. The two share no request types or routing, only the daemon process, gRPC socket, and reused arcbox-vz device configuration. ```text abctl machine ... abctl macos ... (CLI, separate nouns) │ gRPC │ gRPC ▼ ▼ MachineService (machine.rs) MacosService (macos.rs, macOS-only) ▼ ▼ Runtime.machine_manager() Runtime.mac_machine_manager() ▼ ▼ VmManager::start macos::MacVm → Vmm::new (arcbox-vmm, Hv) → arcbox-vz: VirtualMachineConfiguration → custom HV VMM (vcpu_loop) .set_boot_loader(MacOSBootLoader) → custom virtio + Linux kernel .set_platform(MacPlatform{hw,id,aux}) → ready = vsock guest-agent ping .add_storage/network/serial/... (reused) .build() → VirtualMachine → vm.start() → Virtualization.framework → ready = VZ state==Running (+ opt. SSH) ``` -------------------------------- ### Expected codesign verification output Source: https://github.com/arcboxlabs/arcbox/blob/master/docs/code-signing-troubleshooting.md Expected output from codesign --verify showing the full certificate chain and TeamIdentifier. Use this to confirm a correct setup. ```text Authority=Developer ID Application: ArcBox, Inc. (422ACSY6Y5) # leaf Authority=Developer ID Certification Authority # intermediate Authority=Apple Root CA # self-signed root ✓ TeamIdentifier=422ACSY6Y5 ``` -------------------------------- ### Boot a VM with FcDriver and jailer Source: https://github.com/arcboxlabs/arcbox/blob/master/virt/arcbox-fc-driver/README.md Constructs an FcDriver with a jailer binary and boots a VM, returning a Box. Requires the firecracker binary path and optional jailer path; the boot call is async and returns a Result. ```rust use std::sync::Arc; use arcbox_fc_driver::{FcDriver, FcDriverConfig}; use arcbox_vm_driver::VmDriver; let mut config = FcDriverConfig::new("/usr/bin/firecracker"); config.jailer_binary = Some("/usr/bin/jailer".into()); let driver: Arc = Arc::new(FcDriver::new(config)); let vm = driver.boot(spec, &runtime_dir).await?; // Box ``` -------------------------------- ### Migrate from Docker Desktop or OrbStack Source: https://github.com/arcboxlabs/arcbox/blob/master/README.md Migrate images, volumes, networks, and containers from OrbStack or Docker Desktop. Use --dry-run to preview, --json for machine-readable output, and --no-start to leave containers stopped. ```bash abctl migrate from orbstack --dry-run # show the plan, change nothing abctl migrate from orbstack abctl migrate from docker-desktop ``` -------------------------------- ### Cross-compile arcbox-agent for aarch64 Linux Source: https://github.com/arcboxlabs/arcbox/blob/master/AGENTS.md Install the musl cross-compilation toolchain, add the aarch64-unknown-linux-musl target, and build the arcbox-agent crate for Linux guests. This is required for the guest agent that runs inside Linux VMs. ```bash brew install FiloSottile/musl-cross/musl-cross rustup target add aarch64-unknown-linux-musl cargo build -p arcbox-agent --target aarch64-unknown-linux-musl --release ``` -------------------------------- ### Run dual-backend matrix E2E test Source: https://github.com/arcboxlabs/arcbox/blob/master/tests/e2e/README.md Runs the boot-assets scenario once per backend, VZ first. VZ is the oracle: HV-only red means HV bug; double red means bug above hypervisor. Requires `--ignored --nocapture`. ```bash cargo test -p arcbox-e2e --test backend_matrix -- --ignored --nocapture ``` -------------------------------- ### Manual build without make Source: https://github.com/arcboxlabs/arcbox/blob/master/CONTRIBUTING.md Manually build the CLI and daemon with cargo, sign the daemon with codesign using the provided entitlements and certificate, then run the daemon directly. ```bash # Build CLI and daemon cargo build -p arcbox-cli -p arcbox-daemon # Sign the daemon (see "Code Signing" below) codesign --force --options runtime \ --entitlements bundle/arcbox.entitlements \ -s "Developer ID Application: ArcBox, Inc. (422ACSY6Y5)" \ target/debug/arcbox-daemon # Run ./target/debug/arcbox-daemon ``` -------------------------------- ### Development commands for the TypeScript SDK Source: https://github.com/arcboxlabs/arcbox/blob/master/sdk/typescript/README.md Run these commands from the sdk/typescript directory to install dependencies, regenerate code from protobuf, lint, format-check, test, typecheck, and build. The generated code under src/gen is committed but never exported from the package entry point. ```sh npm install npm run generate # regenerate src/gen from ../../rpc/arcbox-protocol/proto (buf + protoc-gen-es) npm run lint # eslint (eslint-config-sukka) npm run format:check # biome formatter check (biome format --write . fixes) npm test # vitest unit tests (no daemon needed) npm run typecheck # tsc --noEmit npm run build # bunchee → dist/ ``` -------------------------------- ### Initialize Runtime and Ensure VM Ready Source: https://github.com/arcboxlabs/arcbox/blob/master/app/arcbox-core/README.md Initializes the ArcBox runtime with default configuration, prepares runtime state, and ensures the default VM is ready, printing its CID. Requires the `arcbox_core` crate and uses `?` for error propagation. ```rust use arcbox_core::{Config, Runtime}; let runtime = Runtime::new(Config::default())?; runtime.init().await?; let cid = runtime.ensure_vm_ready().await?; println!("default machine CID: {cid}"); ``` -------------------------------- ### Run VirtioFS benchmarks with cargo run Source: https://github.com/arcboxlabs/arcbox/blob/master/tests/bench-virtiofs/README.md Shows the various ways to run the benchmark tool, including listing, running all or specific benchmarks, outputting JSON, comparing with a baseline, running a native baseline, skipping network-dependent macros, and selecting the fio engine for random_read_4k. ```bash # List available benchmarks cargo run --manifest-path tests/bench-virtiofs/Cargo.toml -- --list # Run all benchmarks against VirtioFS mount at /arcbox cargo run --manifest-path tests/bench-virtiofs/Cargo.toml --release -- \ --all --platform arcbox-hv --target /arcbox # Run a specific benchmark cargo run --manifest-path tests/bench-virtiofs/Cargo.toml --release -- \ --benchmark sequential_read --target /arcbox # Output JSON for CI consumption cargo run --manifest-path tests/bench-virtiofs/Cargo.toml --release -- \ --all --format json --target /arcbox > results.json # Compare with a baseline and fail on regression cargo run --manifest-path tests/bench-virtiofs/Cargo.toml --release -- \ --all --compare baseline.json --fail-on-regression --threshold 5 # Native baseline (run against a local directory) cargo run --manifest-path tests/bench-virtiofs/Cargo.toml --release -- \ --all --platform native --target /tmp/bench --format json > native.json # Hermetic run: exclude the network-dependent macros (npm/git). An entry # that matches no benchmark is a hard error, so a rename cannot silently # re-include them. cargo run --manifest-path tests/bench-virtiofs/Cargo.toml --release -- \ --all --skip npm_install,git_clone --target /arcbox # random_read_4k engine is explicit (default: the in-process buffered # reader). The fio/O_DIRECT engine is opt-in, errors when fio is absent, # and reports under `random_read_4k_fio` so numbers from different # engines can never be joined by name. cargo run --manifest-path tests/bench-virtiofs/Cargo.toml --release -- \ --benchmark random_read_4k --random-read-engine fio --target /arcbox ``` -------------------------------- ### abctl macOS image and guest lifecycle commands Source: https://github.com/arcboxlabs/arcbox/blob/master/docs/macos-guest.md Commands for pulling base images, creating a guest via copy-on-write cloning, and managing guest lifecycle (start, list, stop, remove). Includes options for pinned versions and dev manifest bypass. ```sh # 1. Pull a published base image (multi-GB download; progress streams to the CLI): abctl macos image pull tahoe-base # latest per the published index abctl macos image pull tahoe-base@2026.07.03 # pinned version abctl macos image pull --manifest # dev: bypass the index abctl macos image resolve tahoe-base # what a pull would land, without downloading abctl macos image ls # 2. Create a disposable guest by copy-on-write cloning the base (instant): abctl macos create ci-1 --image tahoe-base --cpus 4 --memory 8192 # 3. Start / list / stop / remove: abctl macos start ci-1 abctl macos ls abctl macos stop ci-1 abctl macos rm ci-1 abctl macos image rm tahoe-base ``` -------------------------------- ### Manage sandboxes with abctl sandbox commands Source: https://github.com/arcboxlabs/arcbox/blob/master/README.md Builds sandboxes from a template, an existing Docker image, or a Dockerfile, and snapshots a booted, idle sandbox to skip a cold boot. Commands cover listing templates, creating, running, copying files, exposing ports, checkpointing, and restoring. Requires nested virtualization on Apple Silicon M3 or newer with macOS 15+. ```bash abctl sandbox templates # built-in images abctl sandbox create --from-image myapp:latest --memory 512 --ttl 3600 abctl sandbox run -- ./untrusted-binary # or `exec` for interactive abctl sandbox cp :/tmp/out.tgz . # files in and out abctl sandbox expose 8080 # reach a sandbox port on the host abctl sandbox checkpoint --name clean # capture a ready snapshot abctl sandbox restore # new sandbox, near-zero boot ``` -------------------------------- ### Enable Docker context and use Docker CLI Source: https://github.com/arcboxlabs/arcbox/blob/master/README.md Enable the 'arcbox' Docker context and use standard Docker commands like run, compose, and build. The engine is configured via ~/.config/arcbox/config.toml. ```bash abctl docker enable # creates and activates the "arcbox" Docker context docker run -d -p 8080:80 nginx docker compose up docker build -t myapp . ``` -------------------------------- ### Manual first publish of the SDK Source: https://github.com/arcboxlabs/arcbox/blob/master/sdk/typescript/README.md One-time bootstrap for trusted publishing: run this from sdk/typescript while logged in to an npm account with publish rights on the @arcbox scope. This is required because trusted publishing can only be configured for a package that already exists on the registry. ```sh npm run build:publish && npm publish --access public ``` -------------------------------- ### ReadFile and WriteFile RPC definitions Source: https://github.com/arcboxlabs/arcbox/blob/master/docs/sandbox-api.md Defines the gRPC methods for file transfer. ReadFile streams file chunks with the last chunk having done == true; WriteFile starts with an open message (mode 0 → 0644) followed by chunk payloads. Both work while the sandbox is ready or running, with a 256 MiB per-file cap. ```protobuf rpc ReadFile(ReadFileRequest) returns (stream FileChunk) rpc WriteFile(stream WriteFileRequest) returns (Empty) ``` -------------------------------- ### Run daemon-level boot_assets E2E test Source: https://github.com/arcboxlabs/arcbox/blob/master/tests/e2e/README.md Boots the VM through a real daemon and runs Docker lifecycle checks over the Docker API socket. Requires `--ignored --nocapture` to execute. ```bash cargo test -p arcbox-e2e --test boot_assets -- --ignored --nocapture ``` -------------------------------- ### Development workflow commands Source: https://github.com/arcboxlabs/arcbox/blob/master/sdk/python/README.md Run these commands in the sdk/python directory to set up the environment, regenerate generated code, and run all development gates (lint, format, type check, tests). ```sh uv sync # create .venv from uv.lock uv run python scripts/gen_proto.py # regenerate src/arcbox/_gen from ../../rpc/arcbox-protocol/proto uv run python scripts/gen_sync.py # regenerate src/arcbox/_sync from src/arcbox/_async uv run ruff check . && uv run ruff format --check . uv run pyright uv run pytest # includes the sync-tree lockstep + parity checks ``` -------------------------------- ### Manage container state with StateStore Source: https://github.com/arcboxlabs/arcbox/blob/master/runtime/arcbox-oci/README.md Demonstrates saving and loading container state using StateStore. The store is created at a specified path, and state is saved and loaded by container ID, with an assertion that the loaded status is Running. ```rust use arcbox_oci::{State, Status, StateStore}; let store = StateStore::new("/var/run/arcbox")?; // Save container state store.save(&container_id, &state)?; // Load container state let state = store.load(&container_id)?; assert_eq!(state.status, Status::Running); ``` -------------------------------- ### Build the VirtioFS benchmark crate Source: https://github.com/arcboxlabs/arcbox/blob/master/tests/bench-virtiofs/README.md Builds the benchmark crate directly, as it is not part of the main workspace. ```bash cargo build --manifest-path tests/bench-virtiofs/Cargo.toml --release ```