-
Notifications
You must be signed in to change notification settings - Fork 1.7k
902 lines (788 loc) · 33.3 KB
/
Copy pathci.yml
File metadata and controls
902 lines (788 loc) · 33.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
name: Evals
on:
pull_request:
types:
- opened
- synchronize
- labeled
- unlabeled
paths-ignore:
- "packages/docs/**"
env:
EVAL_MODELS: "openai/gpt-4.1,google/gemini-2.0-flash,anthropic/claude-haiku-4-5"
EVAL_CATEGORIES: "observe,act,combination,extract,targeted_extract,agent"
EVAL_MAX_CONCURRENCY: 25
EVAL_TRIAL_COUNT: 3
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs:
determine-changes:
runs-on: ubuntu-latest
outputs:
core: ${{ steps.filter.outputs.core }}
evals: ${{ steps.filter.outputs.evals }}
docs-only: ${{ steps.filter.outputs.docs-only }}
steps:
- name: Check out repository code
uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
core:
- '.github/workflows/ci.yml'
- 'packages/core/**'
- 'package.json'
- 'pnpm-lock.yaml'
- 'turbo.json'
evals:
- 'packages/evals/**'
- 'package.json'
- 'pnpm-lock.yaml'
docs-only:
- '**/*.md'
- 'examples/**'
- '!packages/**/*.md'
determine-evals:
needs: [determine-changes]
runs-on: ubuntu-latest
outputs:
skip-all-evals: ${{ steps.check-labels.outputs.skip-all-evals }}
run-regression: ${{ steps.check-labels.outputs.run-regression }}
run-combination: ${{ steps.check-labels.outputs.run-combination }}
run-extract: ${{ steps.check-labels.outputs.run-extract }}
run-act: ${{ steps.check-labels.outputs.run-act }}
run-observe: ${{ steps.check-labels.outputs.run-observe }}
run-targeted-extract: ${{ steps.check-labels.outputs.run-targeted-extract }}
run-agent: ${{ steps.check-labels.outputs.run-agent }}
steps:
- id: check-labels
run: |
# Check if skip-evals label is present
if [[ "${{ contains(github.event.pull_request.labels.*.name, 'skip-evals') }}" == "true" ]]; then
echo "skip-evals label found - skipping all evals"
echo "skip-all-evals=true" >> $GITHUB_OUTPUT
echo "run-regression=false" >> $GITHUB_OUTPUT
echo "run-combination=false" >> $GITHUB_OUTPUT
echo "run-extract=false" >> $GITHUB_OUTPUT
echo "run-act=false" >> $GITHUB_OUTPUT
echo "run-observe=false" >> $GITHUB_OUTPUT
echo "run-targeted-extract=false" >> $GITHUB_OUTPUT
echo "run-agent=false" >> $GITHUB_OUTPUT
exit 0
fi
# Skip evals if only docs/examples changed (and not on main)
if [[ "${{ needs.determine-changes.outputs.docs-only }}" == "true" && "${{ needs.determine-changes.outputs.core }}" == "false" && "${{ needs.determine-changes.outputs.evals }}" == "false" && "${{ github.ref }}" != "refs/heads/main" ]]; then
echo "Only docs/examples changed - skipping evals"
echo "skip-all-evals=true" >> $GITHUB_OUTPUT
echo "run-regression=false" >> $GITHUB_OUTPUT
echo "run-combination=false" >> $GITHUB_OUTPUT
echo "run-extract=false" >> $GITHUB_OUTPUT
echo "run-act=false" >> $GITHUB_OUTPUT
echo "run-observe=false" >> $GITHUB_OUTPUT
echo "run-targeted-extract=false" >> $GITHUB_OUTPUT
echo "run-agent=false" >> $GITHUB_OUTPUT
exit 0
fi
# Default to running all tests on main branch
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
echo "Running all tests for main branch"
echo "skip-all-evals=false" >> $GITHUB_OUTPUT
echo "run-regression=true" >> $GITHUB_OUTPUT
echo "run-combination=true" >> $GITHUB_OUTPUT
echo "run-extract=true" >> $GITHUB_OUTPUT
echo "run-act=true" >> $GITHUB_OUTPUT
echo "run-observe=true" >> $GITHUB_OUTPUT
echo "run-targeted-extract=true" >> $GITHUB_OUTPUT
echo "run-agent=true" >> $GITHUB_OUTPUT
exit 0
fi
# Check for skip-regression-evals label
if [[ "${{ contains(github.event.pull_request.labels.*.name, 'skip-regression-evals') }}" == "true" ]]; then
echo "skip-regression-evals label found - regression evals will be skipped"
echo "run-regression=false" >> $GITHUB_OUTPUT
else
echo "Regression evals will run by default"
echo "run-regression=true" >> $GITHUB_OUTPUT
fi
# Check for specific labels
echo "skip-all-evals=false" >> $GITHUB_OUTPUT
echo "run-combination=${{ contains(github.event.pull_request.labels.*.name, 'combination') }}" >> $GITHUB_OUTPUT
echo "run-extract=${{ contains(github.event.pull_request.labels.*.name, 'extract') }}" >> $GITHUB_OUTPUT
echo "run-act=${{ contains(github.event.pull_request.labels.*.name, 'act') }}" >> $GITHUB_OUTPUT
echo "run-observe=${{ contains(github.event.pull_request.labels.*.name, 'observe') }}" >> $GITHUB_OUTPUT
echo "run-targeted-extract=${{ contains(github.event.pull_request.labels.*.name, 'targeted-extract') }}" >> $GITHUB_OUTPUT
echo "run-agent=${{ contains(github.event.pull_request.labels.*.name, 'agent') }}" >> $GITHUB_OUTPUT
run-lint:
needs: [determine-changes]
if: needs.determine-changes.outputs.core == 'true' || needs.determine-changes.outputs.evals == 'true'
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Enable Corepack
run: |
npm install -g corepack@latest
corepack enable
- name: Get pnpm store directory
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-${{ runner.arch }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-pnpm-store-
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run Lint
run: pnpm run lint
run-build:
needs: [determine-changes]
if: needs.determine-changes.outputs.core == 'true' || needs.determine-changes.outputs.evals == 'true'
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Enable Corepack
run: |
npm install -g corepack@latest
corepack enable
- name: Get pnpm store directory
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-${{ runner.arch }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-pnpm-store-
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run Build
run: pnpm run build
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: |
packages/core/dist/**
packages/core/lib/**
retention-days: 1
- name: Run Vitest
run: pnpm --filter @browserbasehq/stagehand run test:vitest
run-e2e-local-tests:
needs: [run-lint, run-build]
runs-on: ubuntu-latest
timeout-minutes: 50
if: >
github.event_name == 'push' ||
(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository)
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
GOOGLE_GENERATIVE_AI_API_KEY: ${{ secrets.GOOGLE_GENERATIVE_AI_API_KEY }}
BROWSERBASE_API_KEY: ${{ secrets.BROWSERBASE_API_KEY }}
BROWSERBASE_PROJECT_ID: ${{ secrets.BROWSERBASE_PROJECT_ID }}
HEADLESS: true
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Enable Corepack
run: |
npm install -g corepack@latest
corepack enable
- name: Get pnpm store directory
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-${{ runner.arch }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-pnpm-store-
- name: Install stable Chromium
run: |
set -euo pipefail
CHROME_VERSION=$(curl -s https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions.json | jq -r '.channels.Stable.version')
DOWNLOAD_URL="https://storage.googleapis.com/chrome-for-testing-public/${CHROME_VERSION}/linux64/chrome-linux64.zip"
INSTALL_DIR="${RUNNER_TEMP}/chrome-stable"
mkdir -p "$INSTALL_DIR"
curl -sSL "$DOWNLOAD_URL" -o "$INSTALL_DIR/chrome-linux64.zip"
unzip -q "$INSTALL_DIR/chrome-linux64.zip" -d "$INSTALL_DIR"
CHROME_BIN="$INSTALL_DIR/chrome-linux64/chrome"
chmod +x "$CHROME_BIN"
echo "Installed Chromium version: $CHROME_VERSION"
"$CHROME_BIN" --version
echo "CHROME_PATH=$CHROME_BIN" >> $GITHUB_ENV
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build Stagehand
run: pnpm run build
- name: Run local E2E Tests (Deterministic Playwright)
run: pnpm run e2e:local --log-order=stream
run-e2e-bb-tests:
needs: [run-lint, run-build]
runs-on: ubuntu-latest
timeout-minutes: 50
if: >
github.event_name == 'push' ||
(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository)
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
GOOGLE_GENERATIVE_AI_API_KEY: ${{ secrets.GOOGLE_GENERATIVE_AI_API_KEY }}
BROWSERBASE_API_KEY: ${{ secrets.BROWSERBASE_API_KEY }}
BROWSERBASE_PROJECT_ID: ${{ secrets.BROWSERBASE_PROJECT_ID }}
HEADLESS: true
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Enable Corepack
run: |
npm install -g corepack@latest
corepack enable
- name: Get pnpm store directory
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-${{ runner.arch }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-pnpm-store-
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build Stagehand
run: pnpm run build
- name: Run E2E Tests (browserbase)
run: pnpm run e2e:bb --log-order=stream
run-regression-evals:
needs:
[run-e2e-bb-tests, run-e2e-local-tests, run-build, determine-evals]
if: needs.determine-evals.outputs.skip-all-evals != 'true' && needs.determine-evals.outputs.run-regression == 'true'
runs-on: ubuntu-latest
timeout-minutes: 9
outputs:
regression_score: ${{ steps.set-regression-score.outputs.regression_score }}
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
GOOGLE_GENERATIVE_AI_API_KEY: ${{ secrets.GOOGLE_GENERATIVE_AI_API_KEY }}
BRAINTRUST_API_KEY: ${{ secrets.BRAINTRUST_API_KEY }}
BROWSERBASE_API_KEY: ${{ secrets.BROWSERBASE_API_KEY }}
BROWSERBASE_PROJECT_ID: ${{ secrets.BROWSERBASE_PROJECT_ID }}
HEADLESS: true
EVAL_ENV: browserbase
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Enable Corepack
run: |
npm install -g corepack@latest
corepack enable
- name: Get pnpm store directory
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-${{ runner.arch }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-pnpm-store-
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: build-artifacts
- name: Run Regression Evals
run: pnpm run evals category regression trials=2 concurrency=20 env=BROWSERBASE
- name: Log Regression Evals Performance
run: |
experimentName=$(jq -r '.experimentName' eval-summary.json)
echo "View results at https://www.braintrust.dev/app/Browserbase/p/stagehand/experiments/${experimentName}"
if [ -f eval-summary.json ]; then
regression_score=$(jq '.categories.regression' eval-summary.json)
echo "Regression category score: $regression_score%"
if (( $(echo "$regression_score < 90" | bc -l) )); then
echo "Regression category score is below 90%. Failing CI."
exit 1
fi
else
echo "Eval summary not found for regression category. Failing CI."
exit 1
fi
run-combination-evals:
needs: [run-regression-evals, run-build, determine-evals]
runs-on: ubuntu-latest
timeout-minutes: 40
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
GOOGLE_GENERATIVE_AI_API_KEY: ${{ secrets.GOOGLE_GENERATIVE_AI_API_KEY }}
BRAINTRUST_API_KEY: ${{ secrets.BRAINTRUST_API_KEY }}
BROWSERBASE_API_KEY: ${{ secrets.BROWSERBASE_API_KEY }}
BROWSERBASE_PROJECT_ID: ${{ secrets.BROWSERBASE_PROJECT_ID }}
HEADLESS: true
EVAL_ENV: browserbase
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Check for 'combination' label
id: label-check
run: |
if [ "${{ needs.determine-evals.outputs.run-combination }}" != "true" ]; then
echo "has_label=false" >> $GITHUB_OUTPUT
echo "No label for COMBINATION. Exiting with success."
else
echo "has_label=true" >> $GITHUB_OUTPUT
fi
- name: Set up Node.js
if: needs.determine-evals.outputs.run-combination == 'true'
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Enable Corepack
if: needs.determine-evals.outputs.run-combination == 'true'
run: |
npm install -g corepack@latest
corepack enable
- name: Get pnpm store directory
if: needs.determine-evals.outputs.run-combination == 'true'
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
if: needs.determine-evals.outputs.run-combination == 'true'
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-${{ runner.arch }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-pnpm-store-
- name: Install dependencies
if: needs.determine-evals.outputs.run-combination == 'true'
run: pnpm install --frozen-lockfile
- name: Download build artifacts
if: needs.determine-evals.outputs.run-combination == 'true'
uses: actions/download-artifact@v4
with:
name: build-artifacts
- name: Run Combination Evals
if: needs.determine-evals.outputs.run-combination == 'true'
run: pnpm run evals category combination
- name: Log Combination Evals Performance
if: needs.determine-evals.outputs.run-combination == 'true'
run: |
experimentName=$(jq -r '.experimentName' eval-summary.json)
echo "View results at https://www.braintrust.dev/app/Browserbase/p/stagehand/experiments/${experimentName}"
if [ -f eval-summary.json ]; then
combination_score=$(jq '.categories.combination' eval-summary.json)
echo "Combination category score: $combination_score%"
exit 0
else
echo "Eval summary not found for combination category. Failing CI."
exit 1
fi
run-act-evals:
needs: [run-regression-evals, run-build, determine-evals]
runs-on: ubuntu-latest
timeout-minutes: 25
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
GOOGLE_GENERATIVE_AI_API_KEY: ${{ secrets.GOOGLE_GENERATIVE_AI_API_KEY }}
BRAINTRUST_API_KEY: ${{ secrets.BRAINTRUST_API_KEY }}
BROWSERBASE_API_KEY: ${{ secrets.BROWSERBASE_API_KEY }}
BROWSERBASE_PROJECT_ID: ${{ secrets.BROWSERBASE_PROJECT_ID }}
HEADLESS: true
EVAL_ENV: browserbase
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Check for 'act' label
id: label-check
run: |
if [ "${{ needs.determine-evals.outputs.run-act }}" != "true" ]; then
echo "has_label=false" >> $GITHUB_OUTPUT
echo "No label for ACT. Exiting with success."
else
echo "has_label=true" >> $GITHUB_OUTPUT
fi
- name: Set up Node.js
if: needs.determine-evals.outputs.run-act == 'true'
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Enable Corepack
if: needs.determine-evals.outputs.run-act == 'true'
run: |
npm install -g corepack@latest
corepack enable
- name: Get pnpm store directory
if: needs.determine-evals.outputs.run-act == 'true'
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
if: needs.determine-evals.outputs.run-act == 'true'
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-${{ runner.arch }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-pnpm-store-
- name: Install dependencies
if: needs.determine-evals.outputs.run-act == 'true'
run: pnpm install --frozen-lockfile
- name: Download build artifacts
if: needs.determine-evals.outputs.run-act == 'true'
uses: actions/download-artifact@v4
with:
name: build-artifacts
- name: Run Act Evals
if: needs.determine-evals.outputs.run-act == 'true'
run: pnpm run evals category act
- name: Log Act Evals Performance
if: needs.determine-evals.outputs.run-act == 'true'
run: |
experimentName=$(jq -r '.experimentName' eval-summary.json)
echo "View results at https://www.braintrust.dev/app/Browserbase/p/stagehand/experiments/${experimentName}"
if [ -f eval-summary.json ]; then
act_score=$(jq '.categories.act' eval-summary.json)
echo "Act category score: $act_score%"
if (( $(echo "$act_score < 80" | bc -l) )); then
echo "Act category score is below 80%. Failing CI."
exit 1
fi
else
echo "Eval summary not found for act category. Failing CI."
exit 1
fi
run-extract-evals:
needs: [run-regression-evals, run-build, determine-evals]
runs-on: ubuntu-latest
timeout-minutes: 50
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
GOOGLE_GENERATIVE_AI_API_KEY: ${{ secrets.GOOGLE_GENERATIVE_AI_API_KEY }}
BRAINTRUST_API_KEY: ${{ secrets.BRAINTRUST_API_KEY }}
BROWSERBASE_API_KEY: ${{ secrets.BROWSERBASE_API_KEY }}
BROWSERBASE_PROJECT_ID: ${{ secrets.BROWSERBASE_PROJECT_ID }}
HEADLESS: true
EVAL_ENV: browserbase
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Check for 'extract' label
id: label-check
run: |
if [ "${{ needs.determine-evals.outputs.run-extract }}" != "true" ]; then
echo "has_label=false" >> $GITHUB_OUTPUT
echo "No label for EXTRACT. Exiting with success."
else
echo "has_label=true" >> $GITHUB_OUTPUT
fi
- name: Set up Node.js
if: needs.determine-evals.outputs.run-extract == 'true'
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Enable Corepack
if: needs.determine-evals.outputs.run-extract == 'true'
run: |
npm install -g corepack@latest
corepack enable
- name: Get pnpm store directory
if: needs.determine-evals.outputs.run-extract == 'true'
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
if: needs.determine-evals.outputs.run-extract == 'true'
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-${{ runner.arch }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-pnpm-store-
- name: Install dependencies
if: needs.determine-evals.outputs.run-extract == 'true'
run: pnpm install --frozen-lockfile
- name: Download build artifacts
if: needs.determine-evals.outputs.run-extract == 'true'
uses: actions/download-artifact@v4
with:
name: build-artifacts
# 1. Run extract category with domExtract
- name: Run Extract Evals (domExtract)
if: needs.determine-evals.outputs.run-extract == 'true'
run: pnpm run evals category extract -- --extract-method=domExtract
- name: Save Extract Dom Results
if: needs.determine-evals.outputs.run-extract == 'true'
run: mv eval-summary.json eval-summary-extract-dom.json
# 2. Log and Compare Extract Evals Performance
- name: Log and Compare Extract Evals Performance
if: needs.determine-evals.outputs.run-extract == 'true'
run: |
experimentNameDom=$(jq -r '.experimentName' eval-summary-extract-dom.json)
dom_score=$(jq '.categories.extract' eval-summary-extract-dom.json)
echo "DomExtract Extract category score: $dom_score%"
echo "View domExtract results: https://www.braintrust.dev/app/Browserbase/p/stagehand/experiments/${experimentNameDom}"
# If domExtract <80% fail CI
if (( $(echo "$dom_score < 80" | bc -l) )); then
echo "DomExtract extract category score is below 80%. Failing CI."
exit 1
fi
run-observe-evals:
needs: [run-regression-evals, run-build, determine-evals]
runs-on: ubuntu-latest
timeout-minutes: 60
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
GOOGLE_GENERATIVE_AI_API_KEY: ${{ secrets.GOOGLE_GENERATIVE_AI_API_KEY }}
BRAINTRUST_API_KEY: ${{ secrets.BRAINTRUST_API_KEY }}
BROWSERBASE_API_KEY: ${{ secrets.BROWSERBASE_API_KEY }}
BROWSERBASE_PROJECT_ID: ${{ secrets.BROWSERBASE_PROJECT_ID }}
HEADLESS: true
EVAL_ENV: browserbase
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Check for 'observe' label
id: label-check
run: |
if [ "${{ needs.determine-evals.outputs.run-observe }}" != "true" ]; then
echo "has_label=false" >> $GITHUB_OUTPUT
echo "No label for OBSERVE. Exiting with success."
else
echo "has_label=true" >> $GITHUB_OUTPUT
fi
- name: Set up Node.js
if: needs.determine-evals.outputs.run-observe == 'true'
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Enable Corepack
if: needs.determine-evals.outputs.run-observe == 'true'
run: |
npm install -g corepack@latest
corepack enable
- name: Get pnpm store directory
if: needs.determine-evals.outputs.run-observe == 'true'
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
if: needs.determine-evals.outputs.run-observe == 'true'
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-${{ runner.arch }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-pnpm-store-
- name: Install dependencies
if: needs.determine-evals.outputs.run-observe == 'true'
run: pnpm install --frozen-lockfile
- name: Download build artifacts
if: needs.determine-evals.outputs.run-observe == 'true'
uses: actions/download-artifact@v4
with:
name: build-artifacts
- name: Run Observe Evals
if: needs.determine-evals.outputs.run-observe == 'true'
run: pnpm run evals category observe
- name: Log Observe Evals Performance
if: needs.determine-evals.outputs.run-observe == 'true'
run: |
experimentName=$(jq -r '.experimentName' eval-summary.json)
echo "View results at https://www.braintrust.dev/app/Browserbase/p/stagehand/experiments/${experimentName}"
if [ -f eval-summary.json ]; then
observe_score=$(jq '.categories.observe' eval-summary.json)
echo "Observe category score: $observe_score%"
if (( $(echo "$observe_score < 80" | bc -l) )); then
echo "Observe category score is below 80%. Failing CI."
exit 1
fi
else
echo "Eval summary not found for observe category. Failing CI."
exit 1
fi
run-targeted-extract-evals:
needs: [run-regression-evals, run-build, determine-evals]
runs-on: ubuntu-latest
timeout-minutes: 60
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
GOOGLE_GENERATIVE_AI_API_KEY: ${{ secrets.GOOGLE_GENERATIVE_AI_API_KEY }}
BRAINTRUST_API_KEY: ${{ secrets.BRAINTRUST_API_KEY }}
BROWSERBASE_API_KEY: ${{ secrets.BROWSERBASE_API_KEY }}
BROWSERBASE_PROJECT_ID: ${{ secrets.BROWSERBASE_PROJECT_ID }}
HEADLESS: true
EVAL_ENV: browserbase
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Check for 'targeted-extract' label
id: label-check
run: |
if [ "${{ needs.determine-evals.outputs.run-targeted-extract }}" != "true" ]; then
echo "has_label=false" >> $GITHUB_OUTPUT
echo "No label for TARGETED-EXTRACT. Exiting with success."
else
echo "has_label=true" >> $GITHUB_OUTPUT
fi
- name: Set up Node.js
if: needs.determine-evals.outputs.run-targeted-extract == 'true'
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Enable Corepack
if: needs.determine-evals.outputs.run-targeted-extract == 'true'
run: |
npm install -g corepack@latest
corepack enable
- name: Get pnpm store directory
if: needs.determine-evals.outputs.run-targeted-extract == 'true'
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
if: needs.determine-evals.outputs.run-targeted-extract == 'true'
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-${{ runner.arch }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-pnpm-store-
- name: Install dependencies
if: needs.determine-evals.outputs.run-targeted-extract == 'true'
run: pnpm install --frozen-lockfile
- name: Download build artifacts
if: needs.determine-evals.outputs.run-targeted-extract == 'true'
uses: actions/download-artifact@v4
with:
name: build-artifacts
- name: Run targeted extract Evals
if: needs.determine-evals.outputs.run-targeted-extract == 'true'
run: pnpm run evals category targeted_extract
- name: Log targeted extract Evals Performance
if: needs.determine-evals.outputs.run-targeted-extract == 'true'
run: |
experimentName=$(jq -r '.experimentName' eval-summary.json)
echo "View results at https://www.braintrust.dev/app/Browserbase/p/stagehand/experiments/${experimentName}"
if [ -f eval-summary.json ]; then
targeted_extract_score=$(jq '.categories.targeted_extract' eval-summary.json)
echo "Targeted extract category score: $targeted_extract_score%"
if (( $(echo "$targeted_extract_score < 80" | bc -l) )); then
echo "Targeted extract score is below 80%. Failing CI."
exit 1
fi
else
echo "Eval summary not found for targeted_extract category. Failing CI."
exit 1
fi
run-agent-evals:
needs: [run-regression-evals, run-build, determine-evals]
runs-on: ubuntu-latest
timeout-minutes: 90 # Agent evals can be long-running
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
GOOGLE_GENERATIVE_AI_API_KEY: ${{ secrets.GOOGLE_GENERATIVE_AI_API_KEY }}
BRAINTRUST_API_KEY: ${{ secrets.BRAINTRUST_API_KEY }}
BROWSERBASE_API_KEY: ${{ secrets.BROWSERBASE_API_KEY }}
BROWSERBASE_PROJECT_ID: ${{ secrets.BROWSERBASE_PROJECT_ID }}
HEADLESS: true
EVAL_ENV: browserbase
# Use agent models for agent evals in CI
EVAL_AGENT_MODELS: "computer-use-preview-2025-03-11,claude-3-7-sonnet-latest"
EVAL_TRIAL_COUNT: 2 # Reduce trials for agent evals
EVAL_MAX_CONCURRENCY: 10 # Lower concurrency for agent evals
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Check for 'agent' label
id: label-check
run: |
if [ "${{ needs.determine-evals.outputs.run-agent }}" != "true" ]; then
echo "has_label=false" >> $GITHUB_OUTPUT
echo "No label for AGENT. Exiting with success."
else
echo "has_label=true" >> $GITHUB_OUTPUT
fi
- name: Set up Node.js
if: needs.determine-evals.outputs.run-agent == 'true'
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Enable Corepack
if: needs.determine-evals.outputs.run-agent == 'true'
run: |
npm install -g corepack@latest
corepack enable
- name: Get pnpm store directory
if: needs.determine-evals.outputs.run-agent == 'true'
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
if: needs.determine-evals.outputs.run-agent == 'true'
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-${{ runner.arch }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-pnpm-store-
- name: Install dependencies
if: needs.determine-evals.outputs.run-agent == 'true'
run: pnpm install --frozen-lockfile
- name: Download build artifacts
if: needs.determine-evals.outputs.run-agent == 'true'
uses: actions/download-artifact@v4
with:
name: build-artifacts
- name: Run Agent Evals
if: needs.determine-evals.outputs.run-agent == 'true'
run: pnpm run evals category agent
- name: Log Agent Evals Performance
if: needs.determine-evals.outputs.run-agent == 'true'
run: |
experimentName=$(jq -r '.experimentName' eval-summary.json)
echo "View results at https://www.braintrust.dev/app/Browserbase/p/stagehand/experiments/${experimentName}"
if [ -f eval-summary.json ]; then
agent_score=$(jq '.categories.agent' eval-summary.json)
echo "Agent category score: $agent_score%"
# Lower threshold for agent evals since they're complex
if (( $(echo "$agent_score < 50" | bc -l) )); then
echo "Agent category score is below 50%. Failing CI."
exit 1
fi
else
echo "Eval summary not found for agent category. Failing CI."
exit 1
fi