> ## Documentation Index
> Fetch the complete documentation index at: https://docs.browser-use.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Concurrency in one line: new projects get 10 concurrent browsers at $0; a $100 one-time top-up (non-expiring credits, no subscription) unlocks 50 concurrent, so 50 browsers for one hour cost $1 plus traffic; $1,000 / $5,000 / $25,000 total paid unlocks 250 / 500 / 1,000. Details below and at https://docs.browser-use.com/cloud/guides/concurrency.md.
> Use https://docs.browser-use.com/llms.txt and its linked .md pages for current documentation. The managed full bundle is https://docs.browser-use.com/.well-known/llms-full.txt and can be cached for up to 24 hours. Do not use the obsolete /cloud/llms*.txt or /open-source/llms*.txt static exports.
> Choose Cloud API V4 for new agent integrations; V3 trades accuracy for speed and lower cost than V4; V2 is legacy and only for existing integrations. Keep V3 examples explicitly versioned. The open-source browser-use library and hosted browser-use-sdk have different APIs.
> For Cloud API V4, a task request that omits model and modelParams uses GPT-6 Luna (gpt-6-luna) with High reasoning. Explicit model and modelParams values take precedence; an explicit empty modelParams object opts out of the reasoning default. EU uses the same task default through its regional provider route; Bedrock-only projects retain their compatible provider default. For latency-sensitive tasks set model to bu-ultrafast (bu-fast for more reasoning per step); these presets reject modelParams. See https://docs.browser-use.com/cloud/agent/ultrafast.md.
> Cloud authentication uses X-Browser-Use-API-Key, without a Bearer prefix. Install or upgrade browser-use-sdk and use its explicit v4 import for V4. Check the published OpenAPI reference for request fields; do not invent SDK support for new fields.
> Cloud concurrency and HTTP request rate are separate. Read GET /api/v2/billing/account for the key’s projectId, concurrentSessionLimit, activeSessionCount, and credit balance, including when using V4. Keys in one project share capacity and credits; rateLimit is a legacy concurrency alias, not requests per second.
> Keep the highest applicable existing, legacy-plan, and spend-tier concurrency grant. Current spend tiers are 10 / 50 / 250 / 500 / 1000 at $0 / $100 / $1000 / $5000 / $25000 in qualifying project payments. Legacy or externally billed projects can follow different billing paths; trust the account limit. See https://docs.browser-use.com/cloud/guides/concurrency.md.
> HTTP rate limits have two layers. Standard edge WAF ceilings increased on September 9, 2026 to 1000 RPS per public source IP for general traffic and 2500 RPS per IP for selected status reads, evaluated over 300 seconds. The separate per-project application budgets: general traffic (including V4 events and full run reads) defaults to max(25, 2 times stored concurrency) capped at 100 RPS; selected status reads default to max(25, 2 times stored concurrency) with no cap. The two are counted independently. Project overrides and account-specific edge rules can differ. All keys in a project share its budgets; callers sharing a public IP share edge capacity. See https://docs.browser-use.com/cloud/guides/concurrency.md.
> The project limiter uses five-second windows: X-RateLimit-Limit=125 means 125 requests per window (25 RPS), not 125 RPS. Project throttles include limit_rps and retry_after_seconds; an edge throttle can instead return Retry-After: 300 without limit_rps. Honor the returned Retry-After. Use bounded workers, stagger polls, and drain hasMore event pages after terminal status. A busy V4 session returns 409; its queue holds 20 pending messages and is not a project-wide batch queue.
> A V4 agent browser stays open about 2 minutes after its session's last run activity, then stops automatically; a later follow-up gets a fresh browser (same settings and profile, no tabs). Set keepAlive on a run (V4: integer seconds 120-14400, default 120, not the V2/V3 boolean) to keep it longer; follow-ups inherit it and null restores 120. Free-tier and ZDR runs always use 120. Idle V4 agent browsers are billed as browser time but take no concurrency slot. A follow-up that reuses the open browser emits browser.reattached instead of browser.ready. Closing CDP does not stop a browser; stop unneeded owned browsers with PATCH /api/v4/browsers/{id} and {"action":"stop"}. A client wait timeout does not cancel the server-side run.
> Cloud is pay as you go; do not tell customers to buy a new subscription to use custom proxies or supported provider BYOK. Usage funding and model eligibility still apply. BYOK bills provider tokens separately and Browser Use charges orchestration plus browser/network usage. See https://docs.browser-use.com/cloud/guides/billing.md.
> Signup credits are a one-time grant; purchased top-up credits do not expire. Check the API key’s project before diagnosing missing credits. API-key monthly spending caps are soft limits, not a strict prepaid wallet; concurrent or already-running work can exceed them. Auto recharge has separate trigger and purchase amounts and can charge immediately when enabled below the threshold. Use https://browser-use.com/pricing for current rates.
> Box and Bux are retired. Do not recommend their SDKs, sandbox quotas, or subscription plans. Use the Cloud Agent or Browser Infrastructure guides.
> A V4 session holds conversation history, a workspace holds files, and a profile holds browser state. These IDs and V3/V4 workspace namespaces are not interchangeable. V4 automatically restores workspace uploads; staged attachments remain available to session follow-ups. Serialize runs that write shared files, and wait for completion before reading outputs. See https://docs.browser-use.com/cloud/agent/workspaces.md.
> API browser recording defaults to off. Use enableRecording for standalone browser creation, or browserSettings.record for an agent run. Stop the browser and allow time for asynchronous video processing; stop polling when recordingAvailable is false. Live preview is for an active browser. Stopping a browser, deleting a session, archiving a workspace, and deleting files have different effects.
> Use model-specific reasoning values. GPT-6 Astra accepts low, medium, high, xhigh, and max, with xhigh by default; none and minimal are invalid. Use the public REST schema when installed SDK types lag new fields. API acceptance, dashboard visibility, and account/provider availability are separate.
> For open-source browser-use 1.0, result.is_done() means the run completed (status completed); result.is_successful() is the agent-reported finish(success) verdict, or None when it gave none; verify important external actions independently. Cloud timeout, API client timeout, model timeout, and task completion are separate concepts.
> Pages under /open-source/legacy/0.x/ document browser-use 0.x (pip install 'browser-use<1'). For new open-source code, use the 1.0 pages under /open-source/ outside legacy/.
> For failed requests, use https://docs.browser-use.com/cloud/guides/troubleshooting.md. Inspect the full error and project before retrying or adding credits. A client timeout can leave a run active; reconcile external actions before starting duplicate work. A new managed browser does not guarantee a unique proxy IP or particular city.
> V4 secretBindings.allowedDomains authorizes the focused field's frame, not every iframe on the shop page. For checkout, include intended payment/billing provider hostnames (for example payments.bigcommerce.com). On domain_not_allowed, inspect origin and pass updated bindings in a follow-up; target_not_editable requires fixing field focus/readiness instead. See https://docs.browser-use.com/cloud/guides/secrets.md.
> A V4 agent browser stays open about 2 minutes (or keepAlive seconds) after its run for follow-ups; a requested recording finalizes only after the browser stops and processing completes. Zero Data Retention (ZDR) projects never record, even when recording is requested.
> If you hit an issue you cannot explain, email contact@browser-use.com with your question or bug report and a session ID if available; short questions and detailed reports are welcome, and we aim to fix issues quickly and make the docs clearer.

