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
| Crate | Library | Product | Types |
|---|---|---|---|
solari-browser | solari_browser | Cloud browsers | Client, Session |
solari-sandbox | solari | Sandboxes (headless) | Client, Sandbox |
solari-sandbox | solari | VMs (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 sessionThe 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.
| Option | Type | Default | Crate | Notes |
|---|---|---|---|---|
api_key | String | required | both | Sent as Authorization: Bearer. Empty is rejected at construction. |
base_url | String | see notes | both | Trailing slash stripped. solari_browser: resolved by ::for_region / ::default_region, or set explicitly with ::new. solari: required. |
max_attempts | u32 | 2 | solari_browser | Total attempts. 2 means one retry. |
backoff_ms | u64 | 500 | solari_browser | Fixed sleep between attempts, not exponential. |
timeout_ms | u64 | 90_000 | solari_browser | Per attempt, not per call. |
call_timeout_ms | Option<u64> | 300_000 | solari | Per-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
| Type | Crate | Purpose |
|---|---|---|
Client | solari_browser | Browser entry point: sessions, profiles, proxy metadata. |
Session | solari_browser | An acquired session and its upstream endpoints. |
ConnectedBrowser | solari_browser | A chromiumoxide Browser attached over CDP. Feature connect. |
Client | solari | Sandbox entry point: create, connect, get, kill. |
Sandbox | solari | A live headless session: commands, files, code, git. |
| VMs | solari | create_desktop(), stream_url(), and the core namespaces. No GUI surface. |
