Sub topic 2
What you are testing: topics, actions, and instructions
This chapter assumes you know how to open Agent Builder and that you have seen an Agentforce agent respond in the preview panel. You do not need to have written a test yet. The goal is to name the parts of an agent that a test can check, so that later chapters on test cases make sense.
The three building blocks
An Agentforce agent is configured from three kinds of parts. Each one is a place where behavior can go wrong.
- Topics group related work. A topic has a name, a description, and a scope. The description tells the agent's reasoning engine when the topic applies.
Order_Statusmight cover questions about where an order is. - Actions are the things the agent can do inside a topic. An action can run a Flow, call an Apex method, or call a prompt template.
Get_Order_Statusmight look up an order record and return its status. - Instructions are plain-language rules attached to a topic. They tell the agent how to behave, for example "Always ask for the order number before looking up an order."
How a request moves through them
When a customer sends a message (an utterance), the agent works in a fixed order. It first picks a topic. Inside that topic, it reads the instructions and chooses which actions to run. It then writes a reply from the action results.
Each step can fail on its own. The agent can pick the wrong topic. It can pick the right topic but skip an action. It can run the right action and still write a reply that misses the point.
Which part each test assertion checks
The Testing Center lets you assert on the steps above. The table shows how they line up.
| Building block | What can go wrong | What a test checks |
|---|---|---|
| Topic description | The agent routes the request to the wrong topic | The expected topic |
| Action definition | The agent skips an action or runs the wrong one | The expected actions |
| Instructions | The reply ignores a rule, or the tone is wrong | The expected outcome |
Instructions are not asserted directly. You see their effect in the actions that run and in the final reply, so most instruction problems appear as an action or outcome failure.
Why this matters for debugging
When a test fails, the failing assertion points you at one building block. A wrong topic means you should look at topic descriptions and scope. A missing action means you should look at the action's description and the instructions that call for it. A wrong reply with the right topic and actions usually points at instructions or at the data the action returned.
A small example
Suppose an order support agent has one topic, Order_Status, with one action, Get_Order_Status, and this instruction: "If the customer does not give an order number, ask for it before running any action."
For the utterance "Where is my order 1001?", you expect:
- Topic:
Order_Status. - Action:
Get_Order_Status. - Reply: tells the customer the status of order 1001.
For "Where is my order?", the same instruction changes the expected result. No action should run yet, because the agent should ask for the number first. The topic is the same. Only the actions and outcome differ, and that difference comes from the instruction.
Exercise
A test expects the topic OrderStatus and the action GetOrderStatus. The agent picks OrderStatus but runs no action, and the reply asks the customer a clarifying question. Which building blocks should you inspect first?
Show answer
Inspect the instructions on OrderStatus and the description of GetOrder_Status. The topic was routed correctly, so the topic description is not the cause. The agent may be following an instruction that asks for more information before acting, or the action description may not make clear when to run it.