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
Enhance documentation and examples for browser customization
Magnus Müllerfd5482d9cca3
diff --git a/docs/customize/browser-basic.mdx b/docs/customize/browser-basic.mdxindex 6f7482f5a..6149072bb 100644--- a/docs/customize/browser-basic.mdx+++ b/docs/customize/browser-basic.mdx@@ -1,7 +1,7 @@---title: "Basics"description: ""-icon: "globe"+icon: "play"---diff --git a/docs/customize/browser-real-browser.mdx b/docs/customize/browser-real-browser.mdxindex a2e5cbec3..68eedd323 100644--- a/docs/customize/browser-real-browser.mdx+++ b/docs/customize/browser-real-browser.mdx@@ -4,7 +4,7 @@ description: ""icon: "link"----Connect Browser Use to your existing Chrome browser to preserve authentication and use extensions.+Connect your existing Chrome browser to preserve authentication.## Basic Examplediff --git a/docs/customize/chain-agents.mdx b/docs/customize/chain-agents.mdxindex d4183209c..ff5e3f6a6 100644--- a/docs/customize/chain-agents.mdx+++ b/docs/customize/chain-agents.mdx@@ -1,31 +1,45 @@---title: "Chain Agents"-description: ""-icon: "repeat"+description: "Chain multiple tasks together with the same agent and browser session."+icon: "link"mode: "wide"---+## Chain Agent Tasks++Keep your browser session alive and chain multiple tasks together. Perfect for conversational workflows or multi-step processes.+```python-from browser_use import Agent, Browser--# Create browser and keep it alive-browser = Browser(- headless=False,- keep_alive=True, # Don't close browser after each agent-)-tasks = [- 'Search for Browser Use',- 'Click on the first link',- 'Find the social media page',-]+import asyncio+from dotenv import load_dotenv+load_dotenv()++from browser_use import Agent, BrowserProfile++profile = BrowserProfile(keep_alive=True)async def main():- for task in tasks:- agent = Agent(task=task, browser=browser)+ agent = Agent(task="Go to reddit.com", browser_profile=profile)+ await agent.run(max_steps=1)++ while True:+ user_response = input('\n👤 New task or "q" to quit: ')+ if user_response.lower() == 'q':+ break+ agent.add_new_task(f'New task: {user_response}')await agent.run()+if __name__ == '__main__':+ asyncio.run(main())+```- await browser.stop()+## How It Works-```+1. **Persistent Browser**: `BrowserProfile(keep_alive=True)` prevents browser from closing between tasks+2. **Task Chaining**: Use `agent.add_new_task()` to add follow-up tasks+3. **Context Preservation**: Agent maintains memory and browser state across tasks+4. **Interactive Flow**: Perfect for conversational interfaces or complex workflows+<Note>+The browser session remains active throughout the entire chain, preserving all cookies, local storage, and page state.+</Note>\ No newline at end of filediff --git a/docs/customize/fast-agent.mdx b/docs/customize/fast-agent.mdxindex e9e34cb52..ef1946915 100644--- a/docs/customize/fast-agent.mdx+++ b/docs/customize/fast-agent.mdx@@ -14,7 +14,7 @@ from browser_use import Agent, BrowserProfile# Speed optimization instructions for the modelSPEED_OPTIMIZATION_PROMPT = """-SPEED OPTIMIZATION INSTRUCTIONS:+Speed optimization instructions:- Be extremely concise and direct in your responses- Get to the goal as quickly as possible- Use multi-action sequences whenever possible to reduce stepsdiff --git a/docs/customize/more-examples.mdx b/docs/customize/more-examples.mdxnew file mode 100644index 000000000..5a039ed74--- /dev/null+++ b/docs/customize/more-examples.mdx@@ -0,0 +1,54 @@+---+title: "More Examples"+description: "Explore additional examples and use cases on GitHub."+icon: "arrow-up-right-from-square"+mode: "wide"+---++## Additional Examples++Explore our comprehensive collection of examples on GitHub for more advanced use cases and integrations.++### 📁 Featured Examples++**🔒 [Secure Setup](https://github.com/browser-use/browser-use/blob/main/examples/features/secure.py)**+Azure OpenAI with enterprise security and data privacy++**🎯 [Custom Functions](https://github.com/browser-use/browser-use/tree/main/examples/custom-functions)**+2FA integration, file uploads, notifications, and more++**🏪 [E-commerce](https://github.com/browser-use/browser-use/blob/main/examples/use-cases/shopping.py)**+Automated shopping and product comparison++**💼 [Job Applications](https://github.com/browser-use/browser-use/blob/main/examples/use-cases/find_and_apply_to_jobs.py)**+CV upload and job application automation++### 🔗 Browse All Examples++**[View Complete Examples Directory →](https://github.com/browser-use/browser-use/tree/main/examples)**++Categories available:+- **Getting Started** - Basic examples for beginners+- **Features** - Advanced functionality demonstrations+- **Custom Functions** - Extend agent capabilities+- **Integrations** - Gmail, Slack, Discord, MCP servers+- **Models** - Different LLM provider examples+- **Use Cases** - Real-world application scenarios+- **Browser** - Browser configuration examples+- **UI** - Gradio and Streamlit interfaces++### 🤝 Contributing Examples++Have a great use case? **[Submit a pull request](https://github.com/browser-use/browser-use/pulls)** with your example!++**What makes a good example:**+- Clear documentation and comments+- Real-world use case+- Follows project conventions+- Includes error handling++### 📞 Need Help?++- **[GitHub Issues](https://github.com/browser-use/browser-use/issues)** - Bug reports and feature requests+- **[Discord Community](https://link.browser-use.com/discord)** - Live support and discussions+- **Enterprise Support** - [[email protected]](mailto:[email protected])diff --git a/docs/customize/secure.mdx b/docs/customize/secure.mdxnew file mode 100644index 000000000..8a8af634e--- /dev/null+++ b/docs/customize/secure.mdx@@ -0,0 +1,65 @@+---+title: "Secure Setup"+description: "Azure OpenAI with data privacy and security configuration."+icon: "shield-check"+mode: "wide"+---++## Secure Setup with Azure OpenAI++Enterprise-grade security with Azure OpenAI, data privacy protection, and restricted browser access.++```python+import asyncio+import os+from dotenv import load_dotenv+load_dotenv()+os.environ['ANONYMIZED_TELEMETRY'] = 'false'+from browser_use import Agent, BrowserProfile, ChatAzureOpenAI++# Azure OpenAI configuration+api_key = os.getenv('AZURE_OPENAI_KEY')+azure_endpoint = os.getenv('AZURE_OPENAI_ENDPOINT')+llm = ChatAzureOpenAI(model='gpt-4.1-mini', api_key=api_key, azure_endpoint=azure_endpoint)++# Secure browser configuration+browser_profile = BrowserProfile(+ allowed_domains=['*google.com', 'browser-use.com'],+ enable_default_extensions=False+)++# Sensitive data filtering+sensitive_data = {'company_name': 'browser-use'}++# Create secure agent+agent = Agent(+ task='Find the founders of the sensitive company_name',+ llm=llm,+ browser_profile=browser_profile,+ sensitive_data=sensitive_data+)++async def main():+ await agent.run(max_steps=10)++asyncio.run(main())+```++## Security Features++**Azure OpenAI:**+- NOT used to train OpenAI models+- NOT shared with other customers+- Hosted entirely within Azure+- 30-day retention (or zero with Limited Access Program)++**Browser Security:**+- `allowed_domains`: Restrict navigation to trusted sites+- `enable_default_extensions=False`: Disable potentially dangerous extensions+- `sensitive_data`: Filter sensitive information from LLM input++++<Note>+For enterprise deployments contact [email protected].+</Note>diff --git a/docs/docs.json b/docs/docs.jsonindex e140b3835..243ae9a91 100644--- a/docs/docs.json+++ b/docs/docs.json@@ -45,8 +45,8 @@"pages": ["customize/agent-basic","customize/supported-models",- "customize/agent-parameters",- "customize/agent-output-format"+ "customize/agent-output-format",+ "customize/agent-parameters"]},{@@ -65,9 +65,11 @@"icon": "code","pages": ["customize/fast-agent",- "customize/sensitive-data","customize/chain-agents",- "customize/parallel-browser"+ "customize/parallel-browser",+ "customize/sensitive-data",+ "customize/secure",+ "customize/more-examples"]},"customize/custom-functions"diff --git a/examples/features/secure.py b/examples/features/secure.pyindex 2951a5cad..045f4e2bc 100644--- a/examples/features/secure.py+++ b/examples/features/secure.py@@ -49,8 +49,7 @@ sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(load_dotenv()-# Disable all telemetry-os.environ['BROWSER_USE_CLOUD_SYNC'] = 'false'+os.environ['ANONYMIZED_TELEMETRY'] = 'false'diff --git a/examples/getting_started/05_fast_agent.py b/examples/getting_started/05_fast_agent.pyindex 759031336..a6aa2f1e9 100644--- a/examples/getting_started/05_fast_agent.py+++ b/examples/getting_started/05_fast_agent.py@@ -14,7 +14,7 @@ from browser_use import Agent, BrowserProfile# Speed optimization instructions for the modelSPEED_OPTIMIZATION_PROMPT = """-SPEED OPTIMIZATION INSTRUCTIONS:+Speed optimization instructions:- Be extremely concise and direct in your responses- Get to the goal as quickly as possible- Use multi-action sequences whenever possible to reduce steps