Skip to content

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

address cubic comments

Alezander9492753a0eb87
diff --git a/eval/browsers.py b/eval/browsers.py
index ebcecc977..5a9f4fbcf 100644
--- a/eval/browsers.py
+++ b/eval/browsers.py
@@ -67,6 +67,7 @@ def create_anchor_browser_session(headless: bool = False) -> str:
'Content-Type': 'application/json',
},
json=browser_configuration,
+ timeout=10,
)
response.raise_for_status()
session_data = response.json()['data']
diff --git a/eval/resource_monitoring.py b/eval/resource_monitoring.py
index b73d66db7..19996c57f 100644
--- a/eval/resource_monitoring.py
+++ b/eval/resource_monitoring.py
@@ -27,7 +27,7 @@ def get_system_resources() -> dict[str, Any]:
memory_available_gb = memory.available / (1024**3)
# CPU usage
- cpu_percent = psutil.cpu_percent(interval=1)
+ cpu_percent = psutil.cpu_percent(interval=None)
# Load average (Unix only)
try:
diff --git a/eval/server.py b/eval/server.py
index 42a0b43f6..0da0a8f88 100644
--- a/eval/server.py
+++ b/eval/server.py
@@ -29,7 +29,7 @@ def fetch_tasks_from_server(convex_url: str, secret_key: str, test_case_name: st
logger.info(f"Fetching test case '{test_case_name}' from {endpoint_url}...")
try:
- response = requests.post(endpoint_url, headers=headers, json=payload)
+ response = requests.post(endpoint_url, headers=headers, json=payload, timeout=10)
logger.info(f'Fetch Status Code: {response.status_code}')
@@ -79,7 +79,7 @@ def fetch_auth_distribution_from_server(convex_url: str, secret_key: str):
logger.info(f'Fetching auth distribution from {endpoint_url}...')
try:
- response = requests.post(endpoint_url, headers=headers, json={})
+ response = requests.post(endpoint_url, headers=headers, json={}, timeout=10)
logger.info(f'Fetch Auth Distribution Status Code: {response.status_code}')
@@ -183,7 +183,7 @@ def start_new_run(convex_url: str, secret_key: str, run_details: dict, existing_
logger.info(f'Run details: {json.dumps(loggable_details, indent=2)}')
try:
- response = requests.post(endpoint_url, headers=headers, json=payload)
+ response = requests.post(endpoint_url, headers=headers, json=payload, timeout=10)
logger.info(f'Start Run Status Code: {response.status_code}')
if response.status_code == 200:
@@ -237,7 +237,7 @@ def save_task_result_to_server(convex_url: str, secret_key: str, result_details:
logger.debug(f'Result details payload: {json.dumps(result_details, indent=2)}') # Log details at debug level
try:
- response = requests.post(endpoint_url, headers=headers, json=result_details)
+ response = requests.post(endpoint_url, headers=headers, json=result_details, timeout=10)
logger.info(f'Save Task Result Status Code: {response.status_code}')
diff --git a/eval/utils.py b/eval/utils.py
index 87beed480..dd709fc6a 100644
--- a/eval/utils.py
+++ b/eval/utils.py
@@ -239,7 +239,7 @@ def make_json_serializable(obj: Any) -> Any:
elif isinstance(obj, (str, int, float, bool)):
return obj
elif isinstance(obj, dict):
- return {k: make_json_serializable(v) for k, v in obj.items()}
+ return {str(k): make_json_serializable(v) for k, v in obj.items()}
elif isinstance(obj, (list, tuple)):
return [make_json_serializable(item) for item in obj]
elif hasattr(obj, 'value'): # Handle enums