Skip to content

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

Improved prompt currently it mixes origin / destination sometimes

magmueller308971898120
diff --git a/src/agent/prompts.py b/src/agent/prompts.py
index 986bab1a7..612b81682 100644
--- a/src/agent/prompts.py
+++ b/src/agent/prompts.py
@@ -38,14 +38,14 @@ class AgentSystemPrompt:
Respond with a valid JSON object, containing 2 keys: current_state and action.
In current_state there are 3 keys:
- valuation_previous_goal: Evaluate if the previous goal was achieved or what went wrong so that you know in the future what to change.
+ valuation_previous_goal: Evaluate if the previous goal was achieved or what went wrong. E.g. Failed because ...
memory: This you can use as a memory to store where you are in your overall task. E.g. if you need to find 10 jobs, you can store the already found jobs here.
- next_goal: Description of the next goal you want to achieve e.g. which elements to click.
+ next_goal: The next goal you want to achieve e.g. clicking on ... button to ...
- In action choose EXACTLY ONE from the following list:
+ For the action choose EXACTLY ONE from the following list:
{self.default_action_description}
- To interact with elements, use their index number in the click_element() or input_text() actions.
+ 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/browser/service.py b/src/browser/service.py
index b8fc5a73c..7f2f38fb2 100644
--- a/src/browser/service.py
+++ b/src/browser/service.py
@@ -49,7 +49,8 @@ class BrowserService:
chrome_options.add_experimental_option('useAutomationExtension', False)
# Additional stealth settings
- chrome_options.add_argument('--window-size=1024,1024')
+ chrome_options.add_argument('--start-maximized')
+ # chrome_options.add_argument('--window-size=1024,1024')
chrome_options.add_argument('--disable-extensions')
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--disable-infobars')
@@ -120,7 +121,7 @@ class BrowserService:
remaining = max(self.MINIMUM_WAIT_TIME - elapsed, 0)
print(
- f'Page loaded in {elapsed:.2f} seconds, waiting for additional {remaining:.2f} seconds'
+ f'--Page loaded in {elapsed:.2f} seconds, waiting for additional {remaining:.2f} seconds'
)
# Sleep remaining time if needed
@@ -311,7 +312,7 @@ class BrowserService:
except Exception as e:
raise Exception(f'Failed to click element with xpath: {xpath}. Error: {str(e)}')
- @time_execution_sync('click')
+ @time_execution_sync('--click')
def click_element_by_index(self, index: int, state: BrowserState):
"""
Clicks an element using its index from the selector map.
diff --git a/src/controller/views.py b/src/controller/views.py
index 2d5ceb9c5..5f9425530 100644
--- a/src/controller/views.py
+++ b/src/controller/views.py
@@ -48,14 +48,14 @@ class ControllerActions(BaseModel):
return """
- Search Google with a query
Example: {"search_google": {"query": "weather today"}}
-- Navigate directly to a URL
+- Navigate directly to a URL where you want to go
Example: {"go_to_url": {"url": "https://abc.com"}}
- Do nothing/wait
Example: {"nothing": true}
- Go back to previous page
Example: {"go_back": true}
- Mark entire task as complete
- Example: {"done": {"text": "This is the requested result of the task..."}}
+ Example: {"done": {"text": "This is the requested result of the task which is send to the human..."}}
- Click an interactive element by its given ID
Example: {"click_element": {"id": 1}}
- Input text into an interactiveelement by its ID