Skip to content

Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.

Simple example

Magnus Müller8ee41dbb5f36
diff --git a/examples/simple.py b/examples/simple.py
index 8e5a8d262..e6c04da4b 100644
--- a/examples/simple.py
+++ b/examples/simple.py
@@ -2,28 +2,26 @@ import asyncio
import os
import sys
-from browser_use.llm.openai.chat import ChatOpenAI
-
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from dotenv import load_dotenv
load_dotenv()
+from browser_use import Agent, ChatOpenAI
-from browser_use import Agent
-
-# Initialize the model
-llm = ChatOpenAI(
- model='gpt-5-mini',
-)
+async def main():
+ # Choose your model
+ llm = ChatOpenAI(model='gpt-5-mini')
-task = 'Go and find the founders of browser-use'
-agent = Agent(task=task, llm=llm)
+ # Define your task
+ task = 'Go and find the founders of browser-use'
+ # Create the agent
+ agent = Agent(task=task, llm=llm)
-async def main():
+ # Start
await agent.run()