Knowledge Base updated: 2026-11-22
Microsandbox knowledge base
Microsandbox runs isolated workloads in lightweight virtual machines. Its core combines a runtime, guest agent, host networking, filesystem backends, image/snapshot pipelines, persistence, and public CLI/SDK interfaces.
Critical local state is maintained through the persistence layer and sandbox storage layout. Runtime protocol messages bridge host clients with guest services; snapshots and images provide reusable execution state.
flowchart TD
CLI[CLI] --> SDK[SDKs and bindings]
SDK --> Context[Local or cloud context]
Context --> Runtime[Runtime orchestration]
Runtime --> Sandbox[Sandbox lifecycle]
Sandbox --> Agent[Guest agent]
Sandbox --> Jobs[Managed jobs]
Sandbox --> Network[Host networking]
Sandbox --> FS[Filesystem backends]
Sandbox --> Images[Images and snapshots]
Images --> Checkpoint[Checkpoint and restore]
Context --> DB[Persistent state]
Agent <--> Protocol[Runtime protocol]
Protocol <--> SDK
Runtime --> Metrics[Metrics]
Metrics --> Collector[Metrics collection]
Glossary
- Sandbox — the host-managed VM-backed workload instance and its associated runtime state.
- Context — SDK backend boundary that selects and operates local or cloud sandbox services.
- Guest agent — software inside a sandbox that serves execution, filesystem, session, and control requests.
- Snapshot — captured sandbox state and artifacts used to restore execution later.
- Managed job — a tracked sandbox workload with lifecycle, output, attachment, and termination controls.
Invariants
- Sandbox lifecycle operations are mediated by SDK handles and backend contexts, rather than direct caller mutation (sdk/…/handle.rs,
sdk/rust/lib/context/**). - Snapshot creation and restoration use coordinated artifact paths rather than treating disk state as an opaque single file (
sdk/rust/lib/context/local/snapshot/**). - The host/guest boundary remains versioned through protocol frames and message domains (
crates/protocol/**). - Persistent sandbox metadata is owned by ordered schema migrations and the local database layer (
crates/db/**,sdk/rust/lib/context/local/**). - Operational metrics are registered through the metrics registry before collection or delivery (crates/…/registry.rs).
Routing table
sdk/rust/lib/sandbox/**-> Sandbox lifecyclecrates/runtime/**-> Runtime execution orchestrationcrates/agent/**-> Guest agent session handlingcrates/jobs/**-> Managed jobscrates/network/**-> Sandbox networkingcrates/network/**/policy/**-> Network policy and DNS routingcrates/network/**/dns/**-> Network policy and DNS routingcrates/filesystem/**-> Sandbox filesystem architecturecrates/filesystem/**/memfs/**-> Filesystem backends and operationscrates/filesystem/**/passthroughfs/**-> Filesystem backends and operationscrates/filesystem/**/dualfs/**-> Filesystem backends and operationscrates/images/**-> Images, root filesystems, and snapshotscrates/image/**-> Image materialization and snapshot artifactssdk/rust/lib/context/local/snapshot/**-> Checkpoint and restore orchestrationcrates/db/**-> Persistent sandbox statecrates/db/**/migration/**-> Persistence schema and migrationscrates/storage/**/backup/**-> Persistent storage backup and accesscrates/storage/**/private/**-> Persistent storage backup and accesscrates/migration/**-> Storage migration and recoverycrates/migration/**/plan/**-> Storage migration execution and compatibilitycrates/protocol/**-> Runtime protocol and transportscrates/protocol/**/messages/**-> Protocol messages and compatibilitycli/**-> Command-line interfacecli/**/sandbox/**-> CLI sandbox operation flowssdk/**-> SDKs and language bindingssdk/rust/**-> Rust SDK implementationsdk/node/**-> Language binding adapterssdk/python/**-> Language binding adapterssdk/go/**-> Language binding adapterssdk/ruby/**-> Language binding adapterssdk/**/service/**-> Service management APIscrates/metrics/**-> Observability and metricscrates/metrics-collector/**-> Metrics collection and delivery- crates/…/registry.rs -> Metrics collection and delivery