GitHub Actions
Use thebraintrustdata/eval-action to run evaluations on every pull request:
runtime to node, python, or go to match your project. The action automatically posts a comment with results to the pull request, which requires the pull-requests: write permission shown above.
Other CI systems
For other CI systems, usebt eval directly:
BRAINTRUST_API_KEY in your CI environment. Use --no-input to suppress prompts and --json for machine-readable output.
Use --first N or --sample N to run a non-final smoke test on pull requests and reserve the full run for merges:
Customize pass/fail with reporters
When you run an experiment, Braintrust logs results to your terminal, andbt eval returns a non-zero exit code if any eval throws an exception. Customize this behavior for CI/CD pipelines to precisely define what constitutes a failure or to report results to different systems.
Define custom reporters using Reporter(). A reporter has two functions:
Reporter included among your evaluated files will be automatically picked up by the bt eval CLI command.
- If no reporters are defined, the default reporter logs results to the console.
- If you define one reporter, it’s used for all
Evalblocks. - If you define multiple
Reporters, specify the reporter name as an optional third argument to the eval function.
Next steps
- Run experiments in code with the SDK
- Interpret results from your experiments
- Compare experiments to measure improvements
- Write scorers to measure quality