Chapter 12. Improving LLM Agents
We have built evaluators, set up CI to catch regressions, and deployed monitoring to track production quality. We have also surfaced failure modes through error analysis (Chapter 3) and data analysis (Chapter 11). Now we use all of that to make the agent better.
In this chapter, you will learn:
-
How to improve accuracy through prompt refinement, structural changes, and heavier interventions like fine-tuning
-
How to reduce cost through model selection, token reduction, caching, and model cascades
-
How to verify that each change actually helps using the evaluators and CI infrastructure from earlier chapters
Both accuracy and cost improvements depend on reliable measurement. Without evaluators (Chapter 5) and monitoring (Chapter 9), we cannot tell whether a change helps or hurts.
Accuracy Optimization
When an agent fails evaluations or frustrates users, accuracy is usually the first thing to fix. We can organize the techniques by effort level: low, medium, and high.
Low Effort: Prompt Refinement
The fastest way to ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access