Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.
Python ai-agentsai-toolsbrowser-agentbrowser-automationbrowser-usecdpcloud-browsercomputer-useheadless-browserllmmcpplaywrightpythonremote-browserstealth-browserweb-automationweb-scraping
dont model_copy if possible
Nick Sweetingfff91453d1c0
diff --git a/browser_use/agent/service.py b/browser_use/agent/service.pyindex 83a099cc0..cd6008d33 100644--- a/browser_use/agent/service.py+++ b/browser_use/agent/service.py@@ -350,7 +350,11 @@ 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- self.browser_session = browser_session.model_copy()+ if not browser_session._owns_browser_resources:+ 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.'+ )+ self.browser_session = browser_session.model_copy()else:if browser is not None:assert isinstance(browser, Browser), 'Browser is not set up'