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
Refactor: Load environment variables and update example tasks
Cursor Agent66f6ecb2a868
diff --git a/.env.example b/.env.exampleindex d57d2c24e..b148217d0 100644--- a/.env.example+++ b/.env.example@@ -19,9 +19,9 @@ CDP_LOGGING_LEVEL=WARNING# Enable/disable anonymous telemetryANONYMIZED_TELEMETRY=true-# Browser Use Cloud Configuration (optional)-# Your Browser Use Cloud API key - get it from: https://cloud.browser-use.com/dashboard/api-# BROWSER_USE_API_KEY=your_api_key_here+# Browser Use Cloud Configuration+# Get your API key from: https://cloud.browser-use.com/dashboard/api+BROWSER_USE_API_KEY=your_api_key_here# Custom API base URL (for enterprise installations)# BROWSER_USE_CLOUD_API_URL=https://api.browser-use.com@@ -29,7 +29,7 @@ ANONYMIZED_TELEMETRY=true# Cloud sync settings# BROWSER_USE_CLOUD_SYNC=false-# Model Configuration+# Model Configuration (optional - use if you want to use other LLM providers)# Default LLM model to use# OPENAI_API_KEY=your_openai_api_key_here# ANTHROPIC_API_KEY=your_anthropic_api_key_here@@ -55,10 +55,3 @@ ANONYMIZED_TELEMETRY=true# BROWSER_USE_NO_PROXY=localhost,127.0.0.1,*.internal# BROWSER_USE_PROXY_USERNAME=username# BROWSER_USE_PROXY_PASSWORD=password---# Browser use LLM---# Your Browser Use Cloud API key - get it from: https://cloud.browser-use.com/dashboard/api-# BROWSER_USE_API_KEY=your_api_key_herediff --git a/examples/getting_started/01_basic_search.py b/examples/getting_started/01_basic_search.pyindex df2df800d..aca081fa1 100644--- a/examples/getting_started/01_basic_search.py+++ b/examples/getting_started/01_basic_search.py@@ -11,6 +11,10 @@ import sys# Add the parent directory to the path so we can import browser_usesys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))+from dotenv import load_dotenv++load_dotenv()+from browser_use import Agentfrom browser_use.llm import ChatBrowserUsediff --git a/examples/getting_started/02_form_filling.py b/examples/getting_started/02_form_filling.pyindex d6233adb1..521270806 100644--- a/examples/getting_started/02_form_filling.py+++ b/examples/getting_started/02_form_filling.py@@ -21,6 +21,10 @@ import sys# Add the parent directory to the path so we can import browser_usesys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))+from dotenv import load_dotenv++load_dotenv()+from browser_use import Agentfrom browser_use.llm import ChatBrowserUsediff --git a/examples/getting_started/03_data_extraction.py b/examples/getting_started/03_data_extraction.pyindex e4c0cf62d..a54251d5c 100644--- a/examples/getting_started/03_data_extraction.py+++ b/examples/getting_started/03_data_extraction.py@@ -21,6 +21,10 @@ import sys# Add the parent directory to the path so we can import browser_usesys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))+from dotenv import load_dotenv++load_dotenv()+from browser_use import Agentfrom browser_use.llm import ChatBrowserUsediff --git a/examples/getting_started/04_multi_step_task.py b/examples/getting_started/04_multi_step_task.pyindex bbee26c7b..6c36e9ad6 100644--- a/examples/getting_started/04_multi_step_task.py+++ b/examples/getting_started/04_multi_step_task.py@@ -21,6 +21,10 @@ import sys# Add the parent directory to the path so we can import browser_usesys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))+from dotenv import load_dotenv++load_dotenv()+from browser_use import Agentfrom browser_use.llm import ChatBrowserUsediff --git a/examples/simple.py b/examples/simple.pyindex 9f2475c86..524e88dce 100644--- a/examples/simple.py+++ b/examples/simple.py@@ -4,11 +4,15 @@ Setup:2. Set environment variable: export BROWSER_USE_API_KEY="your-key""""+from dotenv import load_dotenv+from browser_use import Agentfrom browser_use.llm import ChatBrowserUse+load_dotenv()+agent = Agent(- task='Find the number of stars of the browser-use repo',+ task='Find the number of stars of the following repos: browser-use, playwright, stagehand, react, nextjs',llm=ChatBrowserUse(),)agent.run_sync()