Skip to content

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

Update README.md to be copy-paste-go

pietrozullo504ed6d70f0a
diff --git a/README.md b/README.md
index e8a4adbb6..ecd5fd4df 100644
--- a/README.md
+++ b/README.md
@@ -22,14 +22,18 @@ Spin up your agent:
```python
from langchain_openai import ChatOpenAI
from browser_use import Agent
-
-agent = Agent(
- task="Find a one-way flight from Bali to Oman on 12 January 2025 on Google Flights. Return me the cheapest option.",
- llm=ChatOpenAI(model="gpt-4o"),
-)
-
-# ... inside an async function
-await agent.run()
+import asyncio
+
+async def main():
+ agent = Agent(
+ task="Find a one-way flight from Bali to Oman on 12 January 2025 on Google Flights. Return me the cheapest option.",
+ llm=ChatOpenAI(model="gpt-4o"),
+ )
+ result = await agent.run()
+ print(result)
+
+if __name__ == "__main__":
+ asyncio.run(main())
```
And don't forget to add your API keys to your `.env` file.