Skip to content

Run Browser Use on Steel

Set up your agent

Give your coding agent a Steel browser and the Steel skills, so that it browses and writes Steel code the right way. Learn more

Install the Steel CLI. It signs you in and installs the skills for your coding agents.

curl -fsS https://setup.steel.dev | sh

Or send this prompt to your coding agent, and it does the same:

Read https://setup.steel.dev/install.md and follow it to set up Steel for this coding client.
Then continue my requested task using the installed Steel skill.

Set up your agent →

Browser Use is a Python agent framework. You give it a model, a browser and a task in plain language, and the model decides each step. With Steel, the browser is a Steel session. Browser Use connects to it over the Chrome DevTools Protocol (CDP) through Browser(cdp_url=...). Your task, your model and the rest of your agent stay the same. Proxies, CAPTCHA solving and the live view come from the session, not from Browser Use.

In this guide, you run a first Browser Use agent on Steel and watch it work in the dashboard. After the run, you replay what it did. Then you add Steel features for real sites.

Before you begin

  • Python 3.11 or later.
  • A Steel API key in the STEEL_API_KEY environment variable. See API keys.
  • A key for your model provider. The program on this page uses OpenAI, with the key in OPENAI_API_KEY.

Make a folder for the project, and install Browser Use and the Steel SDK in it. The program uses the Browser Use 1.0 API. Version 1.0 removed BrowserSession, which earlier versions used for the connection. The browser runs in Steel, so you do not need Chrome or Playwright's browsers on your machine.

mkdir steel-browser-use
cd steel-browser-use
python3 -m venv .venv
source .venv/bin/activate
pip install "browser-use>=1.0" steel-sdk

1. Write the agent

This program creates a session and prints its session viewer URL. It waits for you to press Enter, so that you can open the URL before the agent starts. Then it gives the session's CDP URL to a Browser Use agent, runs one task and releases the session in finally. CDP explains the URL.

main.py
import asyncio
import os
import sys

from browser_use import Agent, Browser
from browser_use.llm import ChatOpenAI
from steel import Steel


async def main():
    client = Steel()
    session = client.sessions.create()
    print("Session viewer:", session.session_viewer_url)

    try:
        if sys.stdin.isatty():
            input("Open the session viewer, then press Enter.")
        agent = Agent(
            task="Open https://example.com and report the page title.",
            llm=ChatOpenAI(model="gpt-6.1-sol", api_key=os.environ["OPENAI_API_KEY"]),
            browser=Browser(
                cdp_url=session.websocket_url
            ),
        )
        result = await agent.run()
        print(result.final_result())
    finally:
        client.sessions.release(session.id)


asyncio.run(main())

2. Run it and watch it live

Run the program:

python main.py

First, the program prints a link to the session viewer, the session's page in the Steel dashboard. Then it waits:

Session viewer: https://app.steel.dev/sessions/ca56be8f-6d19-42dd-9047-d09bf3c9a981
Open the session viewer, then press Enter.

Open the URL in a browser where you are signed in to Steel. The viewer shows the session's browser, live. Press Enter in the terminal, and watch the agent open example.com in the viewer. Browser Use logs each step of the agent in the terminal. At the end, the program prints the agent's answer, which names the title Example Domain. The wording changes from run to run.

3. Replay the run

When the agent is done, the program releases the session. Open the session viewer URL again: it now plays the recording of what the agent did. Next to the video, the agent traces list each page that the agent loaded and each click and input, and selecting one moves the video to that moment. Use them to find the step where an agent went wrong.

4. Add Steel features for real sites

Pass session options to client.sessions.create(). Browser Use does not see them. For example, this session uses a Steel proxy and solves CAPTCHAs:

session = client.sessions.create(use_proxy=True, solve_captcha=True)

An agent can run for many minutes. If a task takes longer than the session's timeout, set a longer one when you create the session. See Set timeouts and Session configuration.

The model's tokens and the session's browser time are billed separately. While the model plans a step, the session keeps running and keeps costing browser time. Limit a task's steps and retries, and release the session in finally.

Next steps