Skip to main content
The SDK ships a REST client. Point it at a host running boxlite serve and your create / exec / list_info / remove calls become HTTP and WebSocket requests served by real microVMs elsewhere. Swapping Boxlite.default() for Boxlite.rest(...) leaves your call sites almost unchanged.

Prerequisites

  • A working BoxLite install (Python boxlite or Node @boxlite-ai/boxlite) and a machine with hardware virtualization — see Installation.
Start a local server for integration testing (on a host with virtualization):
By default the client reaches the server on the same host at http://localhost:8100.

Quick Example

Minimal happy path: connect to a remote endpoint and list existing boxes. Runs as-is (start boxlite serve in another terminal first).
Key point: Boxlite.rest(...) is a synchronous constructor, but the runtime operations under the REST client (create / get / get_info / list_info / metrics / remove) must be awaited. The local Boxlite handle behaves the same way: synchronous construction, async methods.

Create, Execute, Reclaim (End to End)

Parameters and Returns

BoxliteRestOptions(...) Constructor Parameters

Node equivalent: new BoxliteRestOptions({ url, credential, pathPrefix }) (the Node field is pathPrefix).
BoxliteRestOptions.from_env() reads the following environment variables and automatically wraps BOXLITE_API_KEY into an ApiKeyCredential:
Run:

REST Client Runtime Methods (All Require await)

Metrics fields are authoritative in the source: RuntimeMetrics uses num_running_boxes / boxes_created_total / boxes_failed_total / total_commands_executed / total_exec_errors; BoxMetrics uses memory_bytes / cpu_percent (not memory_usage_bytes / cpu_time_ms).

Accessing State (Common Pitfall)

The outer object is BoxInfo.state (a BoxStateInfo), and the inner field is status (a string). Both levels must be written correctly.

Node Equivalent Example

Troubleshooting

Real Error Example (Passing a String for a Volume)