Skip to main content
bt is the command-line interface for Braintrust. It lets you run evals, instrument your code, browse and query logs, sync data, manage functions, and configure coding agents without leaving your terminal.
Beta — This feature is subject to change.

Install

To install the latest version of bt:
To install a specific version:
To install the canary (pre-release) channel:
The installer downloads a pre-built binary to ~/.local/bin/bt (or $XDG_BIN_HOME/bt if set). After installing, the installer suggests running bt setup to connect your project to Braintrust. You can do this now or come back later.

Install with npm

If you already use the Braintrust JavaScript SDK, bt is available as an optional dependency of the braintrust npm package (braintrust v3.17.0 or later). After installing braintrust, run bt through your package manager:
To run bt once without adding it to a project, use npx -p braintrust bt.
Use the standalone installer above if you want to update bt independently of the SDK, or if you need the canary channel, which isn’t published to npm. The npm package always matches your installed braintrust version.
Platform-specific binaries are delivered through optional dependencies, with a postinstall download as a fallback when optional dependencies are skipped, such as with --omit=optional or in airgapped installs. Two environment variables control binary resolution:
  • BT_BINARY_PATH: Path to a bt binary to use instead of the resolved one.
  • BT_SKIP_DOWNLOAD: Set to 1 to skip the postinstall fallback download.

Set up coding agents

bt setup handles authentication and API key creation for your project. Optionally, it installs Braintrust skill files, workflow docs, and MCP server config into your coding agent’s config directory (Claude, Copilot, Cursor, Codex, Gemini, Opencode, Qwen). It also detects your project language, installs the exact SDK version, instruments your LLM clients, verifies the app still runs, and outputs a Braintrust permalink to the captured trace:
If bt setup creates a new API key, it prints an export BRAINTRUST_API_KEY=<key> command. Run it to make the key available in your current terminal session. See bt setup for supported languages and all subcommands.

Authenticate and set context

bt supports two authentication methods:
To use an API key, create one under Settings > API keys in the Braintrust app. If you haven’t set up the CLI yet, bt setup creates an API key for you interactively. See Set up coding agents below. After authenticating, set a default org and project:
bt saves a context (a default org) so you don’t need to specify it on every command. The project must be set on each command with -p. You can always override the org with -o or environment variables.

Run evals locally

Run your evaluation files directly without npx or SDK runner setup:
bt eval auto-detects your JavaScript runner (tsx, vite-node, ts-node) and supports Python eval files too. For other languages, run your eval file directly with your language’s toolchain. See bt eval for the full list of flags.

Run evals in CI

For CI pipelines, set BRAINTRUST_API_KEY instead of using OAuth login. See Run in CI/CD for the full workflow.
Create an API key in the Braintrust app under Settings > API keys. Use --no-input and --json for non-interactive output:
Use --first N or --sample N to run a subset of your data as a non-final smoke run on pull requests, then run the full suite on merge:

Browse and query logs

bt view logs opens an interactive terminal UI for browsing your project’s logs, useful for checking on production traffic or debugging during an incident:
For programmatic access, bt sql runs SQL queries against your logs from the terminal or in scripts:
Most SQL data-source functions also accept an object name in place of its ID. See Querying by name.
See bt view and bt sql for details.

Sync data

bt sync downloads Braintrust data to local NDJSON files for offline analysis, backup, or migration:
See bt sync for the full flag reference.

Manage functions

bt functions push uploads local TypeScript or Python function definitions (tools, scorers, and LLM functions) to Braintrust. bt functions pull downloads them back to local files.
See bt functions for bundling behavior, language options, and all flags.

Next steps