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.1"

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

# Sandboxes.
solari-sandbox = "0.1"

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.

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?;
There is no launch()
The TypeScript Solari.launch() returns a live Playwright Browser, and Playwright has no Rust binding, so there is no Rust port of it. Rust drives a session over its raw CDP endpoint with chromiumoxide instead; see connect(). The connect feature is off by default so the core crate stays dependency-light.

Configuration

Each crate has its own ClientOptions. Both take api_key and base_url as explicit constructor arguments.

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: required.
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 only 502, 503, 504 and transport errors, max_attempts times, with a fixed backoff_ms. solari retries idempotent requests (GET, DELETE, or anything carrying an Idempotency-Key) on 5xx and retryable bodies, with exponential backoff + jitter. Neither 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.