The Leanpub 60 Day 100% Happiness Guarantee
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
See full terms...
Anyone can show an AI agent working once. This book teaches you to find out how often it works, where it fails, what that costs, and whether it is safe to release.
Minimum price
$15.95
$18.00
About the Book
Teams everywhere are putting AI agents to work on the strength of a demonstration. The agent answered five questions well, so it ships. Then it refunds the wrong customer, invents a price, or quietly gets worse when the customers change, and nobody can say how often, or why.
The skill that prevents this is evaluation, and it is the part of agent building that is hardest to learn from scattered articles. This book teaches it from the beginning, in order, assuming only that you can use a computer.
You follow one running example throughout. Maya runs a small solar-lamp shop in Accra and has an AI help desk that answers customers and pays refunds. Chapter by chapter you learn to measure that agent properly: first with twenty hand-written cases, then with test sets of thousands, graders that check the money and not only the words, statistics that tell a real improvement from luck, attacks that try to talk the agent out of its rules, and monitoring that notices when live quality slips.
Every chapter has the same rhythm: a plain explanation, a short program, and the real output of that program printed underneath. When a method works, you see the numbers. When something sensible fails, you see that too. A filter built to stop attacks stops the old attacks and none of the new ones. A "clever" hybrid design loses to the simple one. A human approval step turns into a rubber stamp as the agent improves. The book reports each result as it came.
The agent you evaluate is a practice agent written for the book. It is an ordinary program that behaves like an agent built on a language model and makes the same kinds of mistake, at rates that are known. That is what lets you run every experiment free, on any computer, and get exactly the numbers printed in the book. The judge, the customers and the reviewers used in some chapters are simulated in the same way, and the book says so wherever they appear. An appendix shows how to point the same toolkit at an agent built on a commercial model.
What you will learn
- Foundations — what an evaluation is, what to measure, and why a pass rate needs a margin of error
- Building test sets — writing good cases, sampling and slices, labelling and agreement, generated cases, and keeping a test set honest
- Graders — code checks, rubrics for human graders, AI judges and their biases, validating a judge, pairwise ranking
- Evaluating agents — tool-call paths, effects on the world, consistency across repeated runs, conversations, retrieval, multi-agent teams
- Statistics for decisions — paired comparisons, how many cases you need, the trap of testing many things, cost and speed against quality
- Safety and production — adversarial testing and prompt injection, regression tests and release gates, monitoring and drift, error analysis, human oversight
- Practice — reading public benchmarks and leaderboards, a complete evaluation from plan to one-page report, and building an evaluation practice in a team
What is inside
- 33 chapters in 7 parts, 652 pages
- More than 100 complete programs, each run when the book was built, with the real output printed beneath
- A small evaluation toolkit in plain Python that you build up through the book and can adapt to your own agent
- Learning objectives, key-idea boxes, plain-language explanations and a summary in every chapter
- Review questions and exercises in every chapter, with answers to selected questions
- Appendices on setup, a Python quick reference, every formula used, connecting a real model, and thirteen reusable templates (evaluation plan, rubric, judge prompt, release gate, monitoring plan, evaluation report and more)
- A glossary of about 140 terms, references and a full index
Who it is for
- Developers and students who have built or used an AI agent and want to know whether it can be trusted
- Team leads, testers and product managers who must decide whether an agent is ready to release
- Lecturers and trainers who need a structured text with exercises and runnable code
- Readers of Agentic AI Engineering* who want to go deeper into the subject that book introduces
No statistics or machine-learning background is required. The Python and the mathematics you need are taught as you go and collected in the appendices.
About the Author
Benjamin is a lecturer in Computer Science at prestigious university, and holds a PhD in software engineering and active research in cybersecurity and applied AI. After years of watching capable students give up on AI because the textbooks assumed too much, he wrote the book he wished he could hand them. It explains each concept the way a child would learn it, through a character named Alex, while keeping the full mathematics, formulas and code, so that readers finish with real understanding instead of memorised terms.
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
See full terms...
We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
Learn more about writing on Leanpub
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.
Learn more about Leanpub's ebook formats and where to read them
You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!
Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.
Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.