Skip to content

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

Add lmnr package for tracing integration and update eval workflow

Magnus Müllerc66880a8faee
diff --git a/.github/workflows/eval.yaml b/.github/workflows/eval.yaml
index d581a127e..c2f22bb0c 100644
--- a/.github/workflows/eval.yaml
+++ b/.github/workflows/eval.yaml
@@ -22,6 +22,7 @@ jobs:
EVALUATION_TOOL_SECRET_KEY: ${{ secrets.EVALUATION_TOOL_SECRET_KEY }}
ANCHOR_BROWSER_API_KEY: ${{ secrets.ANCHOR_BROWSER_API_KEY }}
SERPER_API_KEY: ${{ secrets.SERPER_API_KEY }}
+ LMNR_PROJECT_API_KEY: ${{ secrets.LMNR_PROJECT_API_KEY }}
steps:
- name: Determine ref to checkout
@@ -46,7 +47,7 @@ jobs:
activate-environment: true
- name: Install dependencies
- run: uv sync
+ run: uv sync --extra eval
- name: Detect installed Playwright version
id: playwright_version
diff --git a/eval/service.py b/eval/service.py
index 84a10136a..052d599a5 100644
--- a/eval/service.py
+++ b/eval/service.py
@@ -53,6 +53,18 @@ MAX_IMAGE = 5
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
logger = logging.getLogger(__name__)
+import os
+
+try:
+ from lmnr import Laminar
+except ImportError:
+ print('⚠️ Laminar tracing not enabled: lmnr package not installed. Install with `pip install "lmnr[all]"` to enable tracing.')
+else:
+ laminar_api_key = os.getenv('LMNR_PROJECT_API_KEY')
+ if laminar_api_key:
+ print('Laminar tracing enabled')
+ Laminar.initialize(project_api_key=laminar_api_key)
+
def encode_image(image):
"""Convert a PIL image to base64 string."""
@@ -1690,6 +1702,21 @@ def save_task_result_to_server(convex_url: str, secret_key: str, result_details:
return False
+# ==============================================================================================================
+# Laminar tracing integration (auto-instrumentation for eval tool)
+import os
+
+try:
+ from lmnr import Laminar
+except ImportError:
+ print('⚠️ Laminar tracing not enabled: lmnr package not installed. Install with `pip install "lmnr[all]"` to enable tracing.')
+else:
+ laminar_api_key = os.getenv('LMNR_PROJECT_API_KEY')
+ if laminar_api_key:
+ Laminar.initialize(project_api_key=laminar_api_key)
+# ==============================================================================================================
+
+
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Run and evaluate browser automation tasks')
parser.add_argument('--parallel-runs', type=int, default=3, help='Number of parallel tasks to run')
diff --git a/pyproject.toml b/pyproject.toml
index b2785997b..968dfdcd7 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -38,6 +38,7 @@ dependencies = [
"uuid7>=0.1.0",
"patchright>=1.52.5",
"aiofiles>=24.1.0",
+ "lmnr[all]>=0.6.10",
]
# google-api-core: only used for Google LLM APIs
# pyperclip: only used for examples that use copy/paste
@@ -66,6 +67,9 @@ examples = [
"stagehand-py>=0.3.6",
"browserbase>=0.4.0",
]
+eval = [
+ "lmnr[all]>=0.6.10",
+]
all = [
"browser-use[memory,cli,examples]",
]