Sub topic 1
Where Actions Fit in an Agentforce Agent
Prerequisites
Assume you understand Salesforce objects, fields, records, permissions, and the basic structure of an Agentforce agent: topics describe areas of work, and actions perform work within those topics.
Actions, Prompts, and Templates
An Agentforce agent uses topics to classify a request and provide instructions. An action is a callable operation that performs a task, such as retrieving records, running Flow, invoking Apex, or generating text.
A prompt template is a reusable instruction pattern for a large language model (LLM). It combines fixed instructions with record data and other resources. When exposed as an agent action, the template generates a response when the topic tells the agent to call it.
Agent instructions decide when and why to use an action. The prompt template decides how to generate the action's text.
Prompt Builder and Template Types
Prompt Builder is Salesforce's workspace for creating, testing, and managing prompt templates. A template usually contains a role, task, input data, output rules, and safety constraints.
Choose a type based on the output and its context:
| Template type | Best fit |
|---|---|
| Record Summary | Summarizing one record |
| Field Generation | Producing text for a field |
| Sales Email | Drafting an email about a record |
| Flex | Supporting a custom input and output pattern |
A Flex template is useful when the required input or output does not match a more specialized type. For example, a case hand-off can accept a Case record and return a short summary.
You are a service assistant. Summarize this case in five sentences or fewer.
Case number: {!$Input:Case.CaseNumber}
Subject: {!$Input:Case.Subject}
Status: {!$Input:Case.Status}
Description: {!$Input:Case.Description}
Use only the supplied information. Mark missing information as unknown.Inputs, Resources, and Merge Fields
An input resource is data supplied to a template, such as a record, a field, or free text. A merge field is a placeholder that inserts a value into the prompt at runtime. In the example, {!$Input:Case.Subject} inserts the selected Case's subject.
Grounding means giving the model trusted context before generation. Use only the fields needed for the task, define what happens when data is missing, and limit the requested output. Related records, Flow results, or Apex-provided data can become additional resources.
Exercise
A user asks an agent to summarize an existing Case. Which component determines whether the summary action should run?
Show answer
The topic's scope and instructions determine when to call the action. The prompt template determines how the Case data becomes the summary.