text value at runtime. Braintrust runs the prompt against its configured model and logs the call, so you can change the wording, model, or parameters from the UI without redeploying your application.
Key advantages:
- Versioned: Every change to a prompt creates a new version, so you can compare, roll back, and pin experiments or production to a specific version.
- Decoupled from code: Update a prompt in the UI and the change takes effect in production immediately, without redeploying your application.
- Controlled: Pin a version in code or assign versions to environments so a change reaches production only when you intend.
- Testable: Iterate in playgrounds, chat with a prompt directly, and optimize it with Loop.
How a prompt reaches your application
- You create a prompt in Braintrust, either in the UI or by defining it in code and pushing it with the
btCLI. Each save creates a new version. - Your application asks for the prompt by slug. It gets the latest version, a version you pinned, or the version assigned to an environment.
- Your application runs it, either by invoking it on Braintrust, where Braintrust calls the model and logs the result, or by loading it and building the messages locally to call with your own LLM client.
Prompt anatomy
A prompt is made up of the following parts:- Name and slug: A display name plus a slug (a stable identifier you reference from code that stays constant across updates).
- Model and parameters: The model to call and settings like temperature and max tokens.
- Messages: System, user, assistant, or tool messages containing text or images.
- Templating: Mustache or Nunjucks syntax that injects variables into messages at runtime.
- Response format: Freeform text, a JSON object, or a structured JSON schema.
- Tools and MCP servers: Functions or MCP servers the model can call during execution.
Where to go from here
- Create prompts in the UI or SDK, add tools and MCP servers, and optimize them with Loop.
- Use templating to inject runtime variables with Mustache or Nunjucks.
- Use prompts in code by invoking them by slug, building them locally, handling tool calls, and calling the REST API.
- Version prompts by pinning versions and assigning them to environments.
- Manage prompts by duplicating them and customizing the Prompts page.