Sub topic 6
Writing a manifest for the agent and its dependencies
A manifest is a package.xml file that tells the Salesforce CLI which metadata to deploy. This chapter shows how to write one that covers an Agentforce agent and the components its actions rely on.
Prerequisites
This chapter assumes you can already do the following:
- Work in a Salesforce DX project and run
sfcommands. - Name the agent metadata types:
Bot,BotVersion,GenAiPlanner,GenAiPlugin, andGenAiFunction. - Read your dependency inventory, which lists the Apex classes, Flows, and permission sets the agent's actions use.
You should also have retrieved the agent from the source org, as covered in the previous chapter.
What the manifest must contain
The agent alone is not enough. A deployment fails or produces a broken agent if an action points to an Apex class or Flow that is missing in the target org. The manifest therefore has two groups of entries.
| Group | Metadata types | Why it is needed |
|---|---|---|
| Agent definition | `Bot`, `BotVersion`, `GenAiPlanner`, `GenAiPlugin`, `GenAiFunction` | Defines the agent, its versions, its topics, and its actions |
| Dependencies | `ApexClass`, `Flow`, `PermissionSet` | Provides the logic that actions call and the access that lets the agent user run it |
A starting manifest
Create manifest/package.xml in your project. This version uses wildcards, so it is easy to read and works for a first deployment.
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>*</members>
<name>Bot</name>
</types>
<types>
<members>*</members>
<name>BotVersion</name>
</types>
<types>
<members>*</members>
<name>GenAiPlanner</name>
</types>
<types>
<members>*</members>
<name>GenAiPlugin</name>
</types>
<types>
<members>*</members>
<name>GenAiFunction</name>
</types>
<types>
<members>*</members>
<name>ApexClass</name>
</types>
<types>
<members>*</members>
<name>Flow</name>
</types>
<types>
<members>*</members>
<name>PermissionSet</name>
</types>
<version>63.0</version>
</Package>Each <types> block names one metadata type in <name> and lists the components to include in <members>. The <version> element sets the Metadata API version used for the deployment.
Narrowing wildcards
A wildcard (*) includes every component of that type. For ApexClass, Flow, and PermissionSet, that can mean hundreds of unrelated components. For a real project, replace the wildcards with the specific members from your dependency inventory.
<types>
<members>OrderStatusLookup</members>
<members>OrderStatusLookupTest</members>
<name>ApexClass</name>
</types>
<types>
<members>Update_Case_Priority</members>
<name>Flow</name>
</types>
<types>
<members>Agent_Action_Access</members>
<name>PermissionSet</name>
</types>The names above are examples. Use the API names from your own org. Keep the test classes if your target org requires them for deployment, which production orgs usually do for Apex.
Keeping the manifest honest
Follow these habits so the manifest stays correct as the agent changes.
- Store
manifest/package.xmlin version control next to the source. - Update it whenever you add a topic, action, Apex class, or Flow.
- Retrieve with the same manifest you deploy with. This confirms that every listed component exists in the source org.
- Keep the API version at or above the version of the agent features you use.
sf project retrieve start \
--manifest manifest/package.xml \
--target-org source-orgIf the retrieve command reports a missing component, the manifest names something that does not exist, or it has a typo. Fix it before you try to deploy.
Common mistakes
- Missing dependencies. The agent deploys, but an action fails at run time because its Flow or Apex class was left out.
- Misspelled type names. Metadata type names are case-sensitive.
GenAiPluginis correct andGenaiPluginis not. - Overusing wildcards. Broad wildcards deploy unrelated changes into the target org.
- Forgetting the permission set. The agent user cannot run the actions without it. Chapter details on assigning it come later.
Exercise
Your manifest lists Bot, BotVersion, GenAiPlanner, GenAiPlugin, and GenAiFunction. The deployment succeeds, but an agent action fails when it runs in the target org. Which part of the manifest is the most likely cause, and how would you check it?
Show answer
The dependencies are most likely missing. The action probably calls an Apex class or Flow that is not in the manifest, so it does not exist in the target org. Compare the manifest against the dependency inventory, add the missing ApexClass or Flow members, and run a dry-run deployment to confirm. Also check that the permission set that grants access to the action is included.