Sub topic 13
Deploying and versioning flow-based actions
This chapter assumes you can build an autolaunched flow, register it as an action in Agent Builder, and use Salesforce CLI or change sets at a basic level. It covers how to move a flow-based action between environments and how to change it without breaking the agent.
What you are deploying
A flow-based action is several pieces of metadata that reference each other. The flow does not carry its own registration.
| Piece | Metadata type | Notes |
|---|---|---|
| The flow | `Flow` | Variables, logic, and the active version |
| The action | `GenAiFunction` | Points to the flow and holds the action instructions |
| The topic | `GenAiPlugin` | Lists the actions the topic can use |
| Permissions | `PermissionSet` | Access to the objects and fields the flow touches |
If you deploy the topic without the flow, the deployment fails on a missing reference. Include every piece in the same deployment.
How flow versions affect the agent
Each save in Flow Builder creates a new version, and only one version is active. The action calls the flow by API name and runs the active version. Two consequences follow.
- Activating a new version changes the agent's behavior at once. You do not edit the action.
- The agent and the flow share a contract: the variable names, data types, and descriptions. If a new version renames
caseNumberor changes its type, the action's input settings no longer match.
Deploying with a manifest
This package.xml lists the pieces for the Get Case Status action. Adjust the member names to match your org.
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>Get_Case_Status</members>
<name>Flow</name>
</types>
<types>
<members>Get_Case_Status</members>
<name>GenAiFunction</name>
</types>
<types>
<members>Case_Support</members>
<name>GenAiPlugin</name>
</types>
<types>
<members>Agent_Case_Access</members>
<name>PermissionSet</name>
</types>
<version>62.0</version>
</Package>Deploy it with Salesforce CLI:
sf project deploy start --manifest manifest/package.xml --target-org my-sandboxActivation in the target org
A deployed flow is not always active in the target org. Check Process Automation Settings in Setup. If the setting to deploy flows as active is off, the new version arrives inactive and the agent keeps using the older version, or fails if none exists. Production also requires Apex test coverage for flows that run DML, so plan for that before release day.
Practical rules for versioning
- Treat variable names, types, and descriptions as an interface. Change them rarely, and test the agent whenever you do.
- Add new optional inputs instead of changing existing ones.
- Keep the previous version. Reactivating it is the fastest rollback.
- Describe each version in its flow description so reviewers can tell what changed.
- Re-run your agent preview test conversations after every activation, in every org.
Exercise
You deploy a new version of the GetCaseStatus flow to production, and the agent still answers with the old behavior. Name two likely causes and how you would check each.
Show answer
First, the new version arrived inactive because Process Automation Settings did not deploy flows as active. Open the flow in Flow Builder and check which version is active, then activate the new one. Second, the action or topic metadata was not deployed, or points to a different flow name. Compare the GenAiFunction and GenAiPlugin in the target org with the sandbox, then rerun your test utterances in agent preview.