Leanpub Header

Skip to main content

AI Engineering Visualized, Volume 1: Foundations

A Visual Guide to Building LLM Apps, RAG and Agents

AI Engineering Visualized, Volume 1: Foundations
This book is 100% completeLast updated on 2026-10-26

Build reliable LLM applications from first prompt to production agent. AI Engineering Visualized uses memorable doodles, practical Python, RAG, evals, tool calling and safety patterns to help you ship AI systems that work on Monday.

Minimum price

$19.99

$29.99

You pay

Author earns

$

Also available for 1 book credit with a Reader Membership

Buying multiple copies for your team? See below for a discount!

PDF
EPUB
About

About

About the Book

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:

  • decides refunds with rules in code the model cannot argue away
  • counts its tokens and checks its own output against a contract
  • calls tools, then searches a handbook and answers with citations
  • says "I don't know" when the pages don't cover the question
  • measures itself with evals before every change
  • runs an agent loop with step limits, permissions and human approval
  • retries failed calls, masks personal data and logs every request for replay

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.

Team Discounts

Team Discounts

Get a team discount on this book!

  • Up to 3 members

    Minimum price
    $37.00
    Suggested price
    $60.00
  • Up to 5 members

    Minimum price
    $59.00
    Suggested price
    $96.00
  • Up to 10 members

    Minimum price
    $104
    Suggested price
    $168
  • Up to 15 members

    Minimum price
    $149
    Suggested price
    $240
  • Up to 25 members

    Minimum price
    $224
    Suggested price
    $360

Bundle

Bundles that include this book

Author

About the Author

Prateek Singh

Prateek Singh is the solo technical founder of Ganak AI Labs (https://ganak.ai), an Indian AI SaaS startup that also runs AI workshops for builders. Its product, Cloudeval AI (https://cloudeval.ai), runs pre-deployment reviews for Azure, plus AWS CloudFormation (beta), with evidence-backed reports, through the web, a CLI, GitHub and MCP. Before AI, Prateek worked as an infrastructure and cloud developer and was an active PowerShell community writer. Books and courses

Find me

Contents

Table of Contents

  • Part I: The First Call
    • 1. AI Engineering Is a System
    • 2. What an LLM Is
    • 3. Talking to a Model
    • 4. Tokens
    • 5. One Token at a Time
  • Part II: Making It Dependable
    • 6. Inside the Context Window
    • 7. Fluent Is Not True
    • 8. Evals
    • 9. Choosing a Model
    • 10. Anatomy of a Prompt
    • 11. Structured Output and Tool Calling
  • Part III: Giving It Knowledge
    • 12. Embeddings
    • 13. Search and Retrieval
    • 14. Chunking
    • 15. The RAG Pipeline
    • 16. Grounded Answers
    • 17. Is the RAG Working?
  • Part IV: Giving It Hands
    • 18. Workflows vs Agents
    • 19. The Agent Loop
    • 20. Planning
    • 21. Memory
    • 22. Agent Safety
  • Part V: Ship It
    • 23. Guardrails and Privacy
    • 24. Ship It
  • Plus: Glossary, Further Reading and Mental-Model Index

Get the free sample chapters

Click the buttons to get the free sample in PDF or EPUB, or read the sample online here

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

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

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

Free Updates. DRM Free.

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

Write and Publish on Leanpub

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.

Learn more about writing on Leanpub