Skip to content

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

Example updates

magmuellerc8b37059af91
diff --git a/README.md b/README.md
index 043919bfd..61ef42e66 100644
--- a/README.md
+++ b/README.md
@@ -27,32 +27,15 @@ _Let LLMs interact with websites naturally_
## 🎥 Live Demos
Watch Browser-Use tackle real-world tasks:
-
-<table>
- <tr>
- <td width="33%" align="center">
- <a href="your_loom_link_1">
- <img src="assets/jobs-demo.png" alt="Jobs Demo" width="200"><br>
- <b>Job Applications</b>
- </a>
- <br>Apply to 5 SF tech jobs
- </td>
- <td width="33%" align="center">
- <a href="your_loom_link_2">
- <img src="assets/images-demo.png" alt="Images Demo" width="200"><br>
- <b>Multi-Tab Search</b>
- </a>
- <br>Find images across tabs
- </td>
- <td width="33%" align="center">
- <a href="your_loom_link_3">
- <img src="assets/flights-demo.png" alt="Flights Demo" width="200"><br>
- <b>Flight Search</b>
- </a>
- <br>Find cheapest flights
- </td>
- </tr>
-</table>
+<div>
+ <a href="https://www.loom.com/share/3ddba106c1fd4fd38c314881fb7d3d78">
+ <p>Library | Loom - 5 November 2024 - Watch Video</p>
+ </a>
+ <a href="https://www.loom.com/share/3ddba106c1fd4fd38c314881fb7d3d78">
+ <img style="max-width:300px;" src="https://cdn.loom.com/sessions/thumbnails/3ddba106c1fd4fd38c314881fb7d3d78-7d8bc50585272d46-full-play.gif">
+ </a>
+ </div>
+
## 🚀 Key Features
diff --git a/examples/flight_search.py b/examples/flight_search.py
index ed8110f3d..c4955d138 100644
--- a/examples/flight_search.py
+++ b/examples/flight_search.py
@@ -10,15 +10,17 @@ sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import asyncio
from langchain_anthropic import ChatAnthropic
+from langchain_openai import ChatOpenAI
from src.agent.service import AgentService
from src.controller.service import ControllerService
-task = 'Go to kayak.com and find a flight from Zürich to Tokyo on 2024-12-25 for 2 people one way.'
+task = 'Go to kayak.com and find a one-way flight from Zürich to San Francisco on 12 January 2025.'
controller = ControllerService()
-model = ChatAnthropic(
- model_name='claude-3-5-sonnet-20240620', timeout=25, stop=None, temperature=0.3
-)
+# model = ChatAnthropic(
+# model_name='claude-3-5-sonnet-20240620', timeout=25, stop=None, temperature=0.3
+# )
+model = ChatOpenAI(model='gpt-4o')
agent = AgentService(task, model, controller, use_vision=True)
diff --git a/examples/image_search.py b/examples/image_search.py
new file mode 100644
index 000000000..196a0e705
--- /dev/null
+++ b/examples/image_search.py
@@ -0,0 +1,36 @@
+import os
+import sys
+
+sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+
+import asyncio
+
+from langchain_openai import ChatOpenAI
+
+from src.agent.service import AgentService
+from src.controller.service import ControllerService
+
+people = ['Albert Einstein', 'Oprah Winfrey', 'Steve Jobs']
+task = f'Opening new tabs and searching for images for these people: {", ".join(people)}. Then ask me for further instructions.'
+controller = ControllerService(keep_open=True)
+model = ChatOpenAI(model='gpt-4o')
+agent = AgentService(task, model, controller, use_vision=True)
+
+
+async def main():
+ max_steps = 50
+ # Run the agent step by step
+ for i in range(max_steps):
+ print(f'\n📍 Step {i+1}')
+ action, result = await agent.step()
+
+ print('Action:', action)
+ print('Result:', result)
+
+ if result.done:
+ print('\n✅ Task completed successfully!')
+ print('Extracted content:', result.extracted_content)
+ break
+
+
+asyncio.run(main())
diff --git a/examples/simple_run.py b/examples/simple_run.py
index 1b675983d..05e5fb887 100644
--- a/examples/simple_run.py
+++ b/examples/simple_run.py
@@ -7,6 +7,8 @@ Simple try of the agent.
import os
import sys
+from src.controller.service import ControllerService
+
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import asyncio
@@ -17,7 +19,7 @@ from src import Agent
llm = ChatOpenAI(model='gpt-4o')
agent = Agent(
- task='Find cheapest flights on Google Flights from London to Kyrgyzstan and return the url.',
+ task='Opening new tabs to search for images of Albert Einstein, Oprah Winfrey, and Steve Jobs. Then ask user for further instructions.',
llm=llm,
)
diff --git a/src/agent/service.py b/src/agent/service.py
index 64bd9b115..f09512afa 100644
--- a/src/agent/service.py
+++ b/src/agent/service.py
@@ -106,7 +106,7 @@ class AgentService:
return action, result
async def _take_human_input(self, question: str) -> AgentOutput:
- human_input = input(f'Human input required: {question}\n\n')
+ human_input = input(f'\nHi, your input is required: {question}\n\n')
logger.info('-' * 50)
self.messages.append(HumanMessage(content=human_input))