Environments
Environments in Braintrust allow you to manage different versions of prompts across your development lifecycle. You can pin specific versions of prompts to environments like development, staging, and production, enabling controlled deployment and testing workflows.
Overview
An environment is a named collection that associates specific versions of prompts with a deployment context. This enables you to:
- Maintain version control: Pin stable prompt versions to production while testing new versions in development
- Enable staged deployments: Promote prompt versions through dev/staging/production pipelines
- Support A/B testing: Compare different prompt versions across environments
- Isolate changes: Test prompt modifications without affecting production systems
Currently, environments work with prompts only.
Create environments
Environments are configured through the Braintrust UI in your organization settings. Each environment has:
- Name: A human-readable name (e.g., "Development", "Production")
- Slug: A unique identifier used in API calls (e.g., "dev", "prod")
- Description: Optional details about the environment's purpose
To create an environment:
- Navigate to your organization settings
- Go to the Environments section
- Click Add Environment
- Enter the name, slug, and optional description
- Save the environment
Associate prompts with environments
Once you have environments set up, you can associate specific versions of prompts with them. This creates a mapping that tells Braintrust which version of a prompt to return when queried with an environment parameter.
You can make the association using the audit log on the bottom of the prompt detail interface.
Load prompts with environments
Using the SDK
The Braintrust SDK supports loading prompts with environment parameters:
Using the REST API
You can load prompts with environment parameters directly via HTTP: