bt functions manages function definitions stored in Braintrust — tools, scorers, LLM functions, and more.
bt functions view
Inspect a function’s definition. The details shown depend on the function type: LLM functions show their prompt and model, code functions show their source (or a preview for bundled code), scorers show their parameters, and classifiers show their source facet, embedding model, and topics. Target a function by slug or ID, and optionally pin to a specific version. Without a slug, bt functions view prompts you to select a function interactively.
By default, bt functions view shows the latest version of a function. Pass --version to inspect an earlier version.
Flags
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.
Python bundle paths must not contain spaces or other whitespace characters. Rename your directory or use a symlink if your path contains spaces.
Flags
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