Skip to content

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

whoops

Nick Sweeting4bbae404ca02
diff --git a/browser_use/agent/service.py b/browser_use/agent/service.py
index 888450f31..3b9e87881 100644
--- a/browser_use/agent/service.py
+++ b/browser_use/agent/service.py
@@ -350,7 +350,9 @@ class Agent(Generic[Context]):
# Always copy sessions that are passed in to avoid agents overwriting each other's agent_current_page and human_current_page by accident
# The model_copy() method now handles copying all necessary fields and setting up ownership
- if not browser_session._owns_browser_resources:
+ if browser_session._owns_browser_resources:
+ self.browser_session = browser_session
+ else:
self.logger.warning(
'⚠️ Attempting to use multiple Agents with the same BrowserSession! This is not supported yet and will likely lead to strange behavior, use separate BrowserSessions for each Agent.'
)