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.
MCP or CLI?
MCP or CLI?
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.
btCLI: 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.
Install
To install the latest version ofbt:
~/.local/bin/bt (or $XDG_BIN_HOME/bt if set).
Install with npm
Install with npm
If you already use the Braintrust JavaScript SDK, To run Platform-specific binaries are delivered through optional dependencies, with a postinstall download as a fallback when optional dependencies are skipped, such as with
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: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.--omit=optional or in airgapped installs. Two environment variables control binary resolution:BT_BINARY_PATH: Path to abtbinary to use instead of the resolved one.BT_SKIP_DOWNLOAD: Set to1to skip the postinstall fallback download.
Install with mise
Install with mise
If you use mise as a version manager, add To pin a specific version with SHA256 verification:Checksums are available in the release’s
bt to your mise.toml:.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: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.
Instrument your project
In your project directory, run the agent-assisted setup wizard:bt is already installed or authenticated.
Run evals locally
Run your evaluation files directly withoutnpx 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, setBRAINTRUST_API_KEY instead of using OAuth login. See Run in CI/CD for the full workflow.
--no-input and --jsonl for non-interactive output:
--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:
bt sql runs SQL queries against your logs from the terminal or in scripts:
bt view and bt sql for details.
Sync data
bt sync downloads Braintrust data to local NDJSON files for offline analysis, backup, or migration:
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.
bt functions for bundling behavior, language options, and all flags.
Next steps
- Read the CLI overview for the complete command list, global flags, and environment variables
- See Filter and search logs for SQL query examples against your logs
- See Run evaluations for eval workflow details