Solari

Rust SDK

The Rust bindings cover two Solari products: browsers (the control plane, plus a chromiumoxide attach helper) and sandboxes (headless microVMs for commands, code, files, and git). Two crates, one API key. VMs (GUI desktops) are created with create_desktop(), but driving their GUI needs the HTTP API.

Installation

CrateLibraryProductTypes
solari-browsersolari_browserCloud browsersClient, Session
solari-sandboxsolariSandboxes (headless)Client, Sandbox
solari-sandboxsolariVMs (GUI desktops)Create plus lifecycle, stream URL, and the core namespaces. No GUI surface.
[dependencies]
# Browsers: control plane only (dependency-light).
solari-browser = "0.6"

# Browsers plus connect(): attach to a session over CDP via chromiumoxide.
solari-browser = { version = "0.6", features = ["connect"] }

# Sandboxes.
solari-sandbox = "0.6"

tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
On crates.io
solari-sandbox and solari-browser are published to crates.io (source in the solari-sdk GitHub org). Both are edition 2021 with a minimum supported Rust of 1.75, and both are async: they need a tokio runtime.
Rust 1.75 needs MSRV-aware dependency resolution
Declaring rust-version = "1.75" is not enough on its own. Cargo 1.75 resolves to the newest releases of the transitive dependencies, and some of them (for example idna_adapter) need Cargo features that 1.75 does not have, so cargo build fails with feature `edition2024` is required. Generate the lockfile with Cargo 1.84 or newer, telling it to prefer versions that fit your rust-version, then build with 1.75 against that lockfile:
# Cargo.toml of your crate: rust-version = "1.75"
CARGO_RESOLVER_INCOMPATIBLE_RUST_VERSIONS=fallback cargo +stable generate-lockfile
cargo +1.75 build --locked
The same setting can live in .cargo/config.toml as [resolver] incompatible-rust-versions = "fallback". On a current toolchain none of this is needed.

Getting Started

Create a browser session

use solari_browser::{Client, ClientOptions, CreateSessionOptions, ProxySpec};

let client = Client::new(ClientOptions::default_region(&api_key))?;
let session = client
    .sessions()
    .create(CreateSessionOptions::new().stealth(true).proxy(ProxySpec::country("us")))
    .await?;

println!("cdp {}", session.cdp_endpoint); // drive this with chromiumoxide
client.sessions().release(&session.id).await?;

Drive a browser

// Requires features = ["connect"].
let connected = solari_browser::connect(&session).await?;

let page = connected.browser.new_page("https://example.com").await?;
println!("{:?}", page.url().await?);

connected.disconnect().await;                  // ends the CDP connection
client.sessions().release(&session.id).await?; // releases the session

The connect feature alone is not enough to reach a wss:// endpoint; see the TLS-feature callout on the Browsers page before you run this.

Create a sandbox

use solari::{Client, ClientOptions, CreateOptions, RunOptions};

let client = Client::new(ClientOptions::new(&api_key, "https://api.getsolari.com"))?;
let sbx = client
    .create(CreateOptions { template: Some("base".into()), ..Default::default() })
    .await?;

let out = sbx.commands().run("echo", RunOptions::new().args(["hi"])).await?;
println!("{}", out.stdout); // "hi"
sbx.kill().await?;
launch() returns a chromiumoxide browser, not Playwright
The TypeScript Solari.launch() returns a live Playwright Browser, and Playwright has no Rust binding. Rust drives a session over its raw CDP endpoint with chromiumoxide instead: connect() attaches to a session you created, and Client::launch() creates, connects, health-probes and retries in one call. Both need the connect feature, which is off by default so the core crate stays dependency-light.

Configuration

Each crate has its own ClientOptions. Both take the API key as an explicit constructor argument. The gateway URL is explicit for solari_browser (or resolved from a region) and optional for solari.

OptionTypeDefaultCrateNotes
api_keyStringrequiredbothSent as Authorization: Bearer. Empty is rejected at construction.
base_urlStringsee notesbothTrailing slash stripped. solari_browser: resolved by ::for_region / ::default_region, or set explicitly with ::new. solari: ClientOptions::with_api_key uses https://api.getsolari.com (DEFAULT_BASE_URL, 0.3.1 and later), and an empty base_url passed to ::new falls back to it too.
max_attemptsu322solari_browserTotal attempts. 2 means one retry.
backoff_msu64500solari_browserFixed sleep between attempts, not exponential.
timeout_msu6490_000solari_browserPer attempt, not per call.
call_timeout_msOption<u64>300_000solariPer-RPC control-WS timeout for handles this client creates.
No environment variables are read
Neither crate reads the environment. Pass api_key and base_url explicitly. Any SOLARI_API_KEY in the examples is your code, not the SDK’s.
Retry policies differ per crate
solari_browser retries 502, 503, 504, and 507 and transport errors, max_attempts times, with a fixed backoff_ms. 507 is included although the browser gateway never emits one; it’s the desktop gateway’s transient InsufficientCapacity, kept so the client is correct regardless of which gateway build it reaches. solari retries idempotent requests (GET, DELETE, or anything carrying an Idempotency-Key) on network errors, 502, 503, 504, and 507, and any error body marked retryable: true, with exponential backoff + jitter (up to 5 retries by default). It is an allowlist, not “any 5xx”: a plain 500 or 501 is returned immediately. Neither crate retries 429. That means you are at your session cap.

Reference

TypeCratePurpose
Clientsolari_browserBrowser entry point: sessions, profiles, proxy metadata.
Sessionsolari_browserAn acquired session and its upstream endpoints.
ConnectedBrowsersolari_browserA chromiumoxide Browser attached over CDP. Feature connect.
ClientsolariSandbox entry point: create, connect, get, kill.
SandboxsolariA live headless session: commands, files, code, git.
VMssolaricreate_desktop(), stream_url(), and the core namespaces. No GUI surface.