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
add ability to append results to existing run, so we can parallelize
Alezander9bc56c73fe79e
diff --git a/.github/workflows/eval.yaml b/.github/workflows/eval.yamlindex 042f7a21a..a08ea8709 100644--- a/.github/workflows/eval.yaml+++ b/.github/workflows/eval.yaml@@ -20,19 +20,20 @@ jobs:ANCHOR_BROWSER_API_KEY: ${{ secrets.ANCHOR_BROWSER_API_KEY }}steps:- - name: Determine branch to checkout- id: determine_branch+ - name: Determine ref to checkout+ id: determine_refrun: |- # Use the branch from client_payload or default to main- BRANCH="${{ github.event.client_payload.branch }}"- BRANCH="${BRANCH:-main}"- echo "BRANCH=$BRANCH" >> $GITHUB_OUTPUT- echo "::notice title=Branch Selection::Will checkout and run evaluation on branch: $BRANCH"+ # Use the ref from client_payload or default to main+ # This can be a branch name, tag, commit SHA, or any valid Git ref+ REF="${{ github.event.client_payload.ref }}"+ REF="${REF:-main}"+ echo "REF=$REF" >> $GITHUB_OUTPUT+ echo "::notice title=Ref Selection::Will checkout and run evaluation on ref: $REF"- name: Checkout repositoryuses: actions/checkout@v4with:- ref: ${{ steps.determine_branch.outputs.BRANCH }}+ ref: ${{ steps.determine_ref.outputs.REF }}- name: Set up Python and uvuses: astral-sh/setup-uv@v6@@ -126,6 +127,7 @@ jobs:USER_MESSAGE="${{ github.event.client_payload.script_args.user_message }}"DEVELOPER_ID="${{ github.event.client_payload.script_args.developer_id }}"PLANNER_MODEL="${{ github.event.client_payload.script_args.planner_model }}"+ RUN_ID="${{ github.event.client_payload.script_args.run_id }}"# Build command using array for cleaner constructionCMD_ARGS=(@@ -155,6 +157,7 @@ jobs:[[ -n "$USER_MESSAGE" ]] && CMD_ARGS+=("--user-message" "$USER_MESSAGE")[[ -n "$DEVELOPER_ID" ]] && CMD_ARGS+=("--developer-id" "$DEVELOPER_ID")[[ -n "$PLANNER_MODEL" ]] && CMD_ARGS+=("--planner-model" "$PLANNER_MODEL")+ [[ -n "$RUN_ID" ]] && CMD_ARGS+=("--run-id" "$RUN_ID")# Convert array to command string with proper escapingprintf -v CMD_STRING '%q ' "${CMD_ARGS[@]}"diff --git a/eval/service.py b/eval/service.pyindex bfc562e81..704847539 100644--- a/eval/service.py+++ b/eval/service.py@@ -1541,7 +1541,7 @@ def get_git_info():# Helper function to start a new run on the server-def start_new_run(convex_url: str, secret_key: str, run_details: dict):+def start_new_run(convex_url: str, secret_key: str, run_details: dict, existing_run_id: str = None):"""Sends a request to start a new evaluation run and returns the run ID."""if not convex_url or not secret_key:logger.error('Error: Convex URL or Secret Key not provided for starting run.')@@ -1553,13 +1553,18 @@ def start_new_run(convex_url: str, secret_key: str, run_details: dict):'Content-Type': 'application/json',}+ # Add existing_run_id to the payload if provided+ payload = run_details.copy()+ if existing_run_id:+ payload['runId'] = existing_run_id+logger.info(f'Sending request to start run at {endpoint_url}...')# Avoid logging secret key in run_details if it were ever passed- loggable_details = {k: v for k, v in run_details.items() if k != 'secret_key'}+ loggable_details = {k: v for k, v in payload.items() if k != 'secret_key'}logger.info(f'Run details: {json.dumps(loggable_details, indent=2)}')try:- response = requests.post(endpoint_url, headers=headers, json=run_details)+ response = requests.post(endpoint_url, headers=headers, json=payload)logger.info(f'Start Run Status Code: {response.status_code}')if response.status_code == 200:@@ -1678,6 +1683,12 @@ if __name__ == '__main__':parser.add_argument('--test-case', type=str, default='OnlineMind2Web', help='Name of the test case to fetch (default: OnlineMind2Web)')+ parser.add_argument(+ '--run-id',+ type=str,+ default=None,+ help='Existing run ID to continue adding results to (if not provided, a new run will be started)',+ )args = parser.parse_args()# Set up logging - Make sure logger is configured before use in fetch function@@ -1756,8 +1767,12 @@ if __name__ == '__main__':exit(1)# ------------------------------ # --- Start Run on Server ---- logger.info('Attempting to start a new run on the server...')+ # --- Start Run on Server (with optional existing Run ID) ---+ if args.run_id:+ logger.info(f'Initializing existing run ID: {args.run_id} with git info...')+ else:+ logger.info('Attempting to start a new run on the server...')+git_info = get_git_info()# Collect additional data from args to store with the run@@ -1786,10 +1801,10 @@ if __name__ == '__main__':'additionalData': additional_run_data,}- run_id = start_new_run(CONVEX_URL, SECRET_KEY, run_data)+ run_id = start_new_run(CONVEX_URL, SECRET_KEY, run_data, existing_run_id=args.run_id)if not run_id:- logger.error('Failed to start a new run on the server. Exiting.')+ logger.error('Failed to start/initialize run on the server. Exiting.')exit(1)logger.info(f'Successfully obtained run ID: {run_id}. Proceeding with tasks...')