Sub topic 1
What you are deploying: agents, topics, and actions
An Agentforce agent is more than one record. Before you move one between orgs, you need to know which parts it has and which of those parts carry over in a deployment. This chapter covers the parts and how they relate. Later chapters cover the metadata types, retrieval, and deployment commands.
Prerequisites
This chapter assumes you already have:
- Basic Salesforce administration skills: orgs, sandboxes, profiles, and permission sets.
- Familiarity with Agentforce concepts: agents, topics, and actions.
- Basic Salesforce CLI usage and Salesforce DX project structure.
- A basic understanding of Apex classes and Flows as agent actions.
The three building blocks
An agent is built from topics, actions, and instructions. Each one has a different job.
- Agent: The top-level definition. It holds the agent's name, its role, and the agent user it runs as. It also holds the list of topics it can handle.
- Topic: A category of work, such as order status or password help. A topic has a description that the agent uses to decide whether a request belongs to it. It also has instructions and a set of actions.
- Action: A task the agent can run. An action points to something that already exists in the org, such as an Apex class, a Flow, or a prompt template.
- Instructions: Natural-language text that guides how the agent behaves. They are written at the agent level and inside each topic.
How a request flows through the parts
When a user sends a message, the agent does not run every action. It first picks a topic, then picks an action inside that topic.
The topic description decides which topic is chosen. The action description decides which action is chosen. Both descriptions are text, and both travel with the agent when you deploy it.
What moves and what does not
The agent, its topics, and its action definitions are metadata. Metadata is configuration that you can retrieve and deploy. The things the actions call are also metadata, but they are separate components. The agent definition only refers to them by name.
| Part | Where it lives | Moves with the agent automatically? |
|---|---|---|
| Agent definition | Agent metadata | Yes, if you include it in the deployment |
| Topics and instructions | Agent metadata | Yes, if you include it in the deployment |
| Action definitions | Agent metadata | Yes, if you include it in the deployment |
| Apex classes, Flows, prompt templates | Their own metadata types | No, you must add them |
| Permission sets | Their own metadata type | No, you must add them |
| Data the actions read | Records in the org | No, metadata deployment never moves records |
A common mistake is to deploy only the agent and expect it to work. The deployment may fail because a referenced Flow is missing. It may also succeed and then fail at run time because a permission set is missing.
Why this matters for deployment
The split between the agent and its dependencies shapes the whole process. You will need to:
- Identify the metadata types that make up the agent.
- List every Apex class, Flow, and permission set the actions use.
- Put all of them in one manifest.
- Check the target org for the features and settings the agent needs.
Skipping step 2 causes most failed deployments.
Exercise
A teammate deploys an agent whose topics include an action that calls a Flow named CheckOrderStatus. The Flow is not in the deployment. What is the likely outcome, and why?
Show answer
The deployment is likely to fail, or the action will not work in the target org. The action definition only refers to the Flow by name. The Flow is a separate metadata component, so it must be included in the deployment or already exist in the target org.
Exercise
Which part of an agent does the agent use to decide whether a user request belongs to a topic?
Show answer
The topic description. The agent compares the request with each topic's description and picks the best match. Then the topic's instructions and actions apply.