Documentation Index
Fetch the complete documentation index at: https://braintrust.dev/docs/llms.txt
Use this file to discover all available pages before exploring further.
bt functions manages function definitions stored in Braintrust — tools, scorers, LLM functions, and more.
bt functions push
Upload local TypeScript or Python function definitions to Braintrust. The CLI discovers functions registered via the Braintrust SDK, bundles them, and uploads them to the API. TypeScript bundling:bt functions push uses esbuild (resolved from your project’s node_modules) to bundle TypeScript/JavaScript files. The Braintrust SDK (braintrust, autoevals, @braintrust/*) is bundled into the archive by default so functions are self-contained. Use --external-packages to mark additional packages as external if needed.
Python bundling: For Python files, the CLI collects .py source files and vendors the braintrust SDK package into the archive so it is available at runtime.
Function discovery: The CLI runs your file through the Braintrust SDK to discover registered functions. Functions are registered using builder methods such as project.tools.create() and project.scorers.create(), which populate a global registry that push reads at upload time.
Zod and Pydantic schemas: Parameter schemas defined with Zod (TypeScript) or Pydantic (Python) are serialized and stored alongside the function definition in Braintrust.
Flags
| Flag | Env var | Default | Description |
|---|---|---|---|
--file <PATH> | BT_FUNCTIONS_PUSH_FILES | — | File or directory path(s) to scan (repeatable; comma-delimited) |
--if-exists <MODE> | BT_FUNCTIONS_PUSH_IF_EXISTS | error | Behavior when slug already exists: error, replace, or ignore |
--language <LANG> | BT_FUNCTIONS_PUSH_LANGUAGE | auto | Force language: auto, javascript, or python |
--external-packages <PKGS> | BT_FUNCTIONS_PUSH_EXTERNAL_PACKAGES | — | Additional packages to exclude from JS bundling (repeatable; space or comma-delimited). The Braintrust SDK is bundled by default and does not need to be listed. |
--runner <RUNNER> | BT_FUNCTIONS_PUSH_RUNNER | — | Override runner binary (e.g. tsx, vite-node, python) |
--tsconfig <PATH> | BT_FUNCTIONS_PUSH_TSCONFIG | — | tsconfig path for the JS runner and bundler |
--requirements <PATH> | BT_FUNCTIONS_PUSH_REQUIREMENTS | — | Python requirements file |
--create-missing-projects | BT_FUNCTIONS_PUSH_CREATE_MISSING_PROJECTS | true | Create referenced projects when they do not exist |
--terminate-on-failure | BT_FUNCTIONS_PUSH_TERMINATE_ON_FAILURE | false | Stop after the first hard failure |
--yes / -y | — | — | Skip confirmation prompts |
bt functions pull
Download function definitions from Braintrust to local files. Target functions by slug or ID, choose the output language, and control what happens when local files already exist.Flags
| Flag | Env var | Default | Description |
|---|---|---|---|
--slug <SLUG> / -s | BT_FUNCTIONS_PULL_SLUG | — | Function slug(s) to pull (repeatable; comma-delimited) |
--id <ID> | BT_FUNCTIONS_PULL_ID | — | Function ID selector (mutually exclusive with --slug) |
--language <LANG> | BT_FUNCTIONS_PULL_LANGUAGE | typescript | Output language: typescript or python |
--output-dir <PATH> | BT_FUNCTIONS_PULL_OUTPUT_DIR | ./braintrust | Destination directory for generated files |
--project-id <ID> | BT_FUNCTIONS_PULL_PROJECT_ID | — | Filter by project ID |
--version <VERSION> | BT_FUNCTIONS_PULL_VERSION | — | Version selector |
--force | BT_FUNCTIONS_PULL_FORCE | false | Overwrite local files even when dirty |
--verbose | — | false | Show skipped files in output |