Skip to main content
Every change to a prompt creates a new version, and by default your application uses the latest one. A prompt you edit in the UI takes effect immediately, with no redeploy. To control when a change reaches production, pin a version in code or assign versions to environments. As each prompt change creates a new version automatically, you can:
  • Compare performance across versions.
  • Roll back to previous versions.
  • Pin experiments to specific versions.
  • Track which version is used in production.
View version history in the prompt editor and select any version to restore or compare. When saving prompt changes, the update dialog shows a Preview changes section that displays the diff between your changes and the previous version. Large text and object diffs are truncated by default for performance. Click Show more to view the complete diff. Expand Version comment in the update dialog to describe what changed, up to 5,000 characters. The comment is saved with that version. The field isn’t available if your organization has disabled comments, since the comment wouldn’t be visible afterward. The prompt’s Activity tab lists version history alongside any comments. Each entry that created a version shows the version it replaced next to the new one, and you can select either to view or compare it.

Pin a specific version

Every prompt save creates a new version with a unique ID. Pin a version in production code so later saves don’t affect your application until you update the pin. Both ways of using a prompt in code accept a version parameter. To pin a version you invoke on Braintrust:
To pin a version you load and run with your own LLM client:
Without a version parameter, every one of these uses the latest version.
Use bt prompts versions to look up a prompt’s version IDs from the terminal. Both short and decimal transaction IDs are accepted.

Use environments

Environments separate dev, staging, and production configurations. Assign a prompt version to an environment, then load the version assigned to that environment from your code. To assign a prompt to an environment:
  1. Go to Prompts.
  2. Open the prompt.
  3. Click the icon.
  4. Select an environment.
Once assigned, load prompts for that environment in your code:
invoke() does not accept an environment parameter. To execute an environment-pinned prompt server-side via invoke(), resolve the version with loadPrompt() first and pass it to invoke():
This pins the call to the version that was assigned to the environment when loadPrompt() ran. Re-call loadPrompt() if you need to pick up environment reassignments.
Assigning versions to environments is how you manage different versions of a prompt across your development lifecycle. See Manage environments for details on creating and using environments.

Next steps