Write Steel code
Your code creates a session with the Steel SDK, drives its browser with Playwright, Puppeteer or an agent framework, and releases the session when it is done. Run a first program, then set up your coding agent to write Steel code for you. Setup takes a few minutes.
To let a coding agent drive a browser itself, without code, start with Set up your agent.
Already use one of these tools? Start from its guide instead. Each one runs a first program on Steel, shows the browser live and replays the run:
- Browser UseRun a Browser Use agent in a Steel browser, and watch it work.
- PlaywrightRun Playwright code on Steel, in TypeScript or Python.
- PuppeteerRun Puppeteer code on Steel, in TypeScript.
Before you begin
You need:
- A Steel account. Sign up at app.steel.dev.
- An API key in the
STEEL_API_KEYenvironment variable. Create a key shows how. - Node.js 20 or later, or Python 3.10 or later.
Install the Steel SDK and Playwright:
npm install steel-sdk playwrightpython3 -m venv .venv
source .venv/bin/activate
pip install steel-sdk playwrightThe browser runs in Steel, so you do not run playwright install.
Run a first program
This program creates a session, connects Playwright to it, opens a page and prints its title.
import Steel from "steel-sdk";
import { chromium } from "playwright";
const client = new Steel();
const session = await client.sessions.create();
try {
const browser = await chromium.connectOverCDP(session.websocketUrl);
const context = browser.contexts()[0];
const page = context.pages()[0] ?? (await context.newPage());
await page.goto("https://steel.dev/practice/news");
console.log(await page.title());
await browser.close();
} finally {
await client.sessions.release(session.id);
}from playwright.sync_api import sync_playwright
from steel import Steel
client = Steel()
session = client.sessions.create()
try:
with sync_playwright() as playwright:
browser = playwright.chromium.connect_over_cdp(session.websocket_url)
context = browser.contexts[0]
page = context.pages[0] if context.pages else context.new_page()
page.goto("https://steel.dev/practice/news")
print(page.title())
browser.close()
finally:
client.sessions.release(session.id)Run it:
npx tsx first-program.mtspython first_program.pyThe client reads your key from STEEL_API_KEY. The session uses the browser's first page, and the finally block releases the session even when a step fails, so that Steel stops billing for it. Build your first Steel automation goes further: it signs in to a site, keeps the sign-in for the next run, and reviews the run.
Let your coding agent write Steel code
A coding agent writes better Steel code when it has current facts in its context. Install the steel-developer skill, then point the agent at these docs in Markdown.
Install the steel-developer skill
A skill is a set of instructions that a coding agent loads when a task needs it. steel-developer covers Steel code: the SDK, the REST API, Playwright, Puppeteer, Stagehand and Browser Use. It also covers credentials, profiles, files, extensions, live view embeds, traces and computer-use integrations.
The setup prompt in Set up your agent installs only the steel-browser skill. That skill drives a browser, and it does not write Steel code. If you set up Steel with that prompt, install steel-developer too.
Install it with the skills installer:
npx skills add steel-dev/skills --skill steel-developerTo install it for one agent, name the agent with -a. The skill supports Claude Code, Cursor, Codex, OpenCode and Pi. -g installs the skill globally, not only in the current project.
npx skills add steel-dev/skills --skill steel-developer -a claude-code -gIf you have the Steel CLI, steel skills install steel-developer does the same. In Claude Code, you can use the plugin marketplace instead. Run these commands inside Claude Code:
/plugin marketplace add steel-dev/skills
/plugin install steel-developer@steel-skillsRestart your agent so that it finds the new skill.
Check the setup
Ask your agent for code, for example:
Write a TypeScript Playwright script that runs on Steel.The agent loads steel-developer for this task. Its code creates a Steel session, connects Playwright to it with connectOverCDP, and releases the session in a finally block. If the code launches a local browser instead, the agent did not find the skill. Restart the agent, and check that you installed the skill for it with -a. With the Steel CLI, steel skills paths shows where each skill is installed.
Point your agent at the docs
Every page of these docs has a Markdown version for agents. An agent that reads the docs can check a method name or an option before it writes code.
| URL | What it holds |
|---|---|
https:// | Where to start: how agents should use Steel, and links to the docs sitemap, pricing, the FAQ and the blog. |
https:// | Every docs page by sidebar group, with a one-line summary and the link to its Markdown version. |
https:// | The full text of every docs page, without the blog. At about 1 MB, it is too large for one fetch. |
https:// | The full text of one sidebar group, such as sessions. or reference-api.. Each one fits in one fetch, and the sitemap links each one. |
A page's URL plus . | One page in Markdown. For example, https://. |
Add ?lang=typescript, ?lang=python, ?lang=go or ?lang=rust to a page's .md URL, to docs/llms-full.txt or to a group's file to keep the code of one language. A code block that the page does not have in that language keeps all of its languages. For example, https://steel.dev/docs/reference/api/sessions.md?lang=python is 40% shorter than the page with all four languages.
Start the agent at llms.txt or the sitemap, and let it fetch the one page that the task needs. When the agent needs every page of one area, such as Stealth, give it that group's file. Use docs/llms-full.txt only when the agent needs every page at once.
Each docs page also links to its Markdown version with View as Markdown. The page's HTTP response has the same URL in a Link header with rel="alternate" and type="text/markdown".
To make this a habit, add a line to the instructions file that your agent reads in every project:
For Steel, read https://steel.dev/llms.txt first, then fetch the .md version of the page you need, with ?lang=typescript for code in TypeScript only.