Sub topic 9
Adding standard actions
This chapter assumes you have created an agent in Agentforce Builder and given it at least one topic with instructions. You should also have the permission sets from the earlier chapter assigned to your user. Menu labels in Agentforce change between releases, so treat the names below as the ones you are most likely to see and match them by meaning if yours differ.
What a standard action is
An action is a unit of work an agent can perform. Topics decide what the agent is allowed to talk about. Actions decide what it can do about it. Without actions, the agent can only reply with text generated from its instructions.
Salesforce supplies standard actions in a library. They are prebuilt and maintained by Salesforce, and they cover common CRM work. Examples you will usually find include:
- Identify Record by Name, which searches for a record from a name the user typed.
- Query Records, which retrieves records for an object using fields and filters.
- Summarize Record, which produces a text summary of a record.
- Update Record, which changes field values on a record.
- Answer Questions with Knowledge, which answers from Salesforce Knowledge articles when Knowledge is set up.
- Draft or Revise Email, which composes email text.
Which actions appear depends on your org's features, your release, and which clouds are enabled. A Developer Edition org may not show every action you see in documentation. If an action is missing, that is normally a feature or license gap, not an error in your agent.
The other kinds of action are custom Apex actions, Flow actions, and prompt template actions. Standard actions are the fastest to add because you configure nothing in code. The cost is less control. You cannot change what a standard action does internally, only when the agent calls it and what you pass in.
Anatomy of an action
Every action, whatever its type, has the same parts. The agent's reasoning engine sees these parts and uses them to decide whether to call the action.
| Part | Purpose | Who writes it |
|---|---|---|
| Name | Label shown in the builder and used by the planner | Salesforce (standard), you (custom) |
| Description or instructions | Tells the planner when the action applies | You can edit this on the agent's copy |
| Inputs | Values the action needs, such as a record ID or a search term | Defined by the action |
| Outputs | Values the action returns | Defined by the action |
| Target | What actually runs: a Flow, Apex, or a prompt template | Defined by the action |
The planner never runs your logic itself. It reads the topic instructions and the action descriptions, picks an action, fills in the inputs from the conversation, runs it, and then reads the outputs to compose a reply.
Adding an action to a topic
Actions belong to a topic. An action added to one topic is not available in another unless you add it there too. This keeps the planner's choices small, which makes its choices more reliable.
- Open Agentforce Builder and open your agent.
- Select the topic that needs the action.
- In the topic's Actions section, choose to add an action. In newer builder versions this opens the action library, sometimes labeled as an asset library.
- Filter or search for the standard action you want, such as Query Records.
- Select it and confirm. Fill in any configuration the builder asks for.
- Save the topic.
After adding an action, open it and read its instructions and inputs. Do not assume the defaults suit your use case.
Writing action instructions that work
The planner picks actions mostly from text. If two actions have vague or overlapping descriptions, it may choose the wrong one or skip both. These habits help:
- Say when to use the action, not only what it does. "Use when the user gives an account name and you need its record ID" is better than "Finds accounts".
- Say what must be true before the call. "Do not call until the user has named an account."
- Tell the planner how to handle inputs. For each input you can usually choose whether the agent should collect it from the user or take it from conversation context.
- Keep one job per action. If you need two behaviors, add two actions.
Topic instructions should refer to actions by their names so the planner connects the two. Here is a topic that uses a standard action to find the account, then a second action to read case data. The second action is the custom Apex action you will write in the next chapter.
Topic: Case Status Questions
Description: Answer questions about the status of a customer's support cases.
Instructions:
1. If the user has not named an account, ask which account they mean.
2. Use the Identify Record by Name action to find the account from the name.
3. If Identify Record by Name finds no match or several matches, ask the user to clarify. Do not pick one yourself.
4. Once you have one account, look up its open cases and report the count in one sentence.
5. If the user asks about anything other than case status, say you cannot help with that.Steps 2 and 3 show a pattern worth copying. Always tell the agent what to do when an action returns nothing or too much. If you leave this out, the model may invent a plausible answer.
Chaining actions
A common design is one action that finds a record and a second that works on it. The first action's output, such as a record ID, becomes an input to the second. The planner passes the value along as long as the output and input are clearly related and the instructions say to chain them.
Chaining fails in predictable ways:
- The first action returns a name or label, but the second needs an ID.
- The user's wording is ambiguous, so the first action returns several records and the planner picks the wrong one.
- The topic instructions never mention the order, so the planner calls the second action first with an empty input.
State the order in numbered steps, as in the example above.
Access and security
Actions run with the access of the agent's running user, not the person chatting. For an internal service agent, that is the user the agent runs as. If that user cannot see the Case object, Query Records returns nothing, and the agent may report "no results" when the real cause is missing access. Check field-level security and object permissions on that user before concluding an action is broken.
Update Record and similar actions change real data. In a Developer Edition org that risk is small. In a production org, restrict these actions to topics that truly need them, and write instructions that require confirmation from the user before the write.
Common errors
| Symptom | Likely cause | Fix |
|---|---|---|
| Action is not in the library | Required feature or license is not enabled in the org | Check the feature in Setup, or choose a different action |
| Agent never calls the action | Action is on a different topic, or the topic instructions never mention it | Add the action to the active topic and name it in an instruction |
| Agent calls the wrong action | Two actions have overlapping descriptions | Rewrite the descriptions to separate their cases |
| Agent asks for something it already knows | Input is set to be collected from the user | Change the input to use conversation context, where available |
| Action returns empty results | The running user lacks access, or the filter is wrong | Test the same query as that user, and check permissions |
| Agent invents an answer after an empty result | Instructions do not cover the empty case | Add a step that says what to say when nothing is found |
You will see how to read these failures in the conversation preview in the testing chapter. For now, the key habit is to add one action at a time and test after each addition. If you add five actions and the agent misbehaves, you will not know which one is responsible.
Exercise
Your agent has a topic with two actions, Identify Record by Name and Query Records. In testing, the agent often calls Query Records first with no filter and returns unrelated records. Name two changes you would make to fix this, and say where each change goes.
Show answer
First, edit the topic instructions to state the order in numbered steps: use Identify Record by Name first, then use Query Records with the returned ID. Second, edit the Query Records action's instructions to say it must not be called until a record ID is known, and to use the ID as a filter. Optionally, rewrite the Identify Record by Name description so the two descriptions no longer overlap. The topic instructions control sequence, and the action instructions control the preconditions for each call.
Exercise
A user asks your agent for the status of their account's cases. The agent replies that there are no open cases, but you can see open cases when you log in as an admin. List two things to check before deciding the action is broken.
Show answer
Check whether the agent's running user has object permissions on Case and field-level access to the fields the action reads, because actions run with that user's access. Then check that the record the agent identified is the account you expect, since a wrong or ambiguous match from Identify Record by Name would return the wrong account's cases.