This topic explains how to use prompt snippets to create, manage, and reuse prompts across AgentControl 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 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 config variations and quickly find a snippet you wish to use again. Snippet versioning lets you update prompt content without losing earlier versions of each snippet.
Use prompt snippets to:
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:
Snippets are included as part of a 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.
Prompt snippets’ core functions include:
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.
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:

Create a snippet to define reusable prompt content that you can reference across config variations. Use snippets for shared content such as tone, formatting, or common instructions.
To create a snippet from the Snippets tab:

New snippets appear in the library’s “Snippets” tab.
You can also create a snippet inline while editing a variation message. To create a snippet this way, read Use snippets in config variations.
New snippets start at version 1. When you edit a snippet, LaunchDarkly creates a new version of that snippet instead of modifying the existing one. Previous versions remain available, so you can refer back to them or use them again if needed.
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.
Config variations continue to use the version of a snippet you assigned until you update them to use a different version. For example, if a config variation uses version 1 of a snippet and you update the snippet, creating version 2, the 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 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 config 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 a 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.
You can view and compare versions of a snippet from the snippets list. Here’s how:
Delete a snippet when you no longer need it and it is not used by any config variations. Here’s how:
Before you delete a snippet, remove any references to it from config variations. LaunchDarkly prevents you from deleting snippets that are still in use.
You can use snippets in config variations in two ways:
Attach snippets from the variation editor to include reusable prompt content in a variation message.
To attach snippets to a variation:
{{snippet.}} selector to open search and find a snippet.{{snippet.example-snippet-key#version-number}}.
You can also create a snippet directly while editing a variation message.
To create snippets in a message:
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.
Prompt snippets use the same access control model as AgentControl configs, so you can manage access using existing roles and permissions. Access to create, update, and delete snippets follows the same permissions as other AgentControl 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 AgentControl 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 AgentControl config variations.