Lesson 9.4: Improving agents from feedback and evaluation data
Learn how to turn feedback and test results into a better agent: diagnosing causes, choosing levers, proving a change helped and avoiding regressions.
By the end of this lesson you will be able to collect feedback from users, reviewers and outcomes, link each piece to the trace that produced it, diagnose the cause of a failure, choose the right lever to fix it, work out how much data you need to prove that a change helped, and run an improvement cycle that does not undo earlier gains. You will work out that detecting an improvement from 80 to 85 per cent needs about 902 test runs for each version, a 2-point improvement needs about 6,029, and a 10-point one only 196, and that fixing a quarter of the remaining failures each cycle takes a 20 per cent failure rate to 6.3 per cent in four cycles and needs five to reach 5 per cent. You should have read Lessons 7.1, 7.4, 8.2 and 9.1 to 9.3. No code is needed. The mathematics is a square root, percentages and powers.
An agent that goes live is not finished. Users will ask things you did not expect. The tools will change. The world will move. An agent that is not improved will, over time, get worse relative to what it should do. The question is how to improve it deliberately and safely, with evidence, and not by tinkering whenever someone complains. This lesson describes a loop that turns what happens in use into better behaviour, and the traps that make teams believe they are improving when they are not.
The improvement loop
The loop has seven steps, and each of the earlier lessons supplied part of it.
1. Collect signals from real use and from tests.
2. Link each signal to the trace that produced it.
3. Diagnose the cause of the failures that matter most.
4. Choose a change from the levers available, and form a hypothesis: "this change will fix that cause".
5. Test the change offline against the evaluation suite, including regression checks.
6. Release it in stages, as Lesson 8.4 described, and watch it.
7. Confirm from real use that it worked, and record what you learned.
Then go round again. The loop works only if each step is done, and most teams skip a few: they collect and diagnose, make a change and ship it without a proper test, or they ship and never confirm.
Step one: sources of feedback
Feedback comes from several places, and each has strengths and blind spots.
Explicit user feedback. Thumbs up or down, a rating, a comment, a report. It is direct, and sparse: most users never give it. Those who do are not typical, since they are the happiest and the angriest.
Edits. When a person changes the agent's draft before sending, the change is feedback. It is richer than a rating. It shows what the agent got wrong and what the right answer looked like. Keep the original and the edited version together.
Approvals and rejections. In a human-in-the-loop design, as in Lesson 6.3, each decision is a signal, especially with a reason code such as "wrong amount" or "missing evidence".
Behaviour. The user rephrased and asked again, abandoned the conversation, asked for a person, or used the answer without change. These are implicit signals and often more honest than ratings. They are also ambiguous: a user who leaves may be satisfied or frustrated.
Outcomes. What happened afterwards. A refund was later reversed. A ticket was reopened. A customer called back. A payment failed. Outcomes are the truest signal and often arrive late.
Reviews. The weekly reading of sampled traces by a person, as Lesson 8.2 advised. This finds problems that ratings do not.
Automated checks. The graders from Lesson 7.1, run on live traffic samples, and monitors of cost, errors and caps.
Test results. The evaluation suite, run on every candidate.
A good system draws on several. No single source is complete: ratings miss silent failures, outcomes arrive late and reviews are small in number.
Step two: capture it well
Feedback is useful only if you can act on it. Three rules.
Link every piece of feedback to its trace. A thumbs-down that cannot be traced to the run that caused it tells you almost nothing. Store the trace ID with each rating, edit, approval and outcome, so that you can open the run and see what the agent saw and did.
Capture the reason where you can. A thumbs-down with a reason code, such as "wrong information", "did not do what I asked", "too slow" or "tone", can be counted and sorted. Keep the options few so people use them. Free text is richer and takes more work to analyse.
Keep the original and the correction. For edits, store the agent's output and the person's version. The difference is a labelled example of a better answer, and it may become a test case or a training example.
Mind privacy as you do. Feedback and edits may contain personal data. Apply the rules of Lesson 8.2: minimise, redact, control access and set retention, and tell users how their feedback is used.
Step three: diagnosing causes
Counting feedback tells you how often something goes wrong. To fix it you need to know why. Take a sample of the failures, such as the 50 most recent thumbs-down or rejected drafts, open each trace and classify the cause. Lesson 7.4 gave a list. Here it is as a working table.
Cause · What you see in the traceUnclear or missing instruction · The agent did something reasonable that was not wanted
Missing knowledge · The agent lacked a fact, a policy or a procedure it needed
Wrong or missing tool · It chose the wrong tool, or had none for the job
Poor tool result · The tool returned something confusing, truncated or wrong
Context problem · The fact was present but buried, stale or crowded out
Reasoning error · Everything it needed was visible and it still got it wrong
Environment fault · A system was down or slow
Task not supported · The request was outside what the agent should do
Count the categories. Usually a few causes account for most of the failures, and the largest is where to work first. Do not trust the first impression of one dramatic failure. A single vivid complaint can pull a team toward a rare problem while a dull, common one goes unfixed.
Step four: the levers
Once you know the cause, choose the lever that fits. Roughly from the cheapest and most reversible to the dearest:
Lever · Use when · ExampleInstructions · The agent misunderstood what to do · Add a rule, a reason or a definition. Clarify an ambiguous sentence
Examples · The agent needs to see what good looks like · Add two or three canonical examples, taken from good edits
Tool descriptions and schemas · Wrong tool or wrong arguments · Sharpen the description, add constraints, rename
Tool results · The model could not use what came back · Trim, restructure, add clear error messages
Context design · Facts were buried, stale or missing · Better retrieval, compaction, ordering, as in Lesson 9.1
Skills and knowledge · Missing procedure or domain knowledge · Add or fix a skill, as in Lesson 9.3
Memory · The same lesson must be learned again · Store a corrected fact or a preference
Workflow structure · A step is unreliable · Add a check, split a step, add a reviewer, as in Module 5 and Lesson 6.4
Model choice · Reasoning fails even with clear information · Use a stronger model for that step, as in Lesson 8.1
Fine-tuning · Many labelled examples, a stable task and the cheaper levers are exhausted · Train a smaller model on the corrections
Most gains come from the first six: clearer instructions, better tools and better context. They are cheap, quick and easy to undo. Fine-tuning is powerful in the right case, and is slow, costs data and effort, can reduce general ability and has to be redone when the base model changes. Try it last.
A rule: change one thing at a time where you can. If you change the instructions, the tools and the model together and the score improves, you will not know which helped. If it falls, you will not know which hurt.
Watch for overfitting to the examples
A fix written for one failure can fit that failure too closely. If you add the line "if the customer says 'my parcel is damaged', offer a replacement", you fix that phrasing and not the underlying rule. Write instructions as general principles with reasons, and use examples to illustrate, not to enumerate. Then test on new cases the fix did not see.
Step five: proving that the change helped
This is the step teams most often get wrong. You make a change, try it on a few examples, it looks better, and you ship. But agents vary from run to run, and small test sets are noisy. A difference you see may be chance.
Lesson 7.1 showed that a pass rate has a margin of error that shrinks only with the square root of the number of tests. Comparing two versions needs more still, because both scores are uncertain. A standard approximation gives the number of test cases needed for each version to detect a difference reliably, with the usual conventions of 95 per cent confidence and an 80 per cent chance of detecting a real effect:
n ≈ 7.84 × (p₁(1 − p₁) + p₂(1 − p₂)) ÷ (p₂ − p₁)²
where p₁ is the current pass rate and p₂ the hoped-for one. Take a current rate of 80 per cent.
To detect a rise to 85 per cent, a gain of 5 points: 7.84 × (0.16 + 0.1275) ÷ 0.0025 = 7.84 × 0.2875 ÷ 0.0025 = 902 cases per version.
To detect a rise to 82 per cent, 2 points: 7.84 × (0.16 + 0.1476) ÷ 0.0004 = 6,029.
To detect a rise to 90 per cent, 10 points: 7.84 × (0.16 + 0.09) ÷ 0.01 = 196.
Halving the size of the improvement you want to detect roughly quadruples the data you need. So small improvements need large tests. This is hard news for teams with a test set of 50 cases. They cannot tell a 2-point gain from noise, and may spend months making changes whose effect they cannot see.
Predict first: your agent passes 80 per cent of tests. About how many test cases per version do you need to reliably detect an improvement to 85 per cent? Would you guess near 100, near 1,000 or near 10,000? Decide before reading on.
The answer is about 900, near the middle option. Most people guess lower, and then are surprised when a good-looking change is not confirmed.
Four ways to make better use of limited data:
Compare on the same cases and look at the cases where the two versions differ, as Lesson 7.1 suggested. Pairing removes much of the noise.
Run each case several times, to reduce run-to-run variation.
Look for large effects. Aim at fixes that change a failure category completely, not tiny polish.
Combine evidence. Offline tests, a staged release and real use each give a view. If all agree, you can be more confident than any alone.
Guard against regression
A fix can break something that worked. A new rule that cures one failure may cause two others. Keep the full evaluation suite, including every earlier failure that became a test, and run all of it on every change. Look at the result by category, not only overall. An overall rise from 84 to 86 per cent may hide a fall from 90 to 80 on one important category. Block a release that makes any protected category worse than a set limit.
Step six and seven: release and confirm
Release in stages, as Lesson 8.4 described, and watch the same signals that showed the problem. Did the failure category shrink? Did the user feedback improve? Did cost and speed hold? The offline test predicts, and real traffic confirms. Sometimes a change that passed offline does not help in use, because the test set did not match real requests. When that happens, add the missing kind of request to the test set.
Record each cycle: the problem, the cause, the change, the test result and the effect in use. This log is the agent's history. It prevents repeating failed ideas, it shows what has worked and it teaches new team members.
How fast does it improve?
Improvement has diminishing returns. The big, common failures come first and are the cheapest to fix. What remains is rarer and harder. A simple model shows the shape. Suppose each cycle fixes a quarter of the remaining failures. Starting at a 20 per cent failure rate, the rate after k cycles is 20 × 0.75ᵏ.
After 1 cycle: 15.0 per cent.
After 2: 11.3 per cent.
After 3: 8.4 per cent.
After 4: 6.3 per cent.
To reach 5 per cent takes ln(5 ÷ 20) ÷ ln(0.75) = 4.8, so five cycles. Each cycle gives a smaller absolute gain than the last: 5.0 points, then 3.75, then 2.8, then 2.1. This matches experience. The first month of work on a new agent often yields large gains, and later months yield less. It tells you when to stop: when the cost of a cycle exceeds the value of the points it gains. If a point of success is worth ₹50,000 a year and a cycle costs ₹3 lakh, stop once cycles yield less than 6 points.
Letting the agent improve itself
Agents can learn at run time in limited ways. They can write lessons to memory, as Lesson 4.4 described: "this supplier needs a purchase order number", or "the customer prefers short replies". They can propose changes to their own instructions or skills from what went wrong. This is attractive, and it carries risks.
Errors spread. A wrong lesson written to memory or a skill is repeated in every later run.
Poisoning. If the agent learns from untrusted content, an attacker can plant a "lesson", as Lesson 7.3 warned.
Drift. Many small self-edits can move the agent away from its design in ways no one reviewed.
No evidence. A change the agent makes without a test is a guess.
A safe approach is to let the agent propose: write candidate lessons and instruction changes to a queue, with the trace that motivated each. A person, or an automated gate, reviews them, tests them against the suite and applies those that pass, under version control. Learning is welcome, and the release rules still apply. Memory that holds user preferences is lower risk and can be written directly, with the isolation and deletion controls of Lesson 4.4.
Pitfalls in learning from feedback
Selection bias. The people who rate are not typical. Do not take ratings as the whole truth.
Goodhart's law. When a measure becomes a target, it stops measuring well. If you optimise for thumbs-up, the agent may learn to flatter. If you optimise for short handling time, it may rush. Use several measures and check the ones you are not optimising.
Chasing the last complaint. Fix by frequency and cost, not by whoever shouted most recently.
Metric gaming by the agent. If the grader is a model, an agent tuned against it may learn to please the grader. Keep human checks and a hidden test set.
Stale tests. The test set must reflect current traffic. Refresh it from recent real cases.
Forgetting cost. An improvement that raises quality and doubles cost may not be one.
Ignoring the silent majority. Most failures are never reported. Sample traces to find them.
Three worked examples
Example 1: edits that became examples
A support agent's drafts were edited in 22 per cent of cases. The team sampled 60 edits and found that in 31 of them, the edit shortened a long opening paragraph and moved the answer to the first sentence. They added a rule, "Answer the question in the first sentence, then give detail", with two examples taken from good edits. Edits of this kind fell to 6 per cent of drafts on a test of 400 requests, with a paired comparison on the same cases. Overall edit rate fell from 22 to 15 per cent.
Example 2: the improvement that was noise
A team changed an instruction and saw the pass rate on its 60-case test rise from 78 to 85 per cent. They shipped it. On real traffic the pass rate stayed at 78 per cent. A calculation afterwards showed that with 60 cases, a rise of 7 points was well within chance, since detecting a 7-point gain from 78 per cent needs about 480 cases per version. They built a set of 500 cases from logged requests, reran the comparison and found no real difference. They dropped the change and used the saved effort on the largest failure category, which they had not yet touched.
Example 3: a fix that caused a regression
A rule added to stop an agent offering refunds on non-refundable items worked, and refund-related failures fell from 9 to 4 per cent. But the suite broken down by category showed that the agent now also refused a legitimate refund type, damaged goods, in 12 per cent of those cases, up from 2 per cent. The overall score had barely moved, and hid both effects. The team rewrote the rule with an explicit exception and a reason, retested and shipped it with the damaged-goods category protected in the release gate.
A checklist for improving agents
1. Collect signals from users, edits, approvals, behaviour, outcomes, reviews, checks and tests.
2. Link every signal to its trace. Capture reasons and keep original and corrected versions.
3. Diagnose a sample of failures by cause, and count the causes.
4. Work on the largest cause first. Pick the cheapest lever that fits, and change one thing at a time.
5. Write general fixes with reasons, and test on cases the fix did not see.
6. Size the test to the gain you want to prove. Compare on the same cases and run cases more than once.
7. Run the full suite and check every category. Block regressions.
8. Release in stages and confirm in real use. Add missed kinds of request to the tests.
9. Keep a log of each cycle, and stop when cycles cost more than they gain.
10. Let agents propose their own changes, but review and test before applying.
Common mistakes
Fixing by anecdote. Count and classify failures first.
Judging a change from a handful of cases. Small tests cannot show small gains.
Changing many things at once. You will not know what worked.
Narrow fixes. A rule for one phrasing fails on the next.
Looking only at the overall score. A regression can hide inside it.
Feedback not linked to traces. You cannot tell what happened.
Optimising one metric. The agent may game it.
Self-editing agents with no review. Errors and poison spread.
Never refreshing the test set. It stops matching real traffic.
Going on past the point of return. Later cycles gain less.
Key takeaways
Improving an agent is a loop: collect, link, diagnose, change, test, release and confirm. Skipping steps lets noise pass for progress.
Feedback comes from ratings, edits, approvals, behaviour, outcomes, reviews, checks and tests. Link each to its trace and keep the reason.
Diagnose by cause and fix the largest cause first, using the cheapest lever that fits: instructions, examples, tools, context, skills, memory, structure, model choice and, last, fine-tuning.
Proving a change needs data. To detect a gain from 80 to 85 per cent needs about 902 cases per version, a 2-point gain about 6,029 and a 10-point gain 196. Pair comparisons and repeated runs help.
Check every category to catch regressions, and write general fixes with reasons.
Gains shrink: fixing a quarter of the remaining failures each cycle takes 20 per cent to 6.3 per cent in four cycles. Stop when a cycle costs more than it gains.
Let agents propose improvements, and gate them with review and tests. Beware selection bias, Goodhart's law and stale tests.
Check yourself
1. Name four sources of feedback.
Any four of: user ratings, edits, approvals and rejections, behaviour, outcomes, trace reviews, automated checks and test results.
2. Why link each piece of feedback to a trace?
Without the trace you cannot see what the agent saw and did, so a rating tells you that something was wrong and not what.
3. Why is a rise from 78 to 85 per cent on a 60-case test not convincing?
With so few cases the margin of error is large, and a 7-point difference is within chance. Hundreds of cases per version are needed to confirm such a gain.
4. A failure rate of 16 per cent falls by 30 per cent of what remains each cycle. What is it after 3 cycles?
16 × 0.7³ = 16 × 0.343 = 5.5 per cent.
5. Why look at results by category and not just overall?
A fix can improve one category and damage another, and the overall score can hide both.
6. What is a safe way to let an agent learn from its mistakes?
Let it propose changes to a queue with the supporting traces, then review and test them against the evaluation suite before applying them under version control.
Try this
Set aside ninety minutes.
1. Choose an agent. List where feedback would come from, and for each how you would link it to a trace and capture a reason.
2. Take 20 real or invented failures and classify each by cause. Count the causes and find the largest.
3. For the largest cause, pick the cheapest lever that fits and write the change as a general rule with a reason.
4. Use the sample-size simulator with your current pass rate. How many cases do you need to prove a 3-point gain? A 10-point gain? How big is your test set?
5. Plan the comparison: same cases, repeated runs and the categories you will protect.
6. Use the cycles simulator to estimate how many cycles to reach your target, and the value of each.
7. Write the release and confirmation plan, and what you will log from the cycle.
A good result is an improvement plan for one agent: the signals, the diagnosis, the chosen change, the test design and the stopping rule. That completes Module 9. Your agents can now use context deliberately, work with others through protocols, carry reusable skills and improve from what happens in use. The next module is a different kind of thing: how to keep up with a field that changes every month.
Tags: Agentic AI Agent improvement Feedback loops Evaluation Continuous improvement