Sub topic 1
How an Agentforce Agent Decides What to Do
Prerequisites
Assume you understand Salesforce objects, fields, records, Setup, Lightning Experience, and basic permission sets. You should also know that a large language model generates responses from context and available capabilities.
Runtime decision model
An Agentforce agent uses the user's message, the active topic, topic instructions, conversation history, and available actions to choose its next step. The agent first identifies the user's intent. It then selects a topic whose scope matches that intent. Within the topic, instructions constrain which actions to use and in what order.
An action is a callable capability. It can read data, change data, retrieve Knowledge content, or produce a draft. The action receives inputs and returns outputs that the agent can use in a response or in a later action.
flowchart TD
A[User message] --> B[Select matching topic]
B --> C[Apply topic instructions]
C --> D[Collect action inputs]
D --> E[Run action]
E --> F[Use output or ask for clarification]Topics and instructions
A topic scopes the agent's work. Its classification description helps match user requests, while its instructions define reliable behavior.
For example, an Account Support topic might instruct the agent to:
- Find an account before summarizing or changing it.
- Use a summary action when the user requests an overview.
- Confirm the field and new value before an update.
- Ask for clarification when the name matches zero or multiple records.
Instructions should describe order, safety checks, and conditions. They should not depend on the model guessing hidden business rules.
Actions, inputs, and outputs
Standard actions are Salesforce-provided capabilities. Custom actions can use Flow, Apex, or prompt templates when standard behavior is insufficient.
The agent fills action inputs from the conversation. If a required value is missing or ambiguous, it should ask a question instead of inventing one. The action's output becomes evidence for the next decision. For example, an account lookup can return an Account ID, which a summary action then uses.
> callout tip > Treat action outputs as structured data. Instructions should tell the agent how to handle empty results, multiple matches, and failed actions.
Standard action catalog
| Need | Typical standard action |
|---|---|
| Find a record by name | Identify Record by Name |
| Search records using conditions | Query Records |
| Read a selected record | Get Record Details |
| Explain an account or case | Summarize Record |
| Create or modify Salesforce data | Create or Update Record |
| Answer from trusted content | Knowledge action |
| Prepare customer communication | Draft or revise email |
Choose the narrowest action that satisfies the request. A lookup does not replace a summary, and a summary should not silently update data. Chained actions are useful when each step has a clear input and the next step depends on the previous output.
Exercise
A user asks, “Update Acme’s phone number,” but two accounts match. What should the agent do?
Show answer
Ask the user to identify the correct account. It should not choose a record or update either one.