Skip to content

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

Refine last step warning message for agent service

Magnus Müller17fcfe2559bd
diff --git a/browser_use/agent/service.py b/browser_use/agent/service.py
index a9669957c..262d19b7c 100644
--- a/browser_use/agent/service.py
+++ b/browser_use/agent/service.py
@@ -342,8 +342,8 @@ class Agent(Generic[Context]):
if step_info and step_info.is_last_step():
# Add last step warning if needed
- msg = 'Now comes your last step. Use only the "done" function now.'
- msg += '\nIf the task is not fully finished as requested by the user, set success in "done" to false!'
+ msg = 'Now comes your last step. Use only the "done" action now. No other actions - so here your action sequence musst have length 1.'
+ msg += '\nIf the task is not yet fully finished as requested by the user, set success in "done" to false!'
msg += '\nIf the task is fully finished, set success in "done" to true.'
msg += '\nInclude everything you found out for the ultimate task in the done text.'
logger.info('Last step finishing up')