GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Braintrust home page
  • Contact us
  • Dashboard
  • Integrations
  • SDKs
  • Reference
  • Cookbook
  • Troubleshooting
  • Changelog
  • Glossary
  • Overview
  • Query by SQL
  • Quickstart
  • Overview

This view

  • Original page
  • New address

GeezerVison is showing docs.braintrust.dev — CLI overview - Braintrust

bt is Braintrust’s command-line interface for working from the terminal. Use it to authenticate, select projects, manage Braintrust resources, run evaluations, query logs, and configure coding-agent tracing. Commands support both interactive use and automated workflows in scripts or CI.
To get started with the bt CLI, follow the CLI quickstart. If you’re moving from a version with bt auth commands, follow Migrate bt.

Authentication and profiles

bt can authenticate in three ways:
  • Environment API key: BRAINTRUST_API_KEY supplies an API key directly from the environment.
  • Saved OAuth profile: A reusable login created through browser-based Braintrust authentication.
  • Saved API key profile: An API key stored by bt for repeated use.
The CLI quickstart walks through configuring each authentication method and selecting an active organization and project. A profile is a saved login containing credentials and connection details for one Braintrust app URL. You can use one profile with every organization its credentials can access. Most people need only one profile. Add another when you sign in with different credentials or connect to a different Braintrust app URL. Run bt login to save a profile, bt profiles to list, rename, or delete profiles, and bt status --all to verify saved credentials. bt switch selects the active organization and project. When it authenticates with a saved profile, it also makes that profile active. Later commands use this context by default. Run bt status to see what’s active, or override the organization or project for one command with --org or --project. bt stores profile metadata locally and credentials in your system’s secure credential store when available. On macOS and Linux, if secure storage is unavailable, it uses a local credentials file. On Windows, bt v0.22.2 or later stores profiles and credentials together in a DPAPI-encrypted file and has no plaintext fallback. See Where are credentials stored? for locations.

Credential precedence

When more than one credential source is present, bt makes two decisions in turn. First, whether to use an API key or a saved profile:
  1. Passing --profile or --prefer-profile on the command line makes bt use a saved profile and ignore BRAINTRUST_API_KEY.
  2. Otherwise, BRAINTRUST_API_KEY from the environment wins.
  3. Otherwise, bt uses a saved profile, selected by the rules below.
Then, when using a saved profile, which one:
  1. The --profile NAME flag.
  2. The BRAINTRUST_PROFILE environment variable.
  3. The profile saved by bt switch, if it matches the requested app URL.
  4. The only compatible profile for the app URL and organization, if exactly one is saved.
  5. An interactive picker, if several profiles are compatible and bt is running in an interactive terminal. In CI or other non-interactive environments, set BRAINTRUST_PROFILE or pass --profile to avoid an ambiguous-profile error.
Run bt status to see the active organization, project, and selected profile. Run bt status --all to verify saved profiles and report missing, expired, or invalid credentials.
Having a saved login is not the same as selecting one. Only the --profile or --prefer-profile flag suppresses BRAINTRUST_API_KEY. Setting BRAINTRUST_PROFILE does not, so an API key in the environment still wins over it.

Commands

CommandSubcommandsDescription
bt custom-viewspush, trace bootstrap, trace preview, dataset bootstrap, dataset previewBootstrap, preview, and push custom trace and dataset views
bt datasetslist, create, view, update, delete, pipeline, snapshotsManage datasets
bt docsfetchDownload Braintrust documentation for coding agents
bt environmentslist, view, create, update, deleteManage deployment environments
bt evalRun JavaScript/TypeScript, Python, and Go eval files (macOS and Linux only)
bt experimentslist, view, compare, deleteManage experiments
bt functionslist, view, invoke, delete, push, pullManage functions (tools, scorers, and more)
bt initLink the current directory to a Braintrust org and project (creates .bt/config.json)
bt loginLog in to Braintrust, or refresh an OAuth login with --refresh
bt logoutRemove a saved Braintrust login and its local credentials
bt mcplist, runList and run Braintrust MCP server tools
bt observabilitytemplate pull, template pushExport and apply portable JSON configuration for facets and Loop automations
bt preprocessorslist, view, invoke, delete, push, bootstrap, previewBootstrap, preview, push, and manage trace preprocessors
bt profileslist, doctor, repair, delete, renameManage saved Braintrust login profiles and diagnose orphaned credentials
bt projectslist, create, view, deleteManage projects
bt promptslist, view, versions, assign, unassign, deleteManage prompts
bt scorerslist, create, view, invoke, deleteManage scorers and classifiers
bt setupskills, instrument, mcp, doctorConfigure Braintrust setup flows. Deprecated; use the standalone setup wizard
bt sqlRun SQL queries against Braintrust
bt statusShow current identity, org, and project context
bt switchSwitch org and project context
bt syncpull, push, statusSync project logs, experiments, or datasets to/from local NDJSON files
bt toolslist, view, invoke, deleteManage tools (alias for bt functions --type tool)
bt topicsstatus, poke, rewind, open, config, report, btmapInspect and control Topics automation
bt traceenable, disable, run, import, doctor, updateManage coding-agent tracing
bt updateUpdate the CLI binary
bt viewlogs, trace, span, thread, waterfallBrowse logs, traces, and spans in a terminal UI, or render a trace transcript or waterfall

