Install the bt CLI, the recommended way for you and your coding agents to run evals, instrument code, query logs, and sync data from the terminal.
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.
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.
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:
bt setup # Interactive wizard with the minimal amount of questionsbt setup -i # Interactive wizard with all the options# Directly starts codex to instrument the code since all questions are answeredbt setup --project 'project-name' --api-key BRAINTRUST_API_KEY --agent codex
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.
bt auth login # OAuth: opens a browser login flow, saves credentials to your keychainexport BRAINTRUST_API_KEY=<your-key> # API key: good for CI, scripts, or if you prefer not to use OAuth
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 switch # Pick a default org and projectbt status # Confirm what's active
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 your evaluation files directly without npx or SDK runner setup:
bt eval # Discover and run all eval files in the current directorybt eval tests/ # Run eval files under a specific directorybt eval --watch # Re-run on file changes during developmentbt eval --filter my-evaluator # Run a specific evaluator by name
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.
bt view logs # Browse logs for the active projectbt view logs --search "error" # Search by keywordbt view logs --filter "metrics.duration > 5.0" # Filter by expressionbt view logs --url <braintrust-url> # Open a Braintrust URL in the terminal
For programmatic access, bt sql runs SQL queries against your logs from the terminal or in scripts:
bt sql "SELECT * FROM project_logs('my-project') WHERE scores.Factuality < 0.5 LIMIT 50"BRAINTRUST_API_KEY=... bt sql "SELECT count(*) FROM project_logs('my-project')" --json
bt sync downloads Braintrust data to local NDJSON files for offline analysis, backup, or migration:
bt sync pull project_logs:my-project --window 24h # Pull the last 24 hours of logsbt sync pull experiment:my-experiment # Pull a specific experimentbt sync push project_logs:my-project # Push local data back to Braintrust
bt functions push uploads local TypeScript or Python function definitions (tools, scorers, LLM functions) to Braintrust. bt functions pull downloads them back to local files.
bt functions push my_tools.ts # Upload a TypeScript function filebt functions push src/scorers.py # Upload a Python function filebt functions pull --slug my-scorer # Download a function by slug
See bt functions for bundling behavior, language options, and all flags.