Skip to main content
Applies to:
  • Plan -
  • Deployment -

Summary

Automate prompt promotion across environments (local → dev → staging → production) using Braintrust API calls in CI/CD pipelines to eliminate manual environment assignments in the UI. The workflow uses prompt versioning via _xact_id transaction IDs and environment-specific assignments through idempotent PUT operations to programmatically manage prompt deployments.

Configuration Steps

Step 1: Configure environments in Braintrust UI

Create your environments (dev, staging, production) in Braintrust UI under Configuration > Environments before using the API.

Step 2: Create or update prompt and assign to environments

Use POST /v1/prompt or PUT /v1/prompt and pass environment_slugs to create the prompt and assign it to one or more environments in a single atomic request. The response includes a _xact_id (transaction ID) identifying the created version.
All environments are validated before the prompt is created — if any slug doesn’t exist, the entire request fails with no prompt created.

Step 3: Assign prompt version to additional environments

Use the environment-object API to promote the prompt version (using _xact_id from Step 2) to additional environments.
The environment-object endpoint is not yet documented in the API reference. Contact support if you need details on this endpoint.

Step 4: Automate promotion workflow

Chain API calls to promote prompts through your SDLC pipeline.