Global flags

Most bt commands accept these global flags. Commands that only manage login state, such as bt login, accept the credential-related flags but not organization or project selection flags.
FlagShortEnv varDescription
--jsonOutput as JSON
--verbose-vBRAINTRUST_VERBOSEIncrease output verbosity
--quiet-qBRAINTRUST_QUIETSuppress non-essential output
--no-colorBRAINTRUST_NO_COLORDisable ANSI color output
--profile NAMEBRAINTRUST_PROFILEUse a saved login profile
--org NAME-oBRAINTRUST_ORG_NAMEOverride org
--project NAME-pBRAINTRUST_DEFAULT_PROJECTOverride project
--prefer-profilePrefer profile credentials even if BRAINTRUST_API_KEY is set
--no-inputBRAINTRUST_NO_INPUTDisable interactive prompts
--api-url <URL>BRAINTRUST_API_URLOverride API URL. With bt v0.33.0 or later, takes precedence over the API URL of the organization you log in to
--app-url <URL>BRAINTRUST_APP_URLOverride app URL
--app-public-url <URL>BRAINTRUST_APP_PUBLIC_URLOverride the public app URL used for browser links
--env-file <PATH>BRAINTRUST_ENV_FILELoad a .env file
--ca-cert <PATH>BRAINTRUST_CA_CERTPath to a PEM-encoded CA bundle for HTTPS requests (takes precedence over SSL_CERT_FILE)
After argument parsing, errors from commands run with --json use an error.message field. If the server returns structured details, they appear under error.details. By default, bt uses the authentication app URL for browser links, such as when opening a project. If your deployment uses a different address to access Braintrust in a browser, set --app-public-url so those links point to that address. This option requires bt v0.19.3 or later and does not change authentication or API requests.

Environment variables

