braintrust cli
Runs Braintrust evals and pushes logs from the terminal via the bt CLI. Use when you need to execute an eval file, run evals locally without uploading, or sync logs into a Braintrust project from CI or scripts. Not for defining evals or scorers, which live in SDK code.
TL;DR
The Braintrust CLI is called bt and ships as the npm package @braintrust/bt, separate from the braintrust SDK. Install it with npm install -g @braintrust/bt, set your API key through the BRAINTRUSTAPIKEY environment variable, then run evals with bt eval path/to/foo.eval.ts. Most first-run failures are missing auth or running from the wrong directory.
Error
$ bt eval evals/smoke.eval.ts
zsh: command not found: btSteps
- Install the CLI:
npm install -g @braintrust/bt. Expected:bt --versionprints a version number. - Authenticate by setting the BRAINTRUSTAPIKEY environment variable to your Braintrust API key (find it in the Braintrust UI under your account settings). Expected:
btcommands stop reporting missing credentials. - Run an eval file from your project:
bt eval path/to/foo.eval.ts. Expected: the eval executes and prints a link to the experiment in the Braintrust UI. - To run without sending logs to Braintrust, add the local flag:
bt eval --local path/to/foo.eval.ts. Expected: results stay local, nothing uploads. - To push prebuilt logs into a project:
bt sync push project_logs:"My Project" --in ./out/logs --no-input. Expected: the CLI reports the rows synced and they appear under that project in the UI.
When to use
- You need to run a Braintrust eval file from the terminal or CI.
- You want to push existing logs into Braintrust without writing SDK code.
- You are scripting eval runs (nightly jobs, CI gates) and need a non-interactive command.
When not to use
- You are defining the eval itself (task function, scorers, dataset); that lives in SDK code, the CLI only runs it.
- You want to query or summarize past experiments; the web UI or MCP server fits better.
- You have not installed the package;
npx @braintrust/bt --helpworks without a global install.
Tool compatibility
@braintrust/btfrom npm, any recent release; verify withbt --version.- Node.js 18 or newer.
- Works alongside the
braintrustPython SDK (pip install braintrust) and TypeScript SDK (npm install braintrust).
Variant phrasings
braintrust command line
The binary is named bt, not braintrust. The braintrust npm package is the SDK; the CLI is the separate @braintrust/bt package.
run braintrust eval from terminal
bt eval takes a path to an eval file (.eval.ts). It is not braintrust eval, and it does not take an eval name; the file defines the eval.
braintrust cli login
There is no interactive login subcommand in current releases; auth is the BRAINTRUSTAPIKEY environment variable. The env var is the reliable path in automation and CI.
Why it happens
Braintrust split the CLI out of the SDK so terminal workflows (CI, scripts, log pushes) do not need project code. That split is also why braintrust eval fails: the SDK package ships no such binary, and most agents guess the command name.
Edge cases
- In CI, prefer
npx @braintrust/bt@VERSIONpinned to a release over a global install, so runs are reproducible. bt eval --localstill needs your model provider keys for the task under test; it only skips the Braintrust upload.- If the CLI and the SDK disagree on the API endpoint, set BRAINTRUSTAPIURL for both; the default points at the public Braintrust API.
Provenance
Resolved from the public thread: https://vectle.com/posts/pstoPMRHep6X9AwzkhEK42cw
Maintainer review
No maintainer verification is recorded for this version.
This records the version a maintainer checked. It does not assert that the version is the latest upstream release.