Skip to content

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

small fixes and readme split

Gregor Žuničd740c13f980f
diff --git a/README.md b/README.md
index 3279bbc77..8ebefba65 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# Website Use
+# Browser Use
This repository contains an agent that can plan and execute actions on a website with or without a vision model.
@@ -16,58 +16,6 @@ pip install website-use
<!-- We plan to add more models in the future (LLama 3). -->
-# Codebase Structure
-
-> The code structure inspired by https://github.com/Netflix/dispatch.
-
-Very good structure on how to make a scalable codebase is also in [this repo](https://github.com/zhanymkanov/fastapi-best-practices).
-
-Just a brief document about how we should structure our backend codebase.
-
-## Code Structure
-
-```markdown
-src/
-/<service name>/
-models.py
-services.py
-prompts.py
-views.py
-utils.py
-routers.py
-
- /_<subservice name>/
-```
-
-### Service.py
-
-Always a single file, except if it becomes too long - more than ~500 lines, split it into \_subservices
-
-### Views.py
-
-Always split the views into two parts
-
-```python
-# All
-...
-
-# Requests
-...
-
-# Responses
-...
-```
-
-If too long → split into multiple files
-
-### Prompts.py
-
-Single file; if too long → split into multiple files (one prompt per file or so)
-
-### Routers.py
-
-Never split into more than one file
-
## Requirements
```bash
diff --git a/requirements.txt b/requirements.txt
index d01670165..503e6befc 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -10,6 +10,4 @@ pytest-asyncio==0.24.0
python-dotenv==1.0.1
requests==2.32.3
selenium==4.26.1
-tokencost==0.1.16
-webdriver-manager==4.0.2
-langfuse==2.53.5 # TODO: remove in prod
\ No newline at end of file
+webdriver-manager==4.0.2
\ No newline at end of file
diff --git a/src/README.md b/src/README.md
new file mode 100644
index 000000000..ed850d740
--- /dev/null
+++ b/src/README.md
@@ -0,0 +1,51 @@
+# Codebase Structure
+
+> The code structure inspired by https://github.com/Netflix/dispatch.
+
+Very good structure on how to make a scalable codebase is also in [this repo](https://github.com/zhanymkanov/fastapi-best-practices).
+
+Just a brief document about how we should structure our backend codebase.
+
+## Code Structure
+
+```markdown
+src/
+/<service name>/
+models.py
+services.py
+prompts.py
+views.py
+utils.py
+routers.py
+
+ /_<subservice name>/
+```
+
+### Service.py
+
+Always a single file, except if it becomes too long - more than ~500 lines, split it into \_subservices
+
+### Views.py
+
+Always split the views into two parts
+
+```python
+# All
+...
+
+# Requests
+...
+
+# Responses
+...
+```
+
+If too long → split into multiple files
+
+### Prompts.py
+
+Single file; if too long → split into multiple files (one prompt per file or so)
+
+### Routers.py
+
+Never split into more than one file
diff --git a/src/agent/prompts.py b/src/agent/prompts.py
index 4230fef81..94ee79735 100644
--- a/src/agent/prompts.py
+++ b/src/agent/prompts.py
@@ -44,7 +44,6 @@ class AgentSystemPrompt:
For the action choose EXACTLY ONE from the following list:
{self.default_action_description}
-
To interact with elements, use their index number from the input line. Write it in the click_element() or input_text() actions.
Make sure to only use indexes that are present in the list.
If you need more text from the page you can use the extract_page_content action.
diff --git a/src/agent/service.py b/src/agent/service.py
index 244743fee..b36930046 100644
--- a/src/agent/service.py
+++ b/src/agent/service.py
@@ -162,7 +162,7 @@ class AgentService:
if isinstance(message.content, list):
# Handle vision model messages
for item in message.content:
- if item['type'] == 'text':
+ if isinstance(item, dict) and item.get('type') == 'text':
f.write(item['text'].strip() + '\n')
elif isinstance(message.content, str):
try:
diff --git a/src/tests/test_search.py b/src/tests/test_search.py
index f84b32e87..24ea348f4 100644
--- a/src/tests/test_search.py
+++ b/src/tests/test_search.py
@@ -45,7 +45,7 @@ async def test_kayak_flight_search():
model = ChatAnthropic(
model_name='claude-3-5-sonnet-20240620', timeout=25, stop=None, temperature=0.3
)
- model = ChatOpenAI(model='gpt-4o', temperature=0.3)
+ # model = ChatOpenAI(model='gpt-4o', temperature=0.3)
agent = AgentService(
task,