bt functions manages function definitions stored in Braintrust, including tools, scorers, and LLM functions. Running bt functions without a subcommand is equivalent to running bt functions list.
bt functions list
List functions in the current project.bt functions view
Inspect a function’s definition. Depending on how the function is configured, the output can include:- Prompt and model settings
- Inline code or a preview of an uploaded code bundle
- Scorer parameters
- Classifier details, including its source facet, embedding model, and topics
fn_ or func_ is treated as a function ID. Without a selector, bt functions view prompts you to select a function in an interactive terminal.
bt functions view shows the latest version of a function. Pass --version to inspect an earlier version.
Flags
bt functions invoke
Invoke a function by slug. Without a slug,bt functions invoke prompts you to select a function in an interactive terminal. Use --input to pass JSON input, --message to pass one or more user messages to an LLM function, and --mode to choose the response format. In a non-interactive environment, you can also pipe JSON input to stdin.
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. Pass files or directories as positional arguments or with--file. If you omit them, bt functions push scans the current directory. Supported source extensions are .ts, .tsx, .js, .jsx, and .py.
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.
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.bt functions delete
Delete a function by slug. Without a slug,bt functions delete prompts you to select a function interactively.
Use the shared
--org, --project, and --profile global flags to select the Braintrust context. The list, view, invoke, push, and pull subcommands also support --json output.