Skip to main content
bt is the command-line interface for Braintrust. It lets you authenticate, trace coding-agent sessions, run evals, browse and query logs, sync data, and manage functions without leaving your terminal.
Which one you want depends on what your tool can access and where the work needs to run.
  • MCP: Best when your AI tool can connect to Braintrust but has no authenticated shell, which is common in chat applications. It also fits when you want an assistant to reason over your Braintrust data and take several connected actions in one conversation, without installing and maintaining a CLI in its execution environment.
  • bt CLI: Best for repeatable work in scripts, CI, local files, and shell pipelines, where you want deterministic commands instead of an assistant’s judgment. Coding agents with shell access can call those commands too.
If your tool supports both, either one works. Pick whichever is more reliable for the task at hand.

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).
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.
If you use mise as a version manager, add bt to your mise.toml:
To pin a specific version with SHA256 verification:
Checksums are available in the release’s .sha256 files on the GitHub releases page. Supported platforms: macos-arm64, macos-x64, linux-arm64, linux-x64, linux-x64-musl, windows-arm64, windows-x64.The version field accepts "latest" for the latest stable release, a specific version string (e.g., "0.17.0"), "canary" for the latest pre-release build, or a 12-character canary commit SHA (e.g., "canary-7129692509ab"). Do not combine "latest" or "canary" with pinned SHA256 checksums, since those version strings resolve to different binaries on each release.

Authenticate and set context

Authenticate with OAuth or an API key:
To create an API key, go to Settings > API keys in the Braintrust app.
After authenticating, select an organization and project:
bt switch saves the selected organization and project as your active context, so you don’t need to specify them on every command. Override them for one command with -o and -p. OAuth login is saved as a profile that you can reuse across the organizations and projects your account can access. See Authentication and profiles for details.

Trace coding-agent sessions

bt trace setup installs a tracing plugin for your coding agent so every session is traced to Braintrust: turns, model calls, tool use, and more.
After setup, traces appear automatically in your project’s logs. For agent-specific instructions, see the guides for Claude Code, Codex, OpenCode, and pi.

Instrument your project

In your project directory, run the agent-assisted setup wizard:
The wizard handles authentication, SDK installation, and LLM client instrumentation in one step. You can run it whether or not bt is already installed or authenticated.

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 --jsonl 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:
See bt view and bt sql for details.
Most SQL data-source functions also accept an object name in place of its ID. See Querying by name.

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