Skip to main content
Running your evaluation as code with the Braintrust SDK gives you full control over the task, data, and scorers, and lets you version it alongside your application. Iterate locally, then wire the same code into CI/CD.

Run locally

Run evaluation code locally to create an experiment in Braintrust and return summary metrics, including a direct link to your experiment. See Interpret results for how to read it.
Install the SDK and dependencies:
Create the eval code:
Run your evaluation with the bt eval CLI:
Use --watch to re-run automatically when files change:
Benefits of using the CLI:
  • Automatic .env loading — reads .env.development.local, .env.local, .env.development, and .env
  • Multi-file support — pass multiple files or directories: bt eval [file or directory] .... Running bt eval with no arguments runs all eval files in the current directory.
  • TypeScript transpilation — no build step required; the CLI handles it
You can pass a parameters option to make configuration values (like model choice, temperature, or prompts) editable in the playground without changing code. Define parameters inline or use loadParameters() to reference saved configurations. See Write parameters and Test complex agents for details.

Configure experiments

Customize experiment behavior with options:
In the TypeScript, Python, and Ruby SDKs, you can set each inline eval case’s origin field to link it back to its source dataset row. This populates the dataset performance view, which only shows experiments whose eval traces set origin.
These examples show common options. For the complete set of Eval() options, see the SDK reference for your language.

Next steps