Official TypeScript, Python, Go and Rust clients for the Steel browser API, with Java and Kotlin in beta.
Start cloud browsers for your AI agents and automations, and drive them with Playwright, Puppeteer or Selenium.
Steel runs browsers in the cloud for AI agents and automation. Every session is a real Chrome with proxies, captcha solving, persistent profiles, file transfer and a live viewer built in. These SDKs start and manage sessions, and you drive the browser with the tools you already use.
Get an API key from the Steel dashboard and export it.
export STEEL_API_KEY=...npm install steel-sdk playwright-coreimport { chromium } from 'playwright-core';
import Steel from 'steel-sdk';
const client = new Steel();
async function main() {
const session = await client.sessions.create();
console.log(`Watch the session live at ${session.sessionViewerUrl}`);
try {
const browser = await chromium.connectOverCDP(`${session.websocketUrl}&apiKey=${client.steelAPIKey}`);
const context = browser.contexts()[0] ?? (await browser.newContext());
const page = context.pages()[0] ?? (await context.newPage());
await page.goto('https://news.ycombinator.com');
const titles = await page.locator('.titleline > a').allTextContents();
console.log(titles.slice(0, 5).join('\n'));
await browser.close();
} finally {
await client.sessions.release(session.id);
}
}
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});pip install steel-sdk playwrightfrom playwright.sync_api import sync_playwright
from steel import Steel
client = Steel()
def main() -> None:
session = client.sessions.create()
print(f"Watch the session live at {session.session_viewer_url}")
try:
with sync_playwright() as playwright:
browser = playwright.chromium.connect_over_cdp(f"{session.websocket_url}&apiKey={client.steel_api_key}")
context = browser.contexts[0] if browser.contexts else browser.new_context()
page = context.pages[0] if context.pages else context.new_page()
page.goto("https://news.ycombinator.com")
for title in page.locator(".titleline > a").all_text_contents()[:5]:
print(title)
browser.close()
finally:
client.sessions.release(session.id)
if __name__ == "__main__":
main()Go
go get github.com/steel-dev/sdk/gopackage main
import (
"context"
"fmt"
"log"
"github.com/steel-dev/sdk/go"
)
func main() {
ctx := context.Background()
client := steel.NewClient()
session, err := client.Sessions.New(ctx, steel.SessionNewParams{})
if err != nil {
log.Fatal(err)
}
defer func() {
if _, err := client.Sessions.Release(ctx, session.ID); err != nil {
log.Print(err)
}
}()
fmt.Println("Watch the session live at", session.SessionViewerURL)
fmt.Println("Connect Playwright or Puppeteer to", session.WebsocketURL+"&apiKey=<your API key>")
}Rust
cargo add steel-rs
cargo add tokio --features macros,rt-multi-thread#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = steel_rs::Client::new();
let session = client
.sessions()
.create(steel_rs::SessionCreateParams::default())
.await?;
println!("Watch the session live at {}", session.session_viewer_url);
println!(
"Connect Playwright or Puppeteer to {}&apiKey=<your API key>",
session.websocket_url
);
client.sessions().release(&session.id).await?;
Ok(())
}Java (beta)
The Java SDK is not on Maven Central yet. java/README.md shows how to install it locally.
package dev.steel.example;
import dev.steel.api.client.SteelClient;
import dev.steel.api.client.okhttp.SteelOkHttpClient;
import dev.steel.api.models.sessions.Session;
import dev.steel.api.models.sessions.SessionCreateParams;
public final class Quickstart {
private Quickstart() {}
public static void main(String[] args) {
SteelClient client = SteelOkHttpClient.fromEnv();
Session session = client.sessions().create(SessionCreateParams.none());
try {
System.out.println("Watch the session live at " + session.sessionViewerUrl());
System.out.println(
"Connect Playwright or Puppeteer to " + session.websocketUrl() + "&apiKey=<your API key>");
} finally {
client.sessions().release(session.id());
}
}
}Kotlin (beta)
The Kotlin SDK is not on Maven Central yet. kotlin/README.md shows how to install it locally.
package dev.steel.example
import dev.steel.api.client.okhttp.SteelOkHttpClient
fun main() {
val client = SteelOkHttpClient.fromEnv()
val session = client.sessions().create()
try {
println("Watch the session live at ${session.sessionViewerUrl()}")
println(
"Connect Playwright or Puppeteer to ${session.websocketUrl()}&apiKey=<your API key>"
)
} finally {
client.sessions().release(session.id())
}
}The async client has the same methods as suspend functions, and its pages stream as a Flow. Coroutines.kt shows both.
A session runs until you release it or it times out, so release it when you are done, as the examples do in finally.
| Language | Package | Install | Reference |
|---|---|---|---|
| TypeScript and JavaScript | steel-sdk |
npm install steel-sdk |
README · API |
| Python | steel-sdk |
pip install steel-sdk |
README · API |
| Go | github.com/steel-dev/sdk/go |
go get github.com/steel-dev/sdk/go |
README · API |
| Rust | steel-rs |
cargo add steel-rs |
README · docs.rs |
| Java (beta) | dev.steel:steel-java |
Install locally | README |
| Kotlin (beta) | dev.steel:steel-kotlin |
Install locally | README |
| TypeScript | Python | |
|---|---|---|
| Start and release a browser | client.sessions.create() · client.sessions.release(id) |
client.sessions.create() · client.sessions.release(id) |
| Use a residential proxy, solve captchas, block ads | sessions.create({ useProxy: true, solveCaptcha: true, blockAds: true }) |
sessions.create(use_proxy=True, solve_captcha=True, block_ads=True) |
| Turn a page into Markdown, a screenshot or a PDF, without a session | client.scrape() · client.screenshot() · client.pdf() |
client.scrape() · client.screenshot() · client.pdf() |
| Keep cookies and logins between sessions | sessions.create({ persistProfile: true }), then { profileId } |
sessions.create(persist_profile=True), then profile_id= |
| Move files in and out of a browser | client.sessions.files.upload() · .download() · .list() |
client.sessions.files.upload() · .download() · .list() |
| Sign in with stored credentials | client.credentials.create(), then sessions.create({ credentials: {} }) |
client.credentials.create(), then sessions.create(credentials={}) |
| Load your own Chrome extensions | client.extensions.upload(), then sessions.create({ extensionIds }) |
client.extensions.upload(), then sessions.create(extension_ids=...) |
| Watch a session live or replay it | session.sessionViewerUrl · client.sessions.hls(id) |
session.session_viewer_url · client.sessions.hls(id) |
| See what a session did and what it cost | client.sessions.logs(id) · client.sessions.cost(id) |
client.sessions.logs(id) · client.sessions.cost(id) |
The Go, Rust, Java and Kotlin SDKs have the same methods under their own names, such as client.Sessions.New in Go and client.sessions().create in Rust, Java and Kotlin.
Every SDK comes with examples, and CI compiles all of them for each release.
| Recipe | TypeScript | Python | Go | Rust | Java | Kotlin |
|---|---|---|---|---|---|---|
| Drive a session with Playwright | ts | sync · async | ||||
| Drive a session with Puppeteer | ts | |||||
| Start a session for any CDP client | go | rs | java | kt | ||
| Scrape, screenshot and PDF without a session | ts | py | go | rs | java | kt |
| Keep logins between sessions with profiles | ts | py | ||||
| Upload and download files | ts | py | ||||
| Proxies, captcha solving and other session options | ts | py | ||||
| Read the logs and the cost of a session | ts | py | ||||
| List live sessions | ts | py | go | rs | kt, async |
Run an example from its SDK's directory with STEEL_API_KEY set.
| Language | Command |
|---|---|
| TypeScript | yarn && yarn tsn examples/quick-actions.ts |
| Python | rye sync && rye run python examples/quick_actions.py |
| Go | go run ./examples/quick-actions |
| Rust | cargo run --example quick_actions |
| Java | ./gradlew :steel-java-example:run -Pexample=QuickActions |
| Kotlin | ./gradlew :steel-kotlin-example:run -Pexample=QuickActions |
For complete projects, such as agents built on popular frameworks, see steel-cookbook.
All six SDKs share one version and are released together. CHANGELOG.md lists what each release changed, and Releases show each one with its notes. Before 1.0, a minor release can include breaking changes, and the changelog calls them out. The Java and Kotlin SDKs are in beta, so any release can change their API.
The code in this repository is generated from the Steel API's OpenAPI spec, openapi.json, and every release regenerates all of it. A pull request can't be merged as it is, so please open an issue for a bug, a missing feature or a recipe you would like to see. We fix it at the source and ship it in the next release. CONTRIBUTING.md has the details.
Questions are welcome on Discord.
Please report security issues privately to security@steel.dev, as SECURITY.md describes.