Sub topic 1
Where actions fit in an Agentforce agent
Prerequisites
This chapter assumes you know the following:
- The Salesforce data model: objects, fields and records.
- Setup basics, including permission sets.
- What an Agentforce agent is, and that it groups its work into topics.
- Basic prompting for large language models (LLMs).
You don't need to have built a prompt template yet. The later chapters cover that.
The parts of an agent
An Agentforce agent is built from a few layers. Each layer has one job.
- Agent: The assistant the user talks to. It has a role, a tone and a channel.
- Topic: A group of related work. A topic has a classification description, a scope and a list of instructions.
- Instruction: A natural-language rule inside a topic. It tells the agent how to behave and when to use an action.
- Action: A unit of work the agent can run. It reads data, changes data or generates text.
The agent's reasoning engine does the routing. When a user sends a message, the engine reads the classification descriptions and picks the best topic. Inside that topic, it reads the instructions and the list of available actions. Then it decides whether to answer directly or to run an action.
What an action is
An action is a defined task with named inputs and named outputs. The agent supplies the inputs, the action runs, and the agent receives the outputs. The agent can then use those outputs in its reply.
Actions exist because an LLM on its own can't read your org's records or change them. An action gives the agent a controlled way to do that.
Action types
Agentforce supports several kinds of action. They differ in what runs behind the action.
| Action type | What runs | Typical use |
|---|---|---|
| Flow | An autolaunched Flow | Update a record, run a business process |
| Apex | An invocable Apex method | Custom logic or a callout |
| Prompt template | A prompt template from Prompt Builder | Generate text from record data |
| Standard action | A prebuilt action from Salesforce | Common tasks such as answering with knowledge or querying records |
This tutorial focuses on the prompt template type. Its job is to generate text, such as a summary, an email draft or a recommendation. It does not create or update records by itself. If the agent must save the text, pair the template with a Flow or Apex action.
Prompt template, instructions and action
Three things are easy to confuse.
- Agent and topic instructions guide the agent's decisions. They say when to run an action and how to behave. They are read by the reasoning engine at run time and do not take record data as merge fields.
- A prompt template is a stored prompt with placeholders called merge fields. Salesforce fills them with record data, sends the finished prompt to an LLM and returns the text.
- A prompt template action is the link between the two. It adds a template to a topic so the agent can call it.
So instructions decide whether and when to call. The template decides what text is generated and from which data.
A worked picture
Suppose a support agent has a topic named Case Hand-off. One instruction says: when the user asks for a case summary, ask for the case number if it is missing, then use the Summarize Case action.
A user writes, "Summarize case 00001042 for my call." The reasoning engine picks Case Hand-off and finds the case. It calls Summarize Case with that case as input. The template pulls the subject, status and description, builds the prompt and returns a short summary. The agent shows it to the user.
If the agent never calls the action, check two places first. Look at the topic's classification description and scope, and look at the instruction that names the action. The next chapters show how to write both.
Exercise
A team wants an agent to write a follow-up email from case data and then store the email on the case. Which action types would you combine, and why?
Show answer
Use a prompt template action to generate the email text, and a Flow or Apex action to save it on the case. A prompt template action only generates text. It does not update records.