Environments let you maintain different versions of prompts, datasets, and parameters across your development lifecycle. This enables you to:Documentation Index
Fetch the complete documentation index at: https://braintrust.dev/docs/llms.txt
Use this file to discover all available pages before exploring further.
- Maintain version control: Pin stable versions to production while testing new versions in development
- Enable staged deployments: Promote versions through dev/staging/production pipelines
- Support A/B testing: Compare different versions across environments
- Isolate changes: Test modifications without affecting production systems
only available on Pro and Enterprise plans.
Create an environment
Environments are defined at the organization level:- Go to Settings.
- Click Environments.
- Click + Environment.
- Enter a name (e.g., “production”, “staging”, “dev”).
- Click Create environment.
Assign to environments
Prompts
To assign a prompt to an environment:- UI
- API
- Go to Prompts.
- Open the prompt.
- Click the icon.
- Select an environment.
- SDK
- API
Datasets
UsePOST /v1/dataset or PUT /v1/dataset and pass environment_slugs to assign the dataset to one or more environments in a single atomic request. If any slug doesn’t exist, the entire request fails and no dataset is created.
Parameters
To assign a specific parameter version to an environment:- Go to Parameters.
- Open the parameter.
- Click the icon.
- Select an environment.
Promote versions
Move tested versions from development to production:- Test a new prompt or parameter version in the “dev” environment.
- Run experiments to validate performance.
- Once satisfied, assign the same version to “staging”.
- After final validation, assign to “production”.
Monitor environment changes
Set up environment alerts to get notified via webhook or Slack when prompt, dataset, or parameter versions are assigned to or removed from environments. Use these to track deployments, maintain audit trails, or trigger downstream CI/CD workflows.Common patterns
Three-tier deployment
Maintain dev, staging, and production environments:- dev: Latest changes, frequent updates, used by developers.
- staging: Pre-release testing, stable versions.
- production: Customer-facing, only validated versions.
Feature flags
Use environments to control feature rollouts:- Create an environment for each feature flag.
- Assign different prompt, dataset, or parameter versions based on flag state.
- Gradually roll out by changing environment assignments.
A/B testing
Test variations by environment:- Create environments for each variant (e.g., “variant-a”, “variant-b”).
- Assign different prompt, dataset, or parameter versions to each.
- Route users to different environments based on A/B test assignment.
- Compare performance using environment filters.
Next steps
- Write prompts
- Deploy prompts that use environments