Skip to content

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

run pre-commit run --all-files

dha-aae20817d0052a
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index 358973243..837e4044a 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -12,4 +12,4 @@ jobs:
- run: uv run ruff check --no-fix --select PLE
- run: uv run ruff format
- run: uv run pre-commit run --all-files
- - run: uv run pyright
\ No newline at end of file
+ - run: uv run pyright
diff --git a/browser_use/agent/message_manager/service.py b/browser_use/agent/message_manager/service.py
index 085adc6c3..fcd5125ad 100644
--- a/browser_use/agent/message_manager/service.py
+++ b/browser_use/agent/message_manager/service.py
@@ -72,34 +72,36 @@ class MessageManager:
example_tool_call = AIMessage(
content='',
- tool_calls=[{
- 'name': 'AgentOutput',
- 'args': {
- 'current_state': {
- 'evaluation_previous_goal': """
+ tool_calls=[
+ {
+ 'name': 'AgentOutput',
+ 'args': {
+ 'current_state': {
+ 'evaluation_previous_goal': """
Success - I successfully clicked on the 'Apple' link from the Google Search results page,
which directed me to the 'Apple' company homepage. This is a good start toward finding
the best place to buy a new iPhone as the Apple website often list iPhones for sale.
""".strip(),
- 'memory': """
+ 'memory': """
I searched for 'iPhone retailers' on Google. From the Google Search results page,
I used the 'click_element' tool to click on a element labelled 'Best Buy' but calling
the tool did not direct me to a new page. I then used the 'click_element' tool to click
on a element labelled 'Apple' which redirected me to the 'Apple' company homepage.
Currently at step 3/15.
""".strip(),
- 'next_goal': """
+ 'next_goal': """
Looking at reported structure of the current page, I can see the item '[127]<h3 iPhone/>'
in the content. I think this button will lead to more information and potentially prices
for iPhones. I'll click on the link to 'iPhone' at index [127] using the 'click_element'
tool and hope to see prices on the next page.
""".strip(),
+ },
+ 'action': [{'click_element': {'index': 127}}],
},
- 'action': [{'click_element': {'index': 127}}],
+ 'id': str(self.state.tool_id),
+ 'type': 'tool_call',
},
- 'id': str(self.state.tool_id),
- 'type': 'tool_call',
- },]
+ ],
)
self._add_message_with_tokens(example_tool_call, message_type='init')
self.add_tool_message(content='Browser started', message_type='init')
diff --git a/examples/models/deepseek.py b/examples/models/deepseek.py
index 072c0a192..eef76c131 100644
--- a/examples/models/deepseek.py
+++ b/examples/models/deepseek.py
@@ -35,4 +35,4 @@ async def run_search():
if __name__ == '__main__':
- asyncio.run(run_search())
\ No newline at end of file
+ asyncio.run(run_search())
diff --git a/examples/use-cases/web_voyager_agent.py b/examples/use-cases/web_voyager_agent.py
index f57638211..ad06a4b66 100644
--- a/examples/use-cases/web_voyager_agent.py
+++ b/examples/use-cases/web_voyager_agent.py
@@ -58,6 +58,7 @@ TASK = """
Find and book a hotel in Paris with suitable accommodations for a family of four (two adults and two children) offering free cancellation for the dates of February 14-21, 2025. on https://www.booking.com/
"""
+
async def main():
agent = Agent(
task=TASK,