Sub topic 11
Versions and activation
This chapter assumes you have built a prompt template in Prompt Builder and added it to a topic as an agent action. It covers how to change that template without breaking the agent that uses it.
Why versions exist
An agent action points at a prompt template. If you edited the live text directly, every change would reach customers the moment you saved it. Prompt Builder avoids this by storing each template as a set of versions. A version holds the template body, the model choice and the resource settings. Each version is either a draft or active.
- A draft version can be edited, previewed and saved as often as you like.
- An active version is the one the template uses when something calls it. Only one version of a template is active at a time.
- Once a version has been activated, treat it as fixed. To change it, create a new version from it and edit that copy.
The version lifecycle
The two arrows to Draft mean the original version stays untouched. You work on the copy while the active version keeps serving requests.
A safe change workflow
Follow these steps whenever the output of a live template needs to change.
- Open the template in Prompt Builder and clone the active version. The clone is a new draft.
- Edit the draft. Change the instructions, the merge fields or the model.
- Preview the draft with real records. Test a case with full data and one with missing fields, because the template rules tell the model to say "unknown" when data is absent.
- Activate the draft. The previously active version becomes inactive.
- Test the agent in Agent Builder with the same kind of request a user would send. A template that previews well can still behave differently in the agent, because the agent supplies the inputs.
Keep the old version. If the new one misbehaves, reactivate the old version. Rollback then takes one action, with no rebuild.
What the agent sees
The action in the topic references the template, not a specific version. When you activate a new version, the agent starts using it without any change to the topic, the instructions or the action mapping. This has two consequences.
- Activation is a production change for every agent, flow or Apex class that calls the template. Check where the template is used before you activate.
- If the new version changes which inputs it needs, the action's input mapping can break. Keep the input resources (for example
Input:Case) the same across versions unless you plan to update the action at the same time.
Moving templates between orgs
Build and test in a sandbox, then deploy to production. Prompt templates are metadata, so you can move them with change sets, the Metadata API or Salesforce DX source deployment. The metadata type is GenAiPromptTemplate. Deploy the template together with the things it depends on, such as a Flow or Apex class used as a resource, and the agent components that reference it.
Common errors
| Symptom | Likely cause | Fix |
|---|---|---|
| Edit button is unavailable on a version | The version is active or has been activated before | Clone it into a new draft |
| Agent output did not change after you saved edits | The edited draft was never activated | Activate the draft |
| Action fails after a new version goes live | The new version changed its required inputs | Restore the earlier inputs, or update the action mapping |
| Template works in a sandbox but not in production | A dependency was missing from the deployment, or the wrong version is active | Deploy the dependencies and check the active version |
Exercise
A support team's Summarize Case template is live and used by an agent. You want to add the rule "Mention the case priority." Describe the steps that avoid disrupting the agent, and what you do if the change makes summaries worse.
Show answer
Clone the active version to create a draft, add the rule and the Priority merge field to the draft, and preview it with several real cases, including one with missing data. Activate the draft, which deactivates the old version, and then test the agent in Agent Builder. If summaries get worse, reactivate the previous version. Keep the same input resource (Input:Case) so the action mapping does not break.