Sub topic 13
Diagnosing a failing test
This chapter assumes you can write a test case with an utterance, expected topic, expected actions, and expected outcome. It also assumes you can run a suite and open the per-case results. A failing test does not always mean a broken agent. The test, the agent configuration, or the model's wording can each be the cause. Your job is to find out which.
Start with the first failed check
Each test case checks the topic, the actions, and the outcome. These checks depend on each other. If the agent picks the wrong topic, the actions and the outcome will probably fail too. So read the checks in order and stop at the first one that failed.
| First failed check | Likely cause |
|---|---|
| Topic | Topic description or classification instructions are unclear, or two topics overlap. The expected topic name may also be wrong. |
| Actions | The action is not attached to the topic, its description does not tell the agent when to use it, or the test lists the wrong action name. |
| Outcome | The agent's reply is correct but worded differently, or the instructions let the agent give a wrong answer. |
A diagnosis workflow
Follow these steps for each failure:
- Check the test first. Confirm that the expected topic and action names match the developer names in the agent. A typo or a renamed topic fails every run the same way.
- Compare expected and actual values. The results show what the agent chose next to what the test expected. Note the exact difference.
- Read the agent's reply. If the topic and actions are right but the outcome failed, judge the reply yourself. If a person would accept it, the expected outcome is too strict or too vague.
- Reproduce it in the agent builder. Send the same utterance in the preview and inspect the reasoning and the chosen topic. This shows why the agent routed the request that way.
- Make one change, then rerun. Change one thing at a time so you know which edit fixed the problem.
Deciding where the fix belongs
Fix the test when the expectation is wrong. Examples are a stale topic name, an action the topic never needed, or an outcome that demands exact wording.
Fix the agent when the test describes the behavior you want and the agent misses it. Common fixes:
- Make topic descriptions more distinct so that two topics no longer compete for the same utterance.
- Add or clarify the instruction that tells the agent when to call an action.
- Add a guardrail instruction when an out-of-scope request got an answer.
- utterance: Where is my order 1001?
expectedTopic: Order_Status
expectedActions:
- Get_Order_Status
expectedOutcome: The agent tells the customer the current status of the order.If this case fails on the topic and the agent chose Order_Returns, the fix is likely in the two topic descriptions, not in this case.
Exercise
A test expects topic OrderStatus and action GetOrderStatus. The results show the agent chose topic OrderReturns, and the action check also failed. Which check do you investigate first, and why?
Show answer
The topic check. The agent never entered Order_Status, so it could not call that topic's action. The action failure is a consequence. Check that the test's topic name is valid, then compare the two topic descriptions and reproduce the utterance in the preview.