Browsa
  1. Guides
  2. browser-use

Run browser-use on Browsa.

Run the open-source browser-use agent on a Browsa cloud browser instead of a Chrome on your machine. Your code starts a browser, hands its CDP address to browser-use, and shuts it down when the agent is done.

  • TimeAbout 5 minutes
  • Cost1 credit per 5-minute browser, plus your model costs
  • Last tested
What we tested. On November 7, 2026 we ran this script's connection code against a live Browsa browser with browser-use 0.13.14 and the browsa Python package 0.1.3: Browser(cdp_url=..., headers=...) connected and opened https://example.com. We didn't run the model step, which needs your OpenAI key; that part follows browser-use's own README.

Prerequisites

  • A Browsa API key (it starts with agt_). Sign up for 100 free credits, no card.
  • Python 3.11 or newer (browser-use's minimum).
  • A model key. The script uses OpenAI through browser-use's ChatOpenAI; browser-use also ships ChatAnthropic and others.

Install

Terminal
pip install browser-use browsa

Then put your keys in the environment:

Terminal
export BROWSA_API_KEY="agt_live_..."
export OPENAI_API_KEY="sk-..."

You don't need a local Chrome or playwright install: the browser runs on Browsa.

The script

One file. It starts a 5-minute Browsa browser, gives it to a browser-use Agent, prints the result and destroys the browser, even if the agent fails.

agent.py
import asyncio
import os

from browsa import Client
from browser_use import Agent, Browser, ChatOpenAI

BROWSA_API_KEY = os.environ["BROWSA_API_KEY"]
TASK = "Open https://example.com, follow its link, and tell me the title of the page you land on."


async def main():
    browsa = Client(api_key=BROWSA_API_KEY)
    cloud = browsa.create_agent(ttl="5m")  # a Browsa cloud browser, 1 credit
    try:
        browser = Browser(
            cdp_url=cloud["cdp_http"],
            headers={"X-API-Key": BROWSA_API_KEY},
        )
        agent = Agent(
            task=TASK,
            llm=ChatOpenAI(model="gpt-5.6-luna"),  # reads OPENAI_API_KEY
            browser=browser,
        )
        history = await agent.run(max_steps=15)
        print(history.final_result())
    finally:
        browsa.destroy_agent(cloud["id"])


asyncio.run(main())

Run it:

Terminal
python agent.py

How it works

  1. Start a browser. create_agent(ttl="5m") starts a Chromium on Browsa and returns its id and its cdp_http address.
  2. Hand it to browser-use. Browser(cdp_url=..., headers=...) attaches instead of launching. browser-use reads /json/version at that address and opens the CDP WebSocket, sending your X-API-Key header on both.
  3. Run and clean up. agent.run() drives the page with your model. browser-use closes its connection when the run ends, and destroy_agent() in finally shuts the Browsa browser down even if something fails.

Troubleshooting

401 Unauthorized when connecting

The X-API-Key header didn't reach Browsa, or the key is wrong. Check that BROWSA_API_KEY is set in the shell that runs the script and that it starts with agt_; the Browsa SDK refuses keys that don't. Pass the header exactly as the script does.

The connection drops after a few minutes

The browser reached the end of its TTL and shut down. The scripts use ttl="5m" (1 credit). For longer runs, ask for more, up to "1h"; any TTL over 5 minutes costs 5 credits. Start a new browser for the next run.

Use a different model

Swap the llm= line for another browser-use chat class, for example ChatAnthropic, and set that provider's key. The Browsa part of the script doesn't change.

max_steps reached before the task is done

Raise max_steps and the TTL together, so the browser outlives the agent.

Next steps

Turn the task into a scheduled job, or try the same browser with Stagehand or the OpenAI Agents SDK.

Run it on a cloud browser.

100 free credits. No card, no subscription.