Sub topic 1
The monitor-and-improve loop
Prerequisites
This chapter assumes you have:
- Basic familiarity with Salesforce setup and Agentforce concepts: agents, topics, actions, and instructions.
- Built or edited a simple agent in Agentforce Builder.
- An understanding of what an LLM prompt is and what grounding means.
- Comfort reading rates and counts, such as percentages and group-by summaries.
Why an agent needs a loop
An agent that passes your first tests can still fail with real customers. Customers phrase requests in ways you did not predict, data is missing, and topics overlap. Editing the agent on a hunch is risky, because a change that fixes one conversation can break another.
The fix is a repeatable loop. You collect evidence from real conversations, find the cause of a problem, make a small change, test it, and release it. Then you check whether the numbers moved.
The five stages
| Stage | Question it answers | Typical evidence |
|---|---|---|
| Monitor | Is the agent healthy, and where is it weak? | Resolution rate, escalation rate, feedback |
| Diagnose | Why did a specific conversation go wrong? | Conversation transcript and reasoning steps |
| Change | What is the smallest edit that fixes the cause? | Revised topic, instruction, action, or grounding data |
| Test | Does the fix work without breaking other cases? | Regression test set built from real utterances |
| Release | Did the metrics improve after the new version went live? | Metrics before and after the release |
A worked pass through the loop
Suppose you monitor an agent that handles order questions.
- Monitor. A summary of reviewed sessions shows that most escalations come from the Returns topic. Order Status resolves well.
- Diagnose. You open an escalated conversation. The customer wrote, "I want to send back the shoes I bought last week." The agent picked the order topic and gave a delivery date. The cause is topic selection, not the action or the data.
- Change. You narrow the order topic's description to status, tracking, and delivery date, and state that it does not handle returns, refunds, or cancellations.
- Test. You save the failed utterance as a test case. It expects the Returns topic and a reply that asks for the order number or return reason.
- Release. You activate the new version. A week later you check whether escalations in Returns fell.
Each later chapter covers one of these stages in detail.
Principles that keep the loop reliable
- Change one thing at a time. If you edit a topic and an action together, you cannot tell which edit helped.
- Diagnose before editing. The same bad answer can come from a wrong topic, a vague action description, missing knowledge, or an instruction gap. Each has a different fix.
- Keep every failure. A failed real conversation becomes a permanent test case, so the fix is rechecked after every later change.
- Judge by metrics, not by one good conversation. A single success proves little. Compare rates over a comparable period.
What the loop does not do
The loop does not remove the need for human judgment. Metrics tell you where to look, but a person still reads the conversation and decides what the right behavior is. Do not treat a rising resolution rate as proof of quality until you have read a sample of the conversations behind it.
Exercise
A dashboard shows many escalations in the Returns topic. Which loop stage comes next, and why shouldn't you edit the topic instructions right away?
Show answer
The next stage is Diagnose. Open some escalated conversations and read the reasoning steps to find the cause. The same symptom can come from a wrong topic choice, a poorly described action, missing knowledge, or an instruction gap, and each needs a different fix. Editing first risks changing the wrong thing.