Skip to content

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

Enhance GitHub Actions workflow and evaluate_tasks.py to include detailed task evaluation results. The workflow now captures and displays detailed results in a structured format, while the Python script outputs detailed results as JSON for better integration with GitHub Actions. This improves visibility and understanding of task outcomes in the evaluation process.

Magnus Müllereaab9f04d7ed
diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml
index 8dc4209c2..ee0c7e4dd 100644
--- a/.github/workflows/test.yaml
+++ b/.github/workflows/test.yaml
@@ -123,6 +123,7 @@ jobs:
cat result.txt
echo "PASSED=$(grep '^PASSED=' result.txt | cut -d= -f2)" >> $GITHUB_ENV
echo "TOTAL=$(grep '^TOTAL=' result.txt | cut -d= -f2)" >> $GITHUB_ENV
+ echo "DETAILED_RESULTS=$(grep '^DETAILED_RESULTS=' result.txt | cut -d= -f2-)" >> $GITHUB_ENV
- name: Print agent evaluation summary
run: |
@@ -142,33 +143,30 @@ jobs:
uses: actions/github-script@v7
with:
script: |
- const passed = process.env.PASSED;
- const total = process.env.TOTAL;
+ const passed = parseInt(process.env.PASSED);
+ const total = parseInt(process.env.TOTAL);
+ const detailedResults = JSON.parse(process.env.DETAILED_RESULTS);
const score = `${passed}/${total}`;
const percentage = Math.round((passed / total) * 100);
- let emoji, status;
- if (passed == total) {
- emoji = '✅';
- status = 'All tasks passed!';
- } else if (passed > total * 0.1) {
- emoji = '⚠️';
- status = 'Some tasks failed (Some might be very hard)';
- } else {
- emoji = '❌';
- status = 'Most tasks failed';
- }
-
- const comment = `## ${emoji} Agent Task Evaluation Results
-
- **Score: ${score} (${percentage}%)**
+ // Create detailed table
+ let tableRows = '';
+ detailedResults.forEach(result => {
+ const emoji = result.success ? '✅' : '❌';
+ const status = result.success ? 'Pass' : 'Fail';
+ tableRows += `| ${result.task} | ${emoji} ${status} | ${result.reason} |\n`;
+ });
- ${status}
+ const comment = `## Agent Task Evaluation Results: ${score} (${percentage}%)
<details>
- <summary>View detailed results in the Actions tab</summary>
+ <summary>View detailed results</summary>
+
+ | Task | Result | Reason |
+ |------|--------|--------|
+ ${tableRows}
- Check the [evaluate-tasks job](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for detailed task execution logs and failure reasons.
+ Check the [evaluate-tasks job](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for detailed task execution logs.
</details>`;
// Find existing comment to update or create new one
diff --git a/tests/ci/evaluate_tasks.py b/tests/ci/evaluate_tasks.py
index abcebb183..adc26d3c7 100644
--- a/tests/ci/evaluate_tasks.py
+++ b/tests/ci/evaluate_tasks.py
@@ -287,6 +287,17 @@ async def main():
print(f'\n{"*" * 10} {passed}/{total} PASSED {"*" * 10}\n')
print('=' * 60 + '\n')
+ # Output results for GitHub Actions
+ print(f'PASSED={passed}')
+ print(f'TOTAL={total}')
+
+ # Output detailed results as JSON for GitHub Actions
+ detailed_results = []
+ for r in results:
+ detailed_results.append({'task': r['file'].replace('.yaml', ''), 'success': r['success'], 'reason': r['explanation']})
+
+ print('DETAILED_RESULTS=' + json.dumps(detailed_results))
+
return passed, total
@@ -312,5 +323,4 @@ if __name__ == '__main__':
else:
# Parent process mode: run all tasks in parallel subprocesses
passed, total = asyncio.run(main())
- print(f'PASSED={passed}')
- print(f'TOTAL={total}')
+ # Results already printed by main() function