Skip to main content
Workflows in Braintrust allow you to chain together two or more prompts. You can create, edit and execute workflows in the playground.
Workflows are in beta. They currently only work in playgrounds and are limited to prompt chaining functionality. If you are on a hybrid deployment, workflows are available starting with v0.0.66.

Creating a workflow in the playground

To create a workflow, navigate to a playground and select +Workflow. Start by creating the base prompt or selecting one from your library. Then create or select another prompt by selecting the + icon in the comparison workflow pane. The prompts chain together and run consecutively.

Variables

Workflows use templating to reference variables from datasets and previous prompts. By default, prompts use Mustache templating syntax ({{variable}}). For more complex logic, you can use Nunjucks (similar to Jinja). For more details, see Use templating Variable behavior differs between the first prompt node and subsequent nodes because later prompts receive the output of previous nodes as their input.

The dataset variable

If you are on a hybrid deployment, the dataset variable is available starting with v1.1.1.
The dataset variable is globally available. Use it in any workflow prompt node to access input, expected, and metadata. For example, use {{dataset.metadata.foo}} to access metadata.foo.

In the first workflow prompt

The first prompt node can access dataset variables directly by using {{input}}, {{expected}}, and {{metadata}}. For consistency across prompts, use {{dataset}} dot syntax to access the dataset variables, like {{dataset.metadata.foo}}.

Later prompts

Subsequent prompts can access the output of the previous node by using {{input}}. If the previous node outputs structured data, use dot notation. For example, {{input.bar}}. If the previous node outputs text or unschematized JSON, you can only use {{input}}. If you’re using JSON outputs, consider switching to structured outputs to enable accessing nested output variables with linting and autocomplete.