Skip to content

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

Wrap task into """

magmueller570d4cd99174
diff --git a/browser_use/agent/message_manager/service.py b/browser_use/agent/message_manager/service.py
index 71ddf52cb..211629a58 100644
--- a/browser_use/agent/message_manager/service.py
+++ b/browser_use/agent/message_manager/service.py
@@ -105,13 +105,11 @@ class MessageManager:
@staticmethod
def task_instructions(task: str) -> HumanMessage:
- content = f'Your ultimate task is: {task}. If you achieved your ultimate task, stop everything and use the done action in the next step to complete the task. If not, continue as usual.'
+ content = f'Your ultimate task is: """{task}""". If you achieved your ultimate task, stop everything and use the done action in the next step to complete the task. If not, continue as usual.'
return HumanMessage(content=content)
def add_new_task(self, new_task: str) -> None:
- content = (
- f'Your new ultimate task is: {new_task}. Take the previous context into account and finish your new ultimate task. '
- )
+ content = f'Your new ultimate task is: """{new_task}""". Take the previous context into account and finish your new ultimate task. '
msg = HumanMessage(content=content)
self._add_message_with_tokens(msg)