a3s-box-sdk
The Rust SDK for a3s-box direct runtime APIs.
By default, the SDK does not spawn the a3s-box CLI. A3sBoxClient calls
a3s-box-runtime stores and socket clients directly, returning typed Rust data
for management apps, automation, and tests.
Runtime-Backed Client
use ;
# async
Use A3sBoxClient::from_home(path) for tests or tools that should operate on a
non-default a3s-box state directory.
Managed Lifecycle
The SDK submits lifecycle requests directly to the same generation-fenced
ExecutionManager used by the CLI and compatibility service. It does not spawn
the CLI or construct a parallel box record.
use BTreeMap;
use ;
# async
run_box provides the idempotent create-and-start composition. Typed methods
also expose inspect, pause, resume, restart, kill, and operation reconciliation.
A3sBoxClient::with_execution_manager accepts an explicit typed manager for
embedding or tests without changing request semantics.
API Coverage
- Boxes: generation-fenced create, start, run, inspect, pause, resume, restart, kill, and reconciliation; plus list, get, legacy pause/unpause, Unix stop, remove, prune inactive boxes, log snapshots, and host-side stats snapshots.
- Images: list, get, inspect local OCI metadata, read OCI history, pull, build, tag, push, remove, and evict.
- Volumes: list, get, create, remove, and prune.
- Networks: list, get, create, remove, connect inactive boxes, disconnect inactive boxes, and prune.
- Snapshots: list, get, create from a box rootfs, restore into a new created box record, remove, and prune.
- Diagnostics: a3s-box/core/runtime/SDK versions, home path, host virtualization availability, and runtime disk usage grouped by boxes, images, volumes, snapshots, state files, and other local data.
- Running boxes on Unix: exec, file transfer, heartbeat, main-process signal, deferred-main spawn, PTY client, and attestation report through runtime sockets.
The client reads the shared boxes.json state format through an SDK-local model
so it does not depend on the CLI crate. Image, volume, network, snapshot, build,
registry, exec, PTY, and attestation operations use a3s-box-runtime directly.
Managed lifecycle methods preserve the complete typed BoxConfig and
ExecutionRecordPolicy request and call the canonical runtime facade. Pause,
unpause, Unix stop, and box removal remain available through the existing
query-based management surface for backwards compatibility. The default SDK
does not shell out for lifecycle commands.
Maintenance Calls
Destructive APIs include remove_box, prune_boxes, remove_image, evict_images,
remove_volume, prune_volumes, remove_network, prune_networks,
remove_snapshot, and prune_snapshots. Product UIs should pair these with
selection state and confirmation prompts.
restore_snapshot is not destructive, but it creates a new box record and box
directory, so product UIs should still pair it with explicit source selection
and confirmation.
Optional Pipeline Runner
The historical programmable CI runner is still available behind an explicit feature:
A3S_BOX=/path/to/a3s-box
This optional runner drives lifecycle-heavy commands through the installed
a3s-box binary because those flows are not yet exposed as stable runtime client
APIs. It is not part of the default SDK surface.