Sub topic 10
Improving actions and action descriptions
This chapter assumes you can build a simple agent in Agentforce Builder and know what topics, actions, and instructions are. It also assumes you can read a conversation's reasoning trace, which an earlier chapter covered. Here you fix failures where the agent picked the wrong action, skipped an action, or called one with bad inputs.
How the agent chooses an action
An action is a capability the agent can call, such as an order lookup. The model reads the topic's instructions and the descriptions of its actions, then decides which action to call and what values to pass as inputs. It does not see your flow or Apex code. The descriptions are what it sees.
This means most action failures are description failures. A vague name or description gives the model too little to decide with.
Common action failures
| Symptom in the trace | Likely cause | Typical fix |
|---|---|---|
| No action called, the agent answers from general knowledge | Description does not match how customers phrase the request | Describe when to use the action in the customer's terms |
| Wrong action called | Two actions have overlapping descriptions | State what each action does and does not do |
| Action called with an empty or guessed input | Input description is unclear, or nothing tells the agent to ask for it | Describe the input format and add an instruction to ask first |
| Action returns data but the reply ignores it | Output fields are poorly described | Describe each output field and what it means |
| Action fails with an error | Data or permissions problem, not a description problem | Check the flow or Apex and the running user's access |
Rewriting a description
Compare two descriptions of the same lookup action.
BEFORE (action description)
Gets order information.
AFTER (action description)
Looks up the current status, tracking number, and estimated delivery date of an existing order. Use only when the customer asks where an order is or when it will arrive. Does not process returns, refunds, or cancellations.
AFTER (input: orderNumber)
The order number the customer gave, for example "00012345". Ask the customer for it if it has not been provided. Do not guess.The new version says what the action returns, when to use it, and what it excludes. The input description tells the agent to ask rather than invent a value.
Working through a case
Suppose reviewed sessions show that "Where is my package?" often gets a generic answer with no lookup. The trace shows the Order Status topic was selected, but no action ran. The old description, "Gets order information," never mentions packages or delivery. You add the customer's wording ("where is my package", "when will it arrive") to the description. You then add an instruction to ask for the order number first.
Change one thing at a time where you can. If you edit three descriptions at once and the result improves, you cannot tell which edit helped. Save the failed conversation as a regression test case so you can recheck it after later changes.
Exercise
The trace shows an agent called a "Get Order Info" action for a customer who wanted to cancel an order. The action was never meant to handle cancellations. Name two changes that would reduce this error.
Show answer
Rewrite the action description to say what it does (status and delivery lookups) and that it does not handle cancellations. Also make sure the cancellation request is covered by a different topic or action, with a description that uses the customer's wording, such as "cancel my order". Then add the failed conversation to the regression test set.
Exercise
An action is called, but the trace shows the order number input was filled with "my order". Which part do you edit first?
Show answer
Edit the input's description to give its format and an example, and add an instruction telling the agent to ask for the order number if the customer has not given one. Do not guess a value.