Sub topic 4
Preparing the target org
This chapter assumes you know basic Salesforce administration (orgs, sandboxes, permission sets), the Salesforce CLI, and the idea of agents, topics, and actions. Deployment succeeds only if the target org already supports everything the agent needs. This chapter covers how to check that before you deploy.
Why readiness comes first
Metadata deployment copies definitions. It does not turn on org-level features. If the target org lacks a feature, the deployment fails, or it succeeds and the agent cannot run. Checking readiness takes a few minutes. Debugging a failed deployment takes much longer.
Use your dependency inventory from the previous chapter as the checklist. For each item, confirm that the target org has it or that your deployment will create it.
Readiness checklist
| Area | What to confirm in the target org |
|---|---|
| Licenses and editions | The org has Agentforce and the required Einstein generative AI licenses |
| Feature enablement | Einstein generative AI and Agentforce are turned on in Setup |
| Data | Data Cloud or other data sources are set up if actions or grounding rely on them |
| Related features | Features the agent uses, such as Service channels or Messaging, are enabled |
| Referenced objects and fields | Custom objects and fields used by actions exist, or are part of your package |
| Users | A user exists to run the agent, and a permission set grants it access |
Feature enablement
In the target org, open Setup and turn on Einstein generative AI and Agentforce. Sandboxes and production orgs do not always share the same settings. A sandbox refreshed before a feature was enabled may not have it. Do not assume the target matches the source.
Referenced objects and fields
Actions often read or update custom objects and fields. Apex classes and Flows that reference a missing field fail to compile on deploy. Either add those objects and fields to your manifest, or confirm that they already exist in the target.
Org-specific references
Some references point to records or settings that differ per org, such as queues, email addresses, or named credentials. Note each one now. You will handle them in the chapter on environment-specific settings.
Checking the target from the CLI
You can compare the two orgs from the command line. First confirm that you are authorized to both:
sf org list
sf org display --target-org target-orgsf org list shows every authorized org with its alias. sf org display shows the target's username, instance URL, and API version. Make sure the target org's API version is at least the version in your manifest. A manifest at version 63.0 cannot deploy to an org that does not support it.
To see which agent-related metadata already exists in the target, list it:
sf org list metadata --metadata-type Bot --target-org target-org
sf org list metadata --metadata-type GenAiPlanner --target-org target-orgAn empty result for a type is normal on a first deployment. If it returns a name that matches your agent, you will overwrite or update that agent. Decide whether that is what you want before you deploy.
Common readiness mistakes
- Deploying to an org where Agentforce is not enabled. The Bot or planner metadata is rejected.
- Forgetting that a Flow or Apex class depends on a custom field that exists only in the source.
- Assuming a sandbox copy has the same licenses as production.
- Skipping the permission set check, so the agent deploys but its actions cannot run.
Exercise
A deployment of your agent to a freshly refreshed sandbox fails, although the same manifest worked in another sandbox. Name two readiness checks you would run first.
Show answer
First, confirm that Einstein generative AI and Agentforce are enabled in Setup of the refreshed sandbox, because a refresh may not carry the setting over. Second, confirm that the custom objects, fields, and other components the agent's Apex classes and Flows reference exist in that sandbox, or are included in the manifest. Also check that the org has the needed licenses.