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
Example
Magnus Müller9b7bb239857e
diff --git a/examples/code_use_extract_products.py b/examples/code_use_extract_products.pyindex 84af1fb22..8b9c00926 100644--- a/examples/code_use_extract_products.py+++ b/examples/code_use_extract_products.py@@ -26,24 +26,13 @@ Laminar.initialize()async def main():- """- Task: Extract product listings from an e-commerce site.-- The agent will:- 1. Navigate to the products page- 2. Extract products using JavaScript- 3. Scroll to load more products- 4. Combine all results- 5. Save to a JSON file- """+task = """Go to https://www.flipkart.com. Continue collecting products from Flipkart in the following categories. I need approximately 50 products from:\n\n1. Books & Media (books, stationery) - 15 products\n2. Sports & Fitness (equipment, clothing, accessories) - 15 products \n3. Beauty & Personal Care (cosmetics, skincare, grooming) - 10 products\nAnd 2 other categories you find interesting.\nNavigate to these categories and collect products with:\n- Product URL (working link)\n- Product name/description\n- Actual price (MRP)\n- Deal price (current selling price) \n- Discount percentage\n\nFocus on products with good discounts and clear pricing. Target around 40 products total from these three categories."""- task = "Usec requests to get GitHub's API for trending Python repos, then visit the top 3 repos in the browser and extract their README"-# Create code-use agent (uses ChatBrowserUse automatically)agent = CodeAgent(task=task,@@ -80,11 +69,6 @@ Go to https://www.flipkart.com. Continue collecting products from Flipkart in thnotebook_path = export_to_ipynb(session, 'product_extraction.ipynb')print(f'\n✓ Exported session to Jupyter notebook: {notebook_path}')- # Export to Python script- script = session_to_python_script(session)- await asyncio.to_thread(Path('product_extraction.py').write_text, script)- print('✓ Exported session to Python script: product_extraction.py')-finally:await agent.close()