Skip to content

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

implement pause and resume with Ctrl+C

Nick Sweeting56aae2103374
diff --git a/browser_use/agent/service.py b/browser_use/agent/service.py
index 52ee9f23a..6ccb37acc 100644
--- a/browser_use/agent/service.py
+++ b/browser_use/agent/service.py
@@ -65,6 +65,9 @@ from browser_use.utils import check_env_variables, time_execution_async, time_ex
load_dotenv()
logger = logging.getLogger(__name__)
+# Global flag to prevent duplicate exit messages
+_exiting = False
+
def log_response(response: AgentOutput) -> None:
"""Utility function to log the model's response."""