Skip to content

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

Enhance CI workflow by adding agent tasks evaluation step and updating evaluate_tasks.py to output evaluation results

Magnus Müller576519ee4054
diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml
index c935ed8bc..53db34cd9 100644
--- a/.github/workflows/test.yaml
+++ b/.github/workflows/test.yaml
@@ -85,5 +85,44 @@ jobs:
- run: pytest --numprocesses auto -x tests/ci/${{ matrix.test_filename }}.py
- - name: Run agent tasks evaluation
- run: python tests/ci/evaluate_tasks.py
+ evaluate-tasks:
+ needs: tests
+ runs-on: ubuntu-latest
+ env:
+ OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
+ PERPLEXITY_API_KEY: ${{ secrets.PERPLEXITY_API_KEY }}
+ ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
+ GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
+ GROQ_API_KEY: ${{ secrets.GROQ_API_KEY }}
+ steps:
+ - uses: actions/checkout@v4
+ - uses: astral-sh/setup-uv@v6
+ with:
+ enable-cache: true
+ activate-environment: true
+
+ - run: uv sync --dev
+
+ - name: Detect installed Playwright version
+ run: echo "PLAYWRIGHT_VERSION=$(uv pip list --format json | jq -r '.[] | select(.name == "playwright") | .version')" >> $GITHUB_ENV
+
+ - name: Cache playwright binaries
+ uses: actions/cache@v3
+ with:
+ path: |
+ ~/.cache/ms-playwright
+ key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}
+
+ - run: playwright install chromium
+
+ - name: Run agent tasks evaluation and capture score
+ id: eval
+ run: |
+ python tests/ci/evaluate_tasks.py > result.txt
+ 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
+
+ - name: Print agent evaluation summary
+ run: |
+ echo "Agent tasks passed: $PASSED / $TOTAL"
diff --git a/tests/ci/evaluate_tasks.py b/tests/ci/evaluate_tasks.py
index 92fa856bd..69bdfd8c4 100644
--- a/tests/ci/evaluate_tasks.py
+++ b/tests/ci/evaluate_tasks.py
@@ -109,4 +109,6 @@ async def main():
if __name__ == '__main__':
- asyncio.run(main())
+ passed, total = asyncio.run(main())
+ print(f'PASSED={passed}')
+ print(f'TOTAL={total}')