Sub topic 8
Classifying what went wrong
This chapter assumes you can read a conversation and its reasoning trace, and that you know what topics, actions, instructions, and grounding are in Agentforce. Here you take a poor response and assign it to one cause. The cause decides which fix you try first.
Why classify before fixing
A bad answer can come from several places. If you rewrite instructions when the real problem is a missing knowledge article, the next conversation fails the same way. A short, consistent set of categories keeps reviewers aligned and lets you count failures by type.
The six categories
| Category | What went wrong | Typical evidence in the trace |
|---|---|---|
| Topic | The wrong topic was selected, or no topic matched | The selected topic differs from the one the request belongs to |
| Instruction | The right topic ran, but the steps were vague, missing, or conflicting | The agent skipped a step or invented one |
| Action | The wrong action ran, ran too early, or got bad inputs | An action call with missing or wrong input values |
| Grounding | The answer used stale, incomplete, or irrelevant knowledge | The retrieved content does not contain the stated fact |
| Data | The record or source system held wrong or missing values | The action returned an error, an empty result, or bad values |
| Guardrail | A safety or trust rule blocked or changed a good answer | Masked values, a filtered response, or a refusal |
A walk-through
Take the regression example from earlier in the tutorial. A customer writes, "I want to send back the shoes I bought last week." The agent replies with a delivery date.
- Open the reasoning trace and find the selected topic. It is Order Status.
- Compare it with the request. This is a return, so the topic is wrong.
- Check the topic descriptions. Order Status says "Handle questions about orders," which also covers returns.
The category is topic. Only then do you move to the fix: narrow the scope and name what the topic excludes.
Decision order
Work through the trace from the start of the turn. Stop at the first step that went wrong, because later steps often fail as a result of an earlier one.
Count the failures
Once reviewers tag sessions, a group-by summary shows where to start. This script counts tagged failures and lists the most common category first.
from collections import Counter
# Hypothetical review log. Field names are illustrative.
reviews = [
{"id": "s1", "category": "topic"},
{"id": "s2", "category": "topic"},
{"id": "s3", "category": "grounding"},
{"id": "s4", "category": "action"},
{"id": "s5", "category": "topic"},
]
counts = Counter(r["category"] for r in reviews)
total = len(reviews)
for category, n in counts.most_common():
print(f"{category}: {n} ({n / total:.0%})")Common errors
- Tagging by symptom instead of cause. "Wrong answer" is a symptom, not a category.
- Assigning two categories to one failure. Pick the earliest failing step. Note the second issue separately.
- Blaming instructions for everything. Data and grounding problems cannot be fixed by rewording.
- Reviewing too few sessions. A pattern from three conversations may be chance.
Exercise
A customer asks about the return window. The agent selects the Returns topic, calls no action, and quotes a 60-day window. The knowledge article says 30 days, and the trace shows the agent retrieved an older article that says 60. Which category is this, and why?
Show answer
Grounding. The topic and steps were correct, and no action was involved. The agent answered from a stale retrieved article, so the fix is to update or remove the old article, not to change instructions.
Exercise
The trace shows the right topic and the right action, but the order lookup returned an empty result for a valid order number, and the agent said the order did not exist. Which category applies, and what is the first thing to check?
Show answer
Data (or action, if the inputs were wrong). Check the inputs passed to the action first. If they are correct, the source record or integration is at fault, so the fix lies there and not in the instructions.