Skip to content

Instantly share code, notes, and snippets.

@nibzard
Created February 14, 2026 17:49
Show Gist options
  • Select an option

  • Save nibzard/6ea853e8f9ff70857d6519a392b53778 to your computer and use it in GitHub Desktop.

Select an option

Save nibzard/6ea853e8f9ff70857d6519a392b53778 to your computer and use it in GitHub Desktop.

Here’s a tight, “copy/paste → wow it works” outline that does exactly two things: create a Steel session + perform one visible action (navigate to a page), with a clean shutdown.

Article outline: “Hello Steel” (create a session + do one thing)

H1 — Hello Steel: Spin up a cloud browser session and open a page • 1–2 sentence promise: “In 5 minutes you’ll create a Steel Session, connect with Playwright, and watch it load a site in the live viewer.” 

H2 — What you need (keep it minimal) • A Steel account + API key (Settings → API Keys)  • Node.js + a terminal (no Docker / no browser installs required on your machine for this flow)

H2 — Step 1: Install 2 deps + set STEEL_API_KEY • Create .env with STEEL_API_KEY=... (+ remind to gitignore it)  • Install: steel-sdk, playwright, (and dotenv if you load env that way) 

H2 — Step 2: One-file script (create session → connect → do one action)

Goal of the section: reader pastes one snippet and runs it. • Create a Steel client • sessions.create() and print session.sessionViewerUrl (so they can see the win)  • Connect via Playwright CDP: chromium.connectOverCDP("wss://connect.steel.dev?apiKey=...&sessionId=...")  • Use the existing context/page so the run shows up in the live viewer  • One action: page.goto("https://example.com")  • Cleanup: browser.close() + sessions.release(session.id) 

Callout box idea (1–2 lines): “Why existing context matters: it ensures the session is recorded in the live viewer.” 

H2 — Step 3: Run it + verify the “win” • Run command (one-liner) • Open the printed Session Viewer URL and watch the page load 

H2 — Step 4: Don’t leak sessions (tiny but important) • “Sessions stay live until released or timeout — always release when you’re done.” 

H2 — Troubleshooting (3 bullets, no fluff) • “401/unauthorized” → wrong/missing STEEL_API_KEY env var  • “Viewer is blank” → you created a new context/page instead of using the existing one  • “Session won’t stop” → you didn’t call release() 

Optional 2-line outro (don’t derail the happy path) • Next: add useProxy / solveCaptcha when creating the session (link to those docs) 

If you want, I can also write the exact one-file snippet that matches this outline (TypeScript or plain JS) in the same minimal style.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment