Skip to content

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

Track the source with an parameter

Magnus Müllerdb29a1c9d53b
diff --git a/browser_use/agent/service.py b/browser_use/agent/service.py
index 334d2c6a5..c4311388b 100644
--- a/browser_use/agent/service.py
+++ b/browser_use/agent/service.py
@@ -153,6 +153,7 @@ class Agent(Generic[Context]):
save_playwright_script_path: Optional[str] = None,
enable_memory: bool = True,
memory_config: Optional[MemoryConfig] = None,
+ source: Optional[str] = None,
):
if page_extraction_llm is None:
page_extraction_llm = llm
@@ -336,7 +337,8 @@ class Agent(Generic[Context]):
except Exception:
version = 'unknown'
source = 'unknown'
-
+ if self.source is not None:
+ source = self.source
logger.debug(f'Version: {version}, Source: {source}')
self.version = version
self.source = source
diff --git a/eval/service.py b/eval/service.py
index 3b4c48483..207ad846e 100644
--- a/eval/service.py
+++ b/eval/service.py
@@ -544,7 +544,13 @@ async def run_agent_with_tracing(
browser = browser or Browser()
- agent = Agent(task=task.confirmed_task, llm=llm, browser=browser, use_vision=use_vision)
+ agent = Agent(
+ task=task.confirmed_task,
+ llm=llm,
+ browser=browser,
+ use_vision=use_vision,
+ source='eval_platform', # Override source detection
+ )
# Pass our hook functions
result = await agent.run(max_steps=max_steps, on_step_start=tracker.on_step_start, on_step_end=tracker.on_step_end)