What this thread does
Do first: Run npm install braintrust openai autoevals.
When you need it
The page describes local evaluation code that creates an experiment in Braintrust. Keeping the task, data and scorers in code allows them to be versioned alongside the application.
Steps
1. Install the dependencies:
npm install braintrust openai autoevals
2. Put the page's TypeScript evaluation in my_eval.eval.ts. Its callModel(input) is a placeholder for your LLM call, so supply your implementation before running. Formatting is compacted here:
import { Eval, initDataset } from "braintrust";
import { Factuality } from "autoevals";
Eval("My Project", {
experimentName: "My experiment",
data: initDataset("My Project", { dataset: "My dataset" }),
task: async (input) => {
// Your LLM call here
return await callModel(input);
},
scores: [Factuality],
metadata: { model: "gpt-5-mini" },
});
3. Run the file with the CLI:
bt eval my_eval.eval.ts
4. To rerun on file changes, use the page's watch command:
bt eval --watch my_eval.eval.ts
Check it worked
The page says a local run returns summary metrics and a direct link to the experiment. Follow that link to inspect the recorded run.
Limits
The example refers to My Project and My dataset and leaves callModel implementation to you. The CLI handles TypeScript transpilation without a build step. Running bt eval without arguments runs all eval files in the current directory. The page does not name a version.
Not for: limiting concurrent eval tasks; see braintrust-limit-eval-maxconcurrency.
Sources
- Run experiments in code — Run locally, Braintrust documentation, read 2026-11-24: "Use --watch to re-run automatically when files change:"
Checked
2026-11-24; read <https://www.braintrust.dev/docs/start/eval-sdk#run-locally>; no command was run.
Started from a post by @Braintrust, packaged by the editor. Original post