Sub topic 1
How Agents, Topics, and Actions Fit Together
Prerequisites
Assume you understand Salesforce objects, records, fields, and basic Flow Builder concepts. You should also know that an AI agent interprets a user's natural-language request and chooses a response or operation.
Agents, Topics, and Actions
An Agentforce agent is the conversational layer. It interprets the user's request, selects a relevant topic, and uses available actions to complete the task.
A topic defines a supported area of work, such as Cases or Order Support. It provides guidance about the topic and lists the actions the agent may use. An action is a callable operation, such as finding a case, updating an address, or creating a task.
The relationship is:
The agent decides when an action is relevant. Clear action names, descriptions, inputs, and outputs help the agent make that decision.
Action Types and Why Choose Flow
Agentforce supports several action types, including Flow, Apex, prompt templates, and built-in actions. Choose Flow when the operation mainly uses declarative Salesforce data logic.
Flow is often a good choice because it can:
- Query and update Salesforce records.
- Apply decisions and validation rules.
- Reuse existing Flow Builder skills.
- Expose controlled inputs and outputs without writing Apex.
Choose Apex when you need complex algorithms, custom transactions, or integrations that Flow cannot express cleanly. Choose a prompt template when the main task is generating or transforming text rather than performing record operations.
Autolaunched Flows as the Foundation
An agent action should use an autolaunched flow. This flow starts from an action call instead of a screen, button, or schedule. It receives input variables, performs its logic, and returns output variables.
For example, a case-status action might accept caseNumber, use Get Records to find the Case, and return caseStatus. The flow should not depend on screen components or unprovided user context.
<variables>
<name>caseNumber</name>
<dataType>String</dataType>
<isCollection>false</isCollection>
<isInput>true</isInput>
<isOutput>false</isOutput>
</variables>Designing a Focused Action
Give each action one clear responsibility. “Get Case Status” is easier for an agent to select correctly than “Manage Cases.” Define what the action needs, what it changes, and what it returns. Include a useful result when no record matches or an operation fails.
Exercise
Which design is better for an action: “Update Customer Data” or “Change Case Priority,” and why?
Show answer
“Change Case Priority” is better because it has one clear purpose, a smaller input set, and a predictable result.