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...

Build one AI support assistant across four hand-drawn books: prompts and evals, an agent harness, RAG with sources, then production. Python, no API key. Save up to $39.
Bought separately
$119.96
Minimum price
$59.99
$79.99
About the Bundle
AI Engineering Visualized: Volumes 1–4 follows one project from the first prompt to a system running for real users: a support assistant for Northwind Goods, a fictional online store. Volume 1 builds it. Volume 2 wraps it in an agent harness with checked plans, approvals and receipts. Volume 3 gives it real knowledge and makes every answer traceable to a source. Volume 4 takes it to production. No new example, codebase or set of terms between books.
24 chapters, 232 hand-drawn doodles and almost 3 hours of explainer videos, one per chapter
A single prompt answering "Can I get a refund for order #1234?" grows into a working system: refund rules in code the model can't argue away, tool calls, cited answers, an honest "I don't know", evals before every change, and an agent loop with step limits, permissions and human approval.
17 chapters, 118 hand-drawn doodles and almost 2 hours of explainer videos, one per chapter
The same assistant gets an agent harness: the loop, tool registry, checks, state store, approvals, memory and limits. Each approval is bound to the exact action. The model is a part you can swap. The harness is what you test, version and ship.
16 chapters plus a capstone appendix, 113 hand-drawn doodles
The best match was true once. Now it's wrong. Volume 3 builds the code that decides which sources may answer: ingestion with provenance, permissions checked at every step, hybrid search and reranking, a rule for when sources disagree, safe SQL, knowledge graphs and a regression gate. The capstone sends one ticket through every stage.
16 chapters plus a capstone appendix, 115 hand-drawn doodles
The worker calls the payment provider and dies before it writes anything down. Was the refund paid? Volume 4 runs the assistant for real users: an API, a queue and leased workers, SLOs and error budgets, traces you can trust, shadow scoring and drift, releases you can roll back, latency and cost engineering, model routing with fallbacks, threat modelling, privacy, and incident response.
Backend and full-stack developers, data engineers asked to "add AI", and technical founders who read Python. You don't need a machine learning background.
About the Books
You got the demo working. Now it has to work on Monday. AI Engineering Visualized is for developers who have to ship features that call a language model. A model is one box; a product is the whole diagram around it. This book draws that diagram, box by box, as hand-drawn doodles you can remember and reuse when you design or debug. Every idea is a named mental model, such as The Context Suitcase, The Citation Gate, The Golden Set or The Trojan Ticket, with a picture, a plain definition, a failure you can trigger and the fix. One assistant, built chapter by chapter. You build a support assistant for Northwind Goods, a fictional online store. It starts as one prompt answering "Can I get a refund for order #1234?" and grows into a system that:
Real code, no API key. Every chapter has short Python examples from the free companion repository (MIT licence, Python standard library only) and an exercise with a tested solution. The examples run on a scripted stand-in model, so they cost nothing; swap in your provider with one function when you are ready. Who it's for: backend and full-stack developers, data engineers asked to "add AI", and technical founders. You need to read Python. You do not need a machine learning background. Who it's not for: readers who want to train models from scratch, or a catalogue of today's model prices and rankings. Prices and model names change too fast; the book shows you how to measure instead. Complete edition: all 24 chapters. All 24 chapters of Volume 1 are in this edition, fully illustrated.
Part of the AI Engineering Visualized series: Volume 1: Foundations, Volume 2: Agents, Volume 3: RAG & Knowledge Systems and Volume 4: Production AI. Get all four in the Volumes 1–4 bundle.
Your agent worked in the demo. Then it refunded the wrong order, waited forever on a courier, or told a customer "your refund has been processed" when no payment ever went through.
AI Engineering Visualized, Volume 2: Agents is about everything around the model that turns its proposals into safe, finished work. The book calls that the agent harness: the loop, the tool registry, the checks, the state store, the approvals, the memory and the limits. The model is a part you can swap. The harness is what you test, version and ship.
One assistant, carried forward. Volume 1 ended with a support assistant for Northwind Goods, a fictional online store. Volume 2 picks it up and makes it an agent you could trust with real tickets: refunds, damaged items, late deliveries, address changes. Each chapter builds one part of the harness, shows a failure you can trigger, and fixes it.
Visual first. Every idea is a named mental model, such as The Agent Harness, The Identity Chain, Blast Radius, One Operation, One Receipt, The Waiting Ticket or Every Stop Has a Reason, drawn as a doodle with a plain definition next to it.
Real code. Each chapter has short Python examples ("Hands on Keys") and runs on a scripted stand-in model by default, so it costs nothing. Chapters also report what happened when the same code ran against a real local model (llama3.2 through Ollama), including the bugs those runs exposed and how the harness was changed to catch them.
Chapters 1-3 are in the free sample.
Developers who have a working LLM feature or a basic agent loop and now need it to behave on real tasks: backend and full-stack engineers, data engineers, and technical founders. You need to read Python. It helps to have read Volume 1 (especially its agent chapters), but the ideas it relies on are recapped where they are used.
All 17 chapters are written, and each chapter's explainer video is live. Buy once and get every future revision free.
Part of the AI Engineering Visualized series: Volume 1: Foundations, Volume 2: Agents, Volume 3: RAG & Knowledge Systems and Volume 4: Production AI. Get all four in the Volumes 1–4 bundle.
The best match was true once. Now it's wrong.
Asha asks whether order #2001 can still be refunded. The best match in the assistant's new search index is an old ticket saying the parcel is still on its way. That ticket was true when it closed. Now it's stale: the order record says #2001 was delivered. A better search would still find that ticket. The code around the search decides which sources may answer, and this book builds that code.
For a retrieval feature whose answers you now have to trust. The sources are manuals with tables, an order database, past tickets and rules that change by region. Volume 1 built the Northwind Goods support assistant with a small hybrid search over one policy page and nine handbook passages. Volume 2 put a harness around it so it could act. Volume 3 gives it real knowledge and makes every answer traceable to a source.
One assistant, carried forward. Chapter by chapter you build the knowledge system behind the model:
A capstone appendix then sends one ticket through every stage on one corpus.
Visual first. Every idea is one of 35 named mental models, such as The Ingestion Conveyor, Small to Find, Big to Read, The Two-Stage Funnel, The Evidence Pack, The Stale Index or The Regression Gate. Each one has a hand-drawn doodle, a plain definition, a failure you can trigger and the fix.
Real code, no API key. The examples are short Python excerpts from the free companion repository (MIT licence), built from plain stages on the Python standard library with no framework. By default they run on a stubbed model, with no API key, no network and no cost. You can point a chapter at a real local model with Ollama if you like. Each Model experiment reports one real llama3.2 run with its settings and log, not a rate; runs not made yet are marked [TO MEASURE].
Chapters 3, 7 and 10 are in the free sample.
Developers who have built a retrieval feature and now have to trust its answers. You should be comfortable reading Python. Volume 1, or the same ground (tokens, embeddings, search, chunking, a RAG pipeline, grounded answers, evals), comes first. Volume 2 helps lightly: the code starts from its final code, and each piece it reuses is recapped in one line. You don't need a machine learning background. You need Python 3.10 or newer and git.
If you want a tour of RAG frameworks or vector databases, this isn't that book. It builds plain stages so that every guarantee is code you can read and test. Further Reading points to the real tools.
Front matter plus Chapters 3, 7 and 10.
All 16 chapters and the capstone appendix are written and illustrated in this edition (281 pages in the screen PDF). Buy once and get every future revision free.
Sources and ingestion
Who may see what
Finding the right passage
Deciding and packing
Records and links
Keeping it right
Appendix: Capstone, One Ticket Through Every Stage
Plus: Further Reading, Transfer Exercises, a Decision Guide, an Experiment Ledger, Quick Reference, a Solutions Index, Quiz Answers, a Glossary and a Mental-Model Index.
Part of the AI Engineering Visualized series: Volume 1: Foundations, Volume 2: Agents, Volume 3: RAG & Knowledge Systems and Volume 4: Production AI. Get all four in the Volumes 1–4 bundle.
Asha's mug set arrived chipped, and she wants a refund. The worker calls the payment provider, and the process dies before it writes anything down. Was she paid?
That is the question Chapter 1 answers. Through three volumes the Northwind Goods assistant learned to answer, to act safely and to answer from real knowledge. It did all of that in one process on one laptop, for one customer at a time. This book runs it for real users: many tickets at once, on machines that fail, with releases that can go wrong and costs that add up.
For people who have a working assistant or agent and now have to operate it. Volume 1 built the Northwind Goods support assistant. Volume 2 put a harness around it so it could act. Volume 3 gave it real knowledge. This volume takes it to production.
One assistant, carried forward. The same support assistant for Northwind Goods, the fictional online store, now run as a service. Chapter by chapter you build what surrounds the model in production, and every chapter adds one part to it:
Visual first. This edition has 36 named mental models, such as Request Path, Job Path, The SLO Card, Canary and Rollback, The Critical Path Waterfall, The Attack Surface Map or The Weekly Improvement Loop. A mental model here is a named picture you can reuse when you design or debug. Each one has a hand-drawn doodle, a plain definition, a walkthrough, and why it matters; most also break the running example and fix it.
Real code, no API key. The examples are short Python excerpts from the free companion repository (MIT licence), in its vol4/ folder at tag vol4-ed1. The book builds plain parts with the Python standard library so that every step is code you can read. Further Reading points to the real tools and standards. By default the code calls a stubbed model, with no API key, no network and no cost. Traffic, durations and failures come from a seeded simulator, and the book labels them simulated. You can point later chapters at a real local model with Ollama if you like. A small evidence pack of local-model runs, with model digest, settings, hardware and sample size, is in the Experiment Ledger appendix. Everything else is labelled simulated or unmeasured.
Chapters 1, 6 and 15 are in the free sample.
What you'll learn
Who it's for
People who have a working assistant or agent and now have to operate it. You should be comfortable reading Python. You do not need a machine learning or operations background. Volume 1, or the same ground (the whole-system diagram, tokens, evals, guardrails and privacy, and the timeouts, retries and latency budget of its last chapter), comes first. Volumes 2 and 3 help lightly: the code starts from Volume 3's final code, which contains Volume 2's agent harness, and each piece it reuses is recapped in one line. You need Python 3.10 or newer and git.
Who it's not for
If you want a tour of production platforms, this isn't that book. It will not hide the system in a platform. It builds plain parts with the Python standard library so that every step is code you can read. Further Reading points to the real tools and standards.
Free sample
Front matter plus Chapters 1, 6 and 15.
Complete
All 16 chapters and the appendices are written and illustrated in this edition (292 pages in the screen PDF). Buy once and get every future revision free.
Table of contents
Boundaries and targets
1. Production Architecture: APIs, Workers, State and Boundaries
2. SLOs and Error Budgets
3. Observability: Traces, Metrics and Logs
Knowing whether it works
4. Online Evaluation: Shadow Scoring and Drift
5. Feedback and Experiments
6. Release Engineering: Versioning, CI and Rollbacks
Fast and affordable
7. Latency Engineering: The Critical Path
8. Streaming, Cancellation and Backpressure
9. Cost Engineering: Tokens and Caching
10. Model Routing, Fallbacks and Provider Resilience
11. Inference and Serving: Managed vs Self-Hosted
12. When to Fine-Tune, Distill or Change Models
Safe and recoverable
13. Security Engineering: Threat Modeling and Red-Teaming
14. Privacy, Governance and Data Lifecycle
15. Incident Response: Contain, Recover, Verify
16. Capstone: Operating the Complete System
Appendix: Capstone, One Week Through Every Box
Plus: Further Reading, a Joined Drill, Transfer Exercises, a Decision Guide, an Experiment Ledger, Audit Log Integrity, Quick Reference, a Solutions Index, Quiz Answers, a Glossary and a Mental-Model Index.
Part of the AI Engineering Visualized series: Volume 1: Foundations, Volume 2: Agents, Volume 3: RAG & Knowledge Systems and Volume 4: Production AI. Get all four in the Volumes 1–4 bundle.
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.