Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.
Python ai-agentsai-toolsbrowser-agentbrowser-automationbrowser-usecdpcloud-browsercomputer-useheadless-browserllmmcpplaywrightpythonremote-browserstealth-browserweb-automationweb-scraping
docs and version decrease to 0.9.5
Gregor Žunič2fd577efea2a
diff --git a/README.md b/README.mdindex b36f3b8b6..78ddc48ff 100644--- a/README.md+++ b/README.md@@ -97,6 +97,29 @@ Check out the [library docs](https://docs.browser-use.com) and the [cloud docs](<br/>+# 🔥 Production with Sandboxes++**The easiest way to run Browser-Use in production.** We handle agents, browsers, persistence, auth, cookies, and LLMs. The agent runs right next to the browser for minimal latency.++```python+from browser_use import Browser, sandbox, ChatBrowserUse+from browser_use.agent.service import Agent++@sandbox(+ cloud_profile_id='your-profile-id', # Your saved cookies/auth+ cloud_proxy_country_code='us', # Bypass captchas, cloudflare, geo-restrictions+)+async def production_task(browser: Browser):+ agent = Agent(task="Your task", browser=browser, llm=ChatBrowserUse())+ await agent.run()++await production_task()+```++See [Going to Production](https://docs.browser-use.com/production) to sync your cookies to the cloud.++<br/>+# 🚀 Template Quickstart**Want to get started even faster?** Generate a ready-to-run template:diff --git a/docs/customize/sandbox/all-parameters.mdx b/docs/customize/sandbox/all-parameters.mdxnew file mode 100644index 000000000..4c7c618c0--- /dev/null+++ b/docs/customize/sandbox/all-parameters.mdx@@ -0,0 +1,32 @@+---+title: "All Parameters"+description: "Sandbox configuration reference"+icon: "sliders"+---++## Reference++| Parameter | Type | Description | Default |+|-----------|------|-------------|---------|+| `BROWSER_USE_API_KEY` | `str` | API key (or env var) | Required |+| `cloud_profile_id` | `str` | Browser profile UUID | `None` |+| `cloud_proxy_country_code` | `str` | us, uk, fr, it, jp, au, de, fi, ca, in | `None` |+| `cloud_timeout` | `int` | Minutes (max: 15 free, 240 paid) | `None` |+| `on_browser_created` | `Callable` | Live URL callback | `None` |+| `on_log` | `Callable` | Log event callback | `None` |+| `on_result` | `Callable` | Success callback | `None` |+| `on_error` | `Callable` | Error callback | `None` |++## Example++```python+@sandbox(+ cloud_profile_id='550e8400-e29b-41d4-a716-446655440000',+ cloud_proxy_country_code='us',+ cloud_timeout=60,+ on_browser_created=lambda data: print(f'Live: {data.live_url}'),+)+async def task(browser: Browser):+ agent = Agent(task="your task", browser=browser, llm=ChatBrowserUse())+ await agent.run()+```diff --git a/docs/customize/sandbox/events.mdx b/docs/customize/sandbox/events.mdxnew file mode 100644index 000000000..d5bba57a6--- /dev/null+++ b/docs/customize/sandbox/events.mdx@@ -0,0 +1,31 @@+---+title: "Events"+description: "Monitor execution with callbacks"+icon: "bell"+---++## Live Browser View++```python+@sandbox(on_browser_created=lambda data: print(f'👁️ {data.live_url}'))+async def task(browser: Browser):+ agent = Agent(task="your task", browser=browser, llm=ChatBrowserUse())+ await agent.run()+```++## All Events++```python+from browser_use.sandbox import BrowserCreatedData, LogData, ResultData, ErrorData++@sandbox(+ on_browser_created=lambda data: print(f'Live: {data.live_url}'),+ on_log=lambda log: print(f'{log.level}: {log.message}'),+ on_result=lambda result: print('Done!'),+ on_error=lambda error: print(f'Error: {error.error}'),+)+async def task(browser: Browser):+ # Your code+```++All callbacks can be sync or async.diff --git a/docs/customize/sandbox/quickstart.mdx b/docs/customize/sandbox/quickstart.mdxnew file mode 100644index 000000000..63121aea3--- /dev/null+++ b/docs/customize/sandbox/quickstart.mdx@@ -0,0 +1,51 @@+---+title: "Quickstart"+description: "Run browser automation in the cloud"+icon: "rocket"+---++Sandboxes are the **easiest way to run Browser-Use in production**. We handle agents, browsers, persistence, auth, cookies, and LLMs. It's also the **fastest way to deploy** - the agent runs right next to the browser, so latency is minimal.++<Note>+Get your API key at [cloud.browser-use.com/new-api-key](https://cloud.browser-use.com/new-api-key) - new signups get $10 free.+</Note>++## Basic Example++Just wrap your function with `@sandbox()`:++```python+from browser_use import Browser, sandbox, ChatBrowserUse+from browser_use.agent.service import Agent++@sandbox()+async def my_task(browser: Browser):+ agent = Agent(task="Find the top HN post", browser=browser, llm=ChatBrowserUse())+ await agent.run()++await my_task()+```++## With Cloud Parameters++```python+@sandbox(+ cloud_profile_id='your-profile-id', # Use saved cookies/auth+ cloud_proxy_country_code='us', # Bypass captchas, cloudflare, geo-restrictions+ cloud_timeout=60, # Max session time (minutes)+)+async def task(browser: Browser, url: str):+ agent = Agent(task=f"Visit {url}", browser=browser, llm=ChatBrowserUse())+ await agent.run()++await task(url="https://example.com")+```++**What each does:**+- `cloud_profile_id` - Use saved cookies/authentication from your cloud profile+- `cloud_proxy_country_code` - Route through country-specific proxy for stealth (bypass captchas, Cloudflare, geo-blocks)+- `cloud_timeout` - Maximum time browser stays open in minutes++---++For more parameters and events, see the other tabs in this section.diff --git a/docs/docs.json b/docs/docs.jsonindex 6ccd55c32..e4e47e2b2 100644--- a/docs/docs.json+++ b/docs/docs.json@@ -144,7 +144,8 @@"introduction","quickstart","quickstart_llm",- "supported-models"+ "supported-models",+ "production"]},{@@ -213,6 +214,16 @@"customize/integrations/docs-mcp","customize/integrations/mcp-server"]+ },+ {+ "group": "Sandbox",+ "icon": "box",+ "isDefaultOpen": false,+ "pages": [+ "customize/sandbox/quickstart",+ "customize/sandbox/events",+ "customize/sandbox/all-parameters"+ ]}]},diff --git a/docs/production.mdx b/docs/production.mdxnew file mode 100644index 000000000..3ab035784--- /dev/null+++ b/docs/production.mdx@@ -0,0 +1,42 @@+---+title: "Going to Production"+description: "Deploy with authentication"+icon: "rocket-launch"+---++Deploy with saved authentication: test locally → sync cookies → use cloud profile.++## 1. Test Locally++```python+browser = Browser(+ executable_path='/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',+ user_data_dir='~/Library/Application Support/Google/Chrome',+ profile_directory='Default',+)+agent = Agent(task="your task", browser=browser, llm=ChatBrowserUse())+await agent.run()+```++<Warning>Close Chrome completely before running.</Warning>++## 2. Sync to Cloud++Create profile at [cloud.browser-use.com/dashboard/settings?tab=profiles](https://cloud.browser-use.com/dashboard/settings?tab=profiles)++```bash+export BROWSER_USE_API_KEY=your_key && curl -fsSL https://browser-use.com/profile.sh | sh+```++Log into your accounts in the browser that opens. You'll get a `profile_id`.++## 3. Use in Production++```python+@sandbox(cloud_profile_id='your-profile-id')+async def task(browser: Browser):+ agent = Agent(task="authenticated task", browser=browser, llm=ChatBrowserUse())+ await agent.run()+```++Done - your cloud browser is already logged in.diff --git a/docs/quickstart.mdx b/docs/quickstart.mdxindex 15a45d0d9..3e867e567 100644--- a/docs/quickstart.mdx+++ b/docs/quickstart.mdx@@ -135,3 +135,27 @@ if __name__ == "__main__":</CodeGroup><Note> Custom browsers can be configured in one line. Check out <a href = "customize/browser/basics">browsers</a> for more. </Note>++## 4. Going to Production++Sandboxes are the **easiest way to run Browser-Use in production**. We handle agents, browsers, persistence, auth, cookies, and LLMs. It's also the **fastest way to deploy** - the agent runs right next to the browser, so latency is minimal.++<Warning>+Sandboxes are in **beta**.+</Warning>++To run in production with authentication, just add `@sandbox` to your function:++```python+from browser_use import Browser, sandbox, ChatBrowserUse+from browser_use.agent.service import Agent++@sandbox(cloud_profile_id='your-profile-id')+async def production_task(browser: Browser):+ agent = Agent(task="Your authenticated task", browser=browser, llm=ChatBrowserUse())+ await agent.run()++await production_task()+```++See [Going to Production](/production) for how to sync your cookies to the cloud.diff --git a/pyproject.toml b/pyproject.tomlindex 61308cd1e..284451946 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -2,7 +2,7 @@name = "browser-use"description = "Make websites accessible for AI agents"authors = [{ name = "Gregor Zunic" }]-version = "0.10.0rc1"+version = "0.9.5"readme = "README.md"requires-python = ">=3.11,<4.0"classifiers = [@@ -46,8 +46,6 @@ dependencies = ["pillow>=11.2.1","cloudpickle>=3.1.1","markdownify>=1.2.0",--]# google-api-core: only used for Google LLM APIs# pyperclip: only used for examples that use copy/paste