Skip to main content
Browser Use is an open-source project that empowers AI agents to control web browsers, enabling tasks such as automated web navigation and data extraction.

Prerequisites

Before you begin, ensure you have:
  • Python 3.11 or later. Browser Use declares requires-python >=3.11, so an older interpreter fails to resolve the package rather than reporting a clear error
  • A SambaCloud API key. Get one by creating a SambaCloud account and generating a key from the API keys tab
Browser Use needs two things from a model, and they are separate capabilities. It sends every screenshot to the model while use_vision=True (the default), so the model must accept image input. It also asks for each next action as JSON using response_format with type: json_schema, so the model must support structured output. It does not use tool calling, so a model’s absence from the function calling list does not rule it out.This guide uses gemma-4-31B-it, which accepts image input and has constrained decoding enabled, so json_schema is enforced as the response is generated. See Choosing a model for the text-only alternative.

1. Install Browser Use

create environment
activate environment
install browser-use and chromium
The second command is a separate step and easy to skip. Browser Use drives its own Chromium build, which uv pip install does not fetch, so without it the first run fails when it tries to launch a browser. Expect about 180 MB and a few minutes; it prints Installation complete. when it finishes.
Run browser-use install inside the activated virtual environment, not as uvx browser-use install. uvx ignores your environment and resolves its own copy of Browser Use, so you can end up with a browser installed for a different version than the one your code imports.

2. Configure your SambaCloud key

Create a .env file in your project directory:
.env
On Windows, use echo. > .env
Add your SambaCloud API key:
.env

3. Run your first agent

Browser Use has no dedicated SambaNova class. Connect to SambaCloud through ChatOpenAI with a custom base_url – the same pattern Browser Use uses for any OpenAI-compatible provider.
agent.py
Run it:
Browser Use opens a Chromium window, logs each step it takes to the terminal, and closes when the task finishes. The step log comes from Browser Use itself; the answer to your task is the value final_result() returns, which is why the example captures result rather than discarding it.
Always pass max_steps. It defaults to 500, and every step on a vision model sends another screenshot, so a task that never converges keeps calling the model until it hits that ceiling. Start low, around 25, and raise it only for tasks that genuinely need more navigation.

Keep credentials out of the prompt

Pass anything secret through sensitive_data rather than writing it into the task, and scope it to the domains that are allowed to receive it. Browser Use substitutes the value when it fills a field, so the literal never reaches the model:
Set allowed_domains whenever you use sensitive_data. Without it Browser Use logs Agent(sensitive_data=••••••••) was provided but Browser(allowed_domains=[...]) is not locked down! and warns that a prompt-injection attack on any page the agent visits could expose your credentials. An agent that browses freely with secrets loaded is the main security risk in this integration.
The browser runs visible by default, which is useful while you are building. For an unattended run, set headless=True on the profile:

Choosing a model

SambaCloud model support for Browser Use depends on the task: Set use_vision=False like this:
See SambaCloud models for the current catalog and Model deprecations before you reuse a model ID from an older guide, since IDs are retired over time.

Troubleshooting

Confirm SAMBANOVA_API_KEY is set in .env and that load_dotenv() runs before you construct ChatOpenAI. A key copied with a trailing space or newline also triggers this.
Two different causes. If it errors on image input, the model is text only: switch to gemma-4-31B-it, or keep your model and set use_vision=False. If it runs but never picks a useful action, the model is likely not honoring the json_schema response format that Browser Use uses to request each action, so choose a model with structured output support.
The model string must match a current SambaCloud model ID exactly, and IDs are case-sensitive and take no provider prefix. Confirm it against SambaCloud models, or list the catalog directly with curl https://api.sambanova.ai/v1/models, which needs no API key. A model that has been retired returns this error even though older guides still reference it.
Run browser-use install inside the activated virtual environment. Browser Use drives its own Chromium build, which uv pip install browser-use does not fetch, and the command prints Installation complete. when it succeeds. If you ran it as uvx browser-use install, run it again inside the environment: uvx resolves its own copy of Browser Use, so the browser it installed may belong to a different version than the one your code imports.

Next steps