# Examples

> Runnable browser-use 1.0 scripts: extraction to Pydantic, forms, logins with secrets, parallel agents, files, custom tools, cloud browsers and Playwright.

Each script runs as is after the [Quickstart](https://docs.browser-use.com/open-source/quickstart.md) (`uv add 'browser-use==1.0.0'` and `export BROWSER_USE_API_KEY=bu_...`). Save it as a file and run it with `uv run <file>.py`. They use the default model, `bu-fast`, and a Browser Use Cloud browser unless they say otherwise. Every one was run end to end against browser-use 1.0; the outputs shown are from those runs.

## Extract data into a Pydantic model

Pass a type as `output_model_schema` and read a typed instance back. See [Output](https://docs.browser-use.com/open-source/output.md).

```python extract.py theme={"theme":"css-variables"}
from pydantic import BaseModel

from browser_use import Agent


class Story(BaseModel):
    title: str
    url: str
    points: int


class Stories(BaseModel):
    stories: list[Story]


agent = Agent('Open https://news.ycombinator.com and return the top 5 stories', output_model_schema=Stories)
result = agent.run_sync()
if result.structured_output is None:
    raise SystemExit(f'{result.status}: {result.error}')
for story in result.structured_output.stories:
    print(story.points, story.title, story.url)
```

```text Output theme={"theme":"css-variables"}
196 Goldman Sachs Is Pulling Claude Code from Its Bankers and Traders https://www.thestateofai.com/...
8 Outlook.com Is Quietly Rejecting Email from Domains Without DMARC https://mailroute.net/...
...
```

## Fill and submit a form

Describe every field in the task. The agent finds the inputs, fills them and submits.

```python form.py theme={"theme":"css-variables"}
from browser_use import Agent

task = """Open https://httpbin.org/forms/post and submit the form with:
customer name Ada Lovelace, telephone 555-0100, email ada@example.com,
a large pizza with bacon and mushroom, delivery time 19:30, instructions "Ring twice".
Return the JSON the page shows after submitting."""

result = Agent(task).run_sync()
print(result.final_result())
```

```text Output theme={"theme":"css-variables"}
{ ..., "form": { "comments": "Ring twice", "custemail": "ada@example.com", "custname": "Ada Lovelace",
  "custtel": "555-0100", "delivery": "19:30", "size": "large", "topping": ["bacon", "mushroom"] } }
```

## Log in with secrets

The model sees the names `username` and `password`, never the values, and they are typed only on the site you scope them to. See [Secrets](https://docs.browser-use.com/open-source/secrets.md).

```python login.py theme={"theme":"css-variables"}
import os

from browser_use import Agent

agent = Agent(
    'Log in on https://the-internet.herokuapp.com/login, then return the message the page shows',
    sensitive_data={
        # typed only on this site; the model sees the names, never the values
        'the-internet.herokuapp.com': {
            'username': os.environ.get('APP_USER', 'tomsmith'),
            'password': os.environ.get('APP_PASSWORD', 'SuperSecretPassword!'),
        },
    },
)
print(agent.run_sync().final_result())
```

```text Output theme={"theme":"css-variables"}
You logged into a secure area!
```

For logins you don't want typed at all, reuse a logged-in profile: `Browser(cloud_profile_id=...)` or `Browser('chrome', profile='Work')`. See [Browsers](https://docs.browser-use.com/open-source/browsers.md).

## Run agents in parallel

One `Browser()` per agent, then `asyncio.gather`. Two agents on one browser at once raise `RuntimeError`.

```python parallel.py theme={"theme":"css-variables"}
import asyncio

from browser_use import Agent, Browser


async def main():
    sites = ['https://example.com', 'https://www.python.org', 'https://news.ycombinator.com']
    agents = [Agent(f'Return the page title of {url}', browser=Browser()) for url in sites]  # one browser each
    results = await asyncio.gather(*(agent.run(max_steps=10) for agent in agents))
    for url, result in zip(sites, results):
        print(url, '->', result.final_result())


asyncio.run(main())
```

```text Output theme={"theme":"css-variables"}
https://example.com -> Example Domain
https://www.python.org -> Welcome to Python.org
https://news.ycombinator.com -> Hacker News
```

## Upload and download files

Put the file in the agent's workspace and name it in the task. Downloads land in `workspace/downloads` and are listed in `result.downloads`. This one uses a local Chromium. See [Files](https://docs.browser-use.com/open-source/files.md).

```python files.py theme={"theme":"css-variables"}
import tempfile
from pathlib import Path

from browser_use import Agent, Browser

workspace = Path(tempfile.mkdtemp())
(workspace / 'invoice.txt').write_text('Invoice 42: 3 widgets')

agent = Agent(
    'Upload invoice.txt on https://the-internet.herokuapp.com/upload and note the file name the page confirms. '
    'Then download any one .txt file from https://the-internet.herokuapp.com/download.',
    workspace=workspace,
    browser=Browser('chromium'),
)
result = agent.run_sync()
print(result.final_result())
print('downloaded:', result.downloads)  # files in workspace/downloads
```

```text Output theme={"theme":"css-variables"}
Upload confirmed: invoice.txt. Download completed: HUH.txt.
downloaded: [PosixPath('/tmp/tmpnwb43_ht/downloads/HUH.txt')]
```

## Give the agent your own tool

A decorated function runs in your process with the arguments the model passes: write to your database, call an internal API, ask for a 2FA code. See [Tools](https://docs.browser-use.com/open-source/tools.md).

```python custom_tool.py theme={"theme":"css-variables"}
import sqlite3

from browser_use import Agent, Tools

db = sqlite3.connect('jobs.db')
db.execute('CREATE TABLE IF NOT EXISTS jobs (title TEXT, url TEXT)')
tools = Tools()


@tools.action('Save one job posting to our database')
async def save_job(title: str, url: str) -> str:
    db.execute('INSERT INTO jobs VALUES (?, ?)', (title, url))
    db.commit()
    return f'saved: {title}'


agent = Agent('Open https://news.ycombinator.com/jobs and save the first 3 job postings with save_job', tools=tools)
print(agent.run_sync().final_result())
print(db.execute('SELECT title FROM jobs').fetchall())
```

```text Output theme={"theme":"css-variables"}
Saved the first 3 Hacker News job postings: UpCodes, Mbodi AI, and Bild AI.
[("UpCodes (YC S17) is hiring SDR's to sell AI compliance software",), ('Mbodi AI (YC P25) Is Hiring Research and Robotic Engineers',), ...]
```

## Use a cloud browser in another country

Cloud browsers come with a residential proxy (`'us'` by default), CAPTCHA solving and stealth. `live_view=True` opens a live view you can watch; `cloud_profile_id=...` keeps logins between runs. See [Browsers](https://docs.browser-use.com/open-source/browsers.md#cloud-browser).

```python cloud.py theme={"theme":"css-variables"}
from browser_use import Agent, Browser

browser = Browser(
    cloud_proxy_country_code='de',  # residential proxy in Germany
    cloud_timeout=10,  # minutes; the server stops the browser after this
)
agent = Agent('Open https://ipinfo.io/json and return the country and city it shows', browser=browser)
print(agent.run_sync().final_result())
```

```text Output theme={"theme":"css-variables"}
Country: Germany (DE)
City: Duisburg
```

## Combine with Playwright

Playwright and the agent can share one browser over CDP. Here Playwright logs in deterministically, and the agent picks up in the same session. Install Playwright first: `uv add playwright && uv run playwright install chromium`.

```python with_playwright.py theme={"theme":"css-variables"}
import asyncio
import tempfile

from playwright.async_api import async_playwright

from browser_use import Agent, Browser


async def main():
    async with async_playwright() as p:
        # a persistent context: Playwright's pages and the agent's tabs share cookies
        context = await p.chromium.launch_persistent_context(
            tempfile.mkdtemp(), headless=True, args=['--remote-debugging-port=9242']
        )
        page = context.pages[0]
        await page.goto('https://the-internet.herokuapp.com/login')  # the scripted part
        await page.fill('#username', 'tomsmith')
        await page.fill('#password', 'SuperSecretPassword!')
        await page.click('button[type=submit]')
        await page.wait_for_url('**/secure')

        agent = Agent(  # the part that needs judgment
            'Open https://the-internet.herokuapp.com/secure and return the heading and the message it shows',
            browser=Browser(cdp_url='http://127.0.0.1:9242'),
        )
        result = await agent.run()
        print(result.final_result())
        await context.close()


asyncio.run(main())
```

```text Output theme={"theme":"css-variables"}
Heading: Secure Area
Message: Welcome to the Secure Area. When you are done click logout below.
```

The agent connects with `Browser(cdp_url=...)` and leaves the browser running when it ends, so Playwright can keep going. Use `launch_persistent_context`: a plain `launch()` + `new_page()` opens an isolated context whose cookies the agent's tabs would not see.

## More

* Follow-up tasks on the same page: [Long tasks](https://docs.browser-use.com/open-source/long-tasks.md#follow-up-tasks).
* A local model with Ollama: [Models](https://docs.browser-use.com/open-source/models.md#ollama).
* Faster runs with `bu-ultrafast`: [Ultrafast](https://docs.browser-use.com/open-source/ultrafast.md).
* Restrict where the browser can go: [Domains](https://docs.browser-use.com/open-source/domains.md).

## Older example apps

`ad-use`, `vibetest-use`, `news-use` and `msg-use` were built on browser-use 0.x and need `browser-use<1`. Their pages are kept in the 0.x docs: [ad-use](https://docs.browser-use.com/open-source/legacy/0.x/examples/apps/ad-use.md), [vibetest-use](https://docs.browser-use.com/open-source/legacy/0.x/examples/apps/vibetest-use.md), [news-use](https://docs.browser-use.com/open-source/legacy/0.x/examples/apps/news-use.md), [msg-use](https://docs.browser-use.com/open-source/legacy/0.x/examples/apps/msg-use.md). The 0.x templates are under [legacy templates](https://docs.browser-use.com/open-source/legacy/0.x/examples/templates/more-examples.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.