Prompt snippets in AI Configs
Overview
This topic explains how to use prompt snippets to create, manage, and reuse prompts across AI Config variations.
Prompt snippets are reusable, versioned pieces of prompt text that you manage as standalone resources in LaunchDarkly. Snippets let you define prompt content one time and reuse it across AI Configs and variations.
Create and manage snippets in the Library, and reference them inside variation messages to reuse prompt content. The centralized snippets library helps you maintain consistency across AI Config variations. Snippet versioning lets you update prompt content without losing earlier versions of each snippet.
Use prompt snippets to:
- Reduce duplicated prompts across AI Config variations
- Define and reuse prompt content such as tone, formatting, or governance language
- Identify which AI Configs and variations use a specific snippet
- Track updates to prompt content by version
- Maintain prompt consistency across teams
How prompt snippets work
Each snippet has a name, key, and prompt content, along with versioning information and metadata such as tags, description, and maintainer. You reference snippets using their key and version. When LaunchDarkly evaluates a variation, it resolves these references and returns the fully assembled prompt.
These fields determine how you reference, update, and organize snippets:
- The key identifies the snippet and lets you reference it in variation messages
- The version lets you update prompt content without affecting existing variations
- Metadata helps you organize snippets across your project
Snippets are included as part of an AI Config variation’s message body. When LaunchDarkly evaluates a variation, it replaces the reference with the snippet content and returns the fully assembled prompt to your application. A single message can include multiple snippet references along with other prompt content.
Core functions of prompt snippets
Prompt snippets’ core functions include:
- Editing a snippet creates a new version instead of modifying the existing one
- AI Config variations reference a specific snippet version
- Updating a snippet does not automatically update variations
- Snippets cannot reference other snippets
These behaviors let you update prompt content safely, review changes before applying them, and keep existing variations stable until you choose to update them.
You manage prompt snippets from the Library under AI. The snippets library provides a centralized place to create, view, and update reusable prompts across your project.
View snippets
Use the snippets list in the library to browse, search, and manage snippets across your project.
The snippets list provides a centralized view of all prompt snippets, so you can review existing content, identify reusable snippets, and understand how snippets are organized.
From the snippets list, you can:
- View all snippets in your project in a centralized list
- Search for snippets by name, key, or content
- View snippet details, including versions and usage

Create a snippet
Create a snippet to define reusable prompt content that you can reference across AI Config variations. Use snippets for shared content such as tone, formatting, or common instructions.
To create a snippet from the Snippets tab:
- Navigate to your project.
- In the left navigation, expand AI, then select Library.
- Select the Snippets tab. The snippets list appears.
- Click New snippet. The “Save snippet” dialog appears.
- Enter a name for the snippet. The snippet’s key auto-populates based on the name.
- (Optional) Add a description to help others understand when to use this snippet.
- In the “Body” field, enter the prompt text you want to save as a snippet.
- (Optional) Click the tag icon to add tags to organize snippets across your project.
- Click Create.

You can also create a snippet inline while editing a variation message. To create a snippet this way, read Use snippets in AI Config variations.
After you create a snippet, it becomes available in the snippets library and can be referenced in variation messages. LaunchDarkly creates the snippet at version 1.
Snippet versioning
To edit a snippet, click the snippet in the snippets list. This opens the editing page, where you can update the snippet’s name, prompt content, and metadata.
When you edit a snippet, LaunchDarkly creates a new version instead of modifying the existing one. Previous versions remain available, and variations continue using their current version until you choose to update them.
You must manually update AI Config variations to use new snippet versions.
AI Config variations continue to use the version of a snippet you assigned until you update them to use a different version. For example, if an AI Config variation uses version 1 of a snippet and you update the snippet, creating version 2, the AI Config will continue to use version 1 until you specify otherwise.
Manage snippet usage and versions to understand where snippets are used and control how updates are applied across AI Config variations.
Each snippet includes version history and usage information. Use this information to review how a snippet is used before updating variations to a new version. From the snippet list, you can view all AI Configs and variations that reference the snippet and see which version each variation is using. This helps you understand where a snippet is in use before making changes.
From an AI Config variation, you can compare the current snippet version to the latest version and update the variation to use a newer version. Use this workflow to review how changes affect variations and update them individually as needed.
This approach lets you apply changes intentionally and keep existing variations stable until you update them. Updates are applied when you update individual variations.
Compare snippet versions
You can view and compare versions of a snippet from the snippets list. Here’s how:
- From the snippets list, find the snippet with versions you wish to view.
- Click the version number in the “Versions” column. The “Version history” window appears.
- Click Compare and select two versions to see a code diff of the changes between them.
Delete a snippet
Delete a snippet when you no longer need it and it is not used by any AI Config variations. Here’s how:
-
- From the snippets list, find the snippet you wish to delete.
- Click snippet in the snippets list. The snippet detail page appears.
- Click Delete. The snippet is deleted.
Before deleting a snippet, remove any references to it from AI Config variations. LaunchDarkly prevents you from deleting snippets that are still in use.
Use snippets in AI Config variations
You can use snippets in AI Config variations in two ways:
- Attach existing snippets to a variation
- Create new snippets directly in variation messages
Attach snippets to a variation
Attach snippets from the variation editor to include reusable prompt content in a variation message.
To attach snippets to a variation:
- Navigate to your AI Config.
- Select the Variations tab and open a variation.
- There are three ways to use snippets in messages:
- Click the “Load prompt snippet” button in the variation message body toolbar to open search and find a snippet.
- In the variation message body, use the
{{snippet.}}selector to open search and find a snippet. - Reference a snippet directly using
{{snippet.example-snippet-key#version-number}}.
- Click Review and save.

Create inline snippets in messages
You can also create a snippet directly while editing a variation message.
To create snippets in a message:
- Open a variation and begin editing the message content.
- Click “Save as” in the variation message body toolbar.
- Choose to either save the message body text as a New snippet or New version of existing snippet.
Behavior for in-use variations
You can use prompt snippets in variations that are part of active experiments or guarded rollouts.
If a variation that uses a snippet is part of an active experiment or guarded rollout, updating the snippet version may be blocked. LaunchDarkly blocks these updates to prevent changes that could affect experiment results or rollout behavior. If an update is blocked, LaunchDarkly provides details about the active usage, including which experiment or rollout is affected. Use this information to determine when to update the variation after it is no longer part of an active experiment or rollout.
Audit logs and access control
Prompt snippets use the same access control model as AI Configs, so you can manage access using existing roles and permissions. Access to create, update, and delete snippets follows the same permissions as other AI Config resources.
LaunchDarkly records changes to snippets and their attachments in audit logs. These records show when snippets are created, updated, or attached to variations.
Permissions align with existing AI Config actions. Audit log entries are created for snippet creation, updates, and changes to snippet attachments on variations.
Use audit logs to review changes to snippets and their attachments. This helps you track how snippets change over time and maintain control over changes across AI Config variations.