Skip to content

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

Enhance agent stopping behavior

Magnus Müllerc7313d39e768
diff --git a/browser_use/agent/service.py b/browser_use/agent/service.py
index c9e130c73..c5c867a87 100644
--- a/browser_use/agent/service.py
+++ b/browser_use/agent/service.py
@@ -1938,6 +1938,9 @@ class Agent(Generic[Context, AgentStructuredOutput]):
"""Stop the agent"""
self.logger.info('⏹️ Agent stopping')
self.state.stopped = True
+
+ # Signal pause event to unblock any waiting code so it can check the stopped state
+ self._external_pause_event.set()
# Task stopped
diff --git a/examples/file_system/file_system/fs/browseruse_agent_data/todo.md b/examples/file_system/file_system/fs/browseruse_agent_data/todo.md
deleted file mode 100644
index e69de29bb..000000000