These variables configure common CLI behavior and selected commands. Run bt <command> --help for that command’s complete flag and environment-variable mappings.
bt v0.26.0 renamed its command-specific environment variables from the BT_ prefix to the BRAINTRUST_ prefix, for example BT_EVAL_WATCH to BRAINTRUST_EVAL_WATCH. The earlier BT_ names still work as deprecated aliases. If both names are set, the BRAINTRUST_ name takes precedence. See Migrate bt to update scripts.
VariablePurpose
BRAINTRUST_ADDITIONAL_METADATAJSON object merged into root-span metadata by supported bt trace commands
BRAINTRUST_TAGSComma-separated session tags for supported bt trace enable, bt trace run, and bt trace import commands
BRAINTRUST_API_KEYUse API key credentials instead of a saved profile, unless profile credentials are explicitly preferred
BRAINTRUST_CA_CERTPath to a PEM-encoded CA bundle (overrides SSL_CERT_FILE)
BRAINTRUST_CUSTOM_CA_BUNDLEAdditional trusted CA certificates for SDK-backed tracing and data uploads. Supply PEM contents, not a file path. Requires bt v0.19.3 or later
BRAINTRUST_PROFILEProfile selection
BRAINTRUST_ORG_NAMEOrg override
BRAINTRUST_DEFAULT_PROJECTProject override
BRAINTRUST_API_URLAPI endpoint override. With bt v0.33.0 or later, takes precedence over the API URL of the organization you log in to
BRAINTRUST_APP_URLApp endpoint (default: https://www.braintrust.dev)
BRAINTRUST_APP_PUBLIC_URLPublic app URL for browser links (defaults to the app URL used for authentication)
BRAINTRUST_ENV_FILE.env file path
BRAINTRUST_VERBOSEIncrease output verbosity
BRAINTRUST_QUIETSuppress non-essential output
BRAINTRUST_NO_COLORDisable colored output
BRAINTRUST_NO_INPUTDisable all interactive prompts
BRAINTRUST_EVAL_RUNNEREval runner binary
BRAINTRUST_EVAL_LANGUAGEForce eval language (java-script, python, or go)
BRAINTRUST_EVAL_FILTERFilter expression for evaluator selection
BRAINTRUST_EVAL_FIRSTRun only the first N dataset records
BRAINTRUST_EVAL_SAMPLERun a deterministic random sample of N dataset records
BRAINTRUST_EVAL_SAMPLE_SEEDSeed used with --sample
BRAINTRUST_EVAL_LOCALRun evals without sending logs to Braintrust
BRAINTRUST_EVAL_WATCHRe-run evals on file change
BRAINTRUST_EVAL_MAX_CONCURRENCYMaximum number of evaluators to run concurrently
BRAINTRUST_EVAL_NUM_WORKERSWorker threads for Python eval execution
BRAINTRUST_EVAL_LISTList evaluators without executing them
BRAINTRUST_EVAL_JSONLEmit eval results as JSONL
BRAINTRUST_EVAL_TERMINATE_ON_FAILUREStop after the first hard eval failure
BRAINTRUST_EVAL_NO_AUTO_INSTRUMENTATIONDisable automatic instrumentation for JavaScript and TypeScript evals
BRAINTRUST_EVAL_DEVStart the eval dev server
BRAINTRUST_EVAL_DEV_HOSTHost interface for the eval dev server (default: localhost)
BRAINTRUST_EVAL_DEV_PORTPort for the eval dev server (default: 8300)
BRAINTRUST_EVAL_DEV_ORG_NAMERestrict eval dev server to a specific org
BRAINTRUST_EVAL_DEV_ALLOWED_ORIGINAdditional allowed CORS origin(s) for the eval dev server (comma-separated)
BRAINTRUST_SYNC_WINDOWRelative time window for bt sync pull
BRAINTRUST_SYNC_PUSH_MAX_BATCH_BYTESMaximum input bytes per upload batch for bt sync push
BRAINTRUST_SYNC_PUSH_MAX_IN_FLIGHT_BYTESMaximum in-flight input bytes for bt sync push
BRAINTRUST_SQL_FORCE_IGNORE_LINTERRun bt sql even when the SQL linter reports failures
BRAINTRUST_OBSERVABILITY_TEMPLATE_PULL_OUTPUTOutput file path for bt observability template pull
BRAINTRUST_OBSERVABILITY_TEMPLATE_PULL_FORCEOverwrite an existing output file for bt observability template pull
BRAINTRUST_OBSERVABILITY_TEMPLATE_PUSH_FILETemplate source for bt observability template push
BRAINTRUST_OBSERVABILITY_TEMPLATE_PUSH_TOPICS_AUTOMATIONTopics automation name or ID for bt observability template push
BRAINTRUST_OBSERVABILITY_TEMPLATE_PUSH_FORCEReplace matching resources for bt observability template push
BRAINTRUST_OBSERVABILITY_TEMPLATE_PUSH_YESSkip the confirmation prompt for bt observability template push
BRAINTRUST_TOPICS_STATUS_PROGRESS_WINDOWWindow for bt topics status progress counts
BRAINTRUST_TOPICS_REPORT_FUNCTION_IDTopic map function ID for bt topics report
BRAINTRUST_TOPICS_REPORT_VERSIONTopic map version for bt topics report
BRAINTRUST_TOPICS_REPORT_OUTPUTOutput file path for bt topics report
BRAINTRUST_TOPICS_BTMAP_FUNCTION_IDTopic map function ID for bt topics btmap
BRAINTRUST_TOPICS_BTMAP_VERSIONTopic map version for bt topics btmap
BRAINTRUST_TOPICS_BTMAP_OUTPUTOutput file path for bt topics btmap
BRAINTRUST_FUNCTIONS_VIEW_IDFunction ID for bt functions view
BRAINTRUST_FUNCTIONS_VIEW_VERSIONVersion selector for bt functions view
BRAINTRUST_FUNCTIONS_VIEW_ENVIRONMENTEnvironment selector for bt functions view
BRAINTRUST_FUNCTIONS_PUSH_FILESFile or directory path(s) to scan for bt functions push
BRAINTRUST_FUNCTIONS_PUSH_IF_EXISTSConflict behavior for bt functions push: error, replace, or ignore
BRAINTRUST_FUNCTIONS_PUSH_LANGUAGEForce language for bt functions push: auto, javascript, or python
BRAINTRUST_FUNCTIONS_PUSH_EXTERNAL_PACKAGESAdditional packages to exclude from JS bundling during push
BRAINTRUST_FUNCTIONS_PUSH_RUNNEROverride runner binary for bt functions push
BRAINTRUST_FUNCTIONS_PUSH_TSCONFIGtsconfig path for the JS runner and bundler
BRAINTRUST_FUNCTIONS_PUSH_REQUIREMENTSPython requirements file for bt functions push
BRAINTRUST_FUNCTIONS_PUSH_CREATE_MISSING_PROJECTSCreate referenced projects when they do not exist
BRAINTRUST_FUNCTIONS_PUSH_TERMINATE_ON_FAILUREStop after first failure during push (default: false)
BRAINTRUST_FUNCTIONS_PULL_SLUGFunction slug(s) to pull
BRAINTRUST_FUNCTIONS_PULL_IDFunction ID selector for bt functions pull
BRAINTRUST_FUNCTIONS_PULL_LANGUAGEOutput language for bt functions pull: typescript or python
BRAINTRUST_FUNCTIONS_PULL_OUTPUT_DIRDestination directory for bt functions pull (default: ./braintrust)
BRAINTRUST_FUNCTIONS_PULL_PROJECT_IDProject ID filter for bt functions pull
BRAINTRUST_FUNCTIONS_PULL_VERSIONVersion selector for bt functions pull
BRAINTRUST_FUNCTIONS_PULL_FORCEOverwrite local files during pull (default: false)
NO_COLORDisable colored output (standard convention)
PAGERCustom pager (default: less -R)
GITHUB_TOKENGitHub API authentication for bt update
bt does not automatically load .env files. Set environment variables explicitly in your shell, through --env-file <PATH>, or with a tool like direnv before running bt commands.

Troubleshooting

bt not found after install

Open a new shell. Ensure ~/.local/bin (or $XDG_BIN_HOME if set) is in your PATH.

OAuth login fails

On SSH, bt auto-detects and prints the auth URL instead of opening a browser. Use --no-browser to force this behavior. The OAuth callback times out after 5 minutes. On remote hosts, paste the final callback URL from your local browser if the localhost callback can’t be delivered.

No profile found

Run bt profiles list to list saved profiles, or bt status --all to verify their credentials. Specify one with --profile or BRAINTRUST_PROFILE. If you recently migrated from a version with bt auth commands, see the CLI migration guide.

Wrong org or project

Run bt status to see the active organization and project and where that context was set.

bt is using the wrong credentials

Run bt status --all to verify saved profiles, inspect the configured context, and check whether BRAINTRUST_API_KEY is overriding saved profiles. The command reports the override but does not validate the environment API key. Unset it, pass --profile <NAME>, or pass --prefer-profile to use a saved profile instead. See Credential precedence for the full order.

Token expired

Run bt login --refresh --profile <name> to refresh the expired OAuth profile. If refresh fails, run bt login --oauth --profile <name> to authenticate that profile again. These commands replaced bt auth refresh and bt auth login in v0.16.0. See the CLI migration guide.

Where are credentials stored?

bt stores credentials in your system’s secure credential store:
  • macOS: system keychain (via security)
  • Linux: libsecret / secret-tool if available; otherwise a 0600-permission plaintext file
  • Windows: DPAPI-encrypted file at %USERPROFILE%\.braintrust\auth\credentials.dpapi
On Windows, bt v0.22.2 or later keeps profiles and credentials in the same encrypted file, which only the current user can decrypt. Packaged (MSIX) desktop apps that run bt use the same file as your terminal. The first command that reads saved logins after upgrading moves them from %APPDATA%\bt\auth.json and %APPDATA%\bt\secrets.json into the encrypted file, then deletes the old files. If migration fails when a desktop app runs bt, run bt profiles once from a terminal. Earlier bt versions can’t read the encrypted file, so log in again after a downgrade.

Update fails

If your installed version does not recognize bt update, run bt self update once. Versions before v0.16.0 used the older command. See bt update for package-manager installs and Windows upgrades.

Uninstall

macOS and Linux:
rm -f "${XDG_BIN_HOME:-${XDG_DATA_HOME:-$HOME/.local}/bin}/bt"
rm -rf "${XDG_CONFIG_HOME:-$HOME/.config}/bt"
Windows (PowerShell):
$cargoHome = if ($env:CARGO_HOME) { $env:CARGO_HOME } else { Join-Path $HOME ".cargo" }
Remove-Item -Force (Join-Path $cargoHome "bin\bt.exe") -ErrorAction SilentlyContinue
Remove-Item -Recurse -Force (Join-Path $env:APPDATA "bt") -ErrorAction SilentlyContinue
$userProfile = [Environment]::GetFolderPath("UserProfile")
Remove-Item -Recurse -Force (Join-Path $userProfile ".braintrust\auth") -ErrorAction SilentlyContinue
The last two lines remove the encrypted credentials file used by bt v0.22.2 or later. They have no effect if you never installed one of those versions.

Was this page helpful?

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.