{"id":1407,"library":"browser-use","title":"Browser Use","description":"Browser Use is a Python library designed to empower AI agents with the ability to navigate and interact with web browsers programmatically. It facilitates tasks such as clicking buttons, filling forms, and scraping data, effectively allowing AI to perform web-based actions autonomously. The library is actively maintained with frequent updates.","status":"active","version":"0.12.6","language":"en","source_language":"en","source_url":"https://github.com/browser-use/browser-use","tags":["browser automation","AI agents","web scraping","CDP","LLM tools","headless browser"],"install":[{"cmd":"pip install browser-use","lang":"bash","label":"PyPI"},{"cmd":"uv pip install browser-use","lang":"bash","label":"with uv (recommended)"},{"cmd":"curl -fsSL https://browser-use.com/cli/install.sh | bash","lang":"bash","label":"CLI Installation (macOS/Linux)"}],"dependencies":[{"reason":"Recommended for loading environment variables for API keys.","package":"python-dotenv","optional":true},{"reason":"Was a core dependency but removed due to a supply chain attack in v0.12.5; install separately if `ChatLiteLLM` wrapper is needed.","package":"litellm","optional":true}],"imports":[{"note":"The core class for defining and running AI browser automation tasks.","symbol":"Agent","correct":"from browser_use import Agent"},{"note":"For configuring browser settings like headless mode or cloud usage.","symbol":"Browser","correct":"from browser_use import Browser"},{"note":"One of the recommended LLM wrappers optimized for browser automation tasks.","symbol":"ChatBrowserUse","correct":"from browser_use import ChatBrowserUse"}],"quickstart":{"code":"import asyncio\nimport os\nfrom dotenv import load_dotenv\nfrom browser_use import Agent, Browser, ChatBrowserUse\n\nload_dotenv()\n\nasync def main():\n    # Set API keys as environment variables (e.g., in a .env file)\n    # BROWSER_USE_API_KEY=your_browser_use_key\n    # OPENAI_API_KEY=your_openai_key (or other LLM provider)\n    \n    # Optionally configure the browser (headless by default)\n    browser = Browser(\n        # use_cloud=False, # Set to True to use Browser Use Cloud\n        # headless=False,  # Set to False to see the browser window\n        # window_size={'width': 1920, 'height': 1080}\n    )\n\n    agent = Agent(\n        task=\"Go to example.com and extract the main heading text\",\n        llm=ChatBrowserUse(api_key=os.environ.get('BROWSER_USE_API_KEY', '')), # Or ChatOpenAI, ChatGoogle, etc.\n        browser=browser,\n    )\n\n    result = await agent.run()\n    print(\"Task completed.\")\n    print(f\"Final result: {result.final_result()}\")\n    print(f\"Visited URLs: {result.urls()}\")\n\nif __name__ == \"__main__\":\n    asyncio.run(main())\n","lang":"python","description":"This quickstart demonstrates how to initialize an `Agent` with a natural language task and an LLM, then run it to automate web browsing. It includes setting up environment variables for API keys and basic browser configuration."},"warnings":[{"fix":"If `litellm` functionality is required, install it explicitly: `pip install litellm`. Ensure your `litellm` version is not `1.82.7` or `1.82.8`.","message":"Starting with version `0.12.5`, `litellm` was removed as a core dependency due to a supply chain attack. If you rely on `ChatLiteLLM` or other `litellm` features, you must install `litellm` separately (`pip install litellm`).","severity":"breaking","affected_versions":">=0.12.5"},{"fix":"Review your automation logic, especially if it relied on Playwright internals. Consult the latest documentation for `0.12.3` and SDK 3.0 for API changes and new best practices.","message":"Version `0.12.3` introduced Browser Use CLI 2.0, which switched from Playwright to direct Chrome DevTools Protocol (CDP). This change provides faster performance but might alter underlying browser interaction behavior or require adjustments if previous Playwright-specific assumptions were made. SDK 3.0 also brought breaking changes to the client.run() API.","severity":"breaking","affected_versions":">=0.12.3"},{"fix":"Ensure you are targeting Chrome or Chromium for your browser automation tasks.","message":"Browser Use primarily leverages Chrome DevTools Protocol (CDP), meaning it only supports Chrome/Chromium-based browsers. Safari and Firefox are not supported.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Upgrade your Python environment to version 3.11 or newer.","message":"The library requires Python 3.11 or higher. Using older Python versions will lead to installation or runtime errors.","severity":"gotcha","affected_versions":"<3.11"},{"fix":"Create a `.env` file in your project root with your API keys and call `load_dotenv()` at the start of your script. Alternatively, set them directly in your environment.","message":"API keys (e.g., `BROWSER_USE_API_KEY`, `OPENAI_API_KEY`, `BROWSERLESS_TOKEN`) are essential for most functionalities. These should be set as environment variables, often loaded from a `.env` file using `python-dotenv` and `load_dotenv()`. Failure to set them correctly will result in authentication errors.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}