Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Welcome

Author: Hamze Ghalebi

Support the project by buying the Kindle edition: Buy on Amazon

This book is about the architecture above the model.

Not “AI” as a vague capability. Not Rust as an identity. Not agents as a magical staffing plan. The subject is how to design AI systems that work when they meet latency budgets, real users, compliance obligations, incomplete data, hostile inputs, approval workflows, cloud bills, and skeptical buyers.

The short version:

Build evaluated, observable, secure, typed, human-controlled AI systems that solve expensive real-world workflows.

That sentence is the spine of the book. Every chapter is a different pressure test against it.

The systems in this book assume that language models are useful and unreliable. They can extract, summarize, classify, draft, route, and reason. They can also hallucinate, leak, drift, overrun a budget, overfit a benchmark, follow a malicious instruction, or produce an answer that sounds better than it is. Production architecture is the discipline of making those facts explicit instead of pretending they disappear.

The intended reader is a builder who wants serious leverage: a founder, senior engineer, product architect, compliance-aware technologist, or public-interest systems builder. You do not need to train foundation models from scratch to use this book. You do need to care about invariants, evidence, cost, audit trails, and human accountability.

How to Read

Read the chapters in order the first time. The order matters:

  1. evaluation tells you what behavior means
  2. typed workflows tell you what states are legal
  3. human-in-the-loop design tells you who is accountable
  4. observability tells you what happened after deployment
  5. security and governance tell you what must not be allowed
  6. economics tells you whether the workflow can scale as a business
  7. distribution tells you how serious systems create market trust
  8. the capstone combines all of it

After the first pass, use the book as a design checklist. When you are building a product, ask one chapter at a time: how will we evaluate it, type it, review it, observe it, secure it, price it, and prove it?

What This Book Is Not

This is not a prompt cookbook. Prompts matter, but they are only one boundary in a larger system.

This is not a Rust tutorial. Rust appears because it makes illegal states harder to express, which is exactly what production AI workflows need.

This is not a survey of every new agent framework. Frameworks change. The control problems stay.

This is not anti-LLM. It is anti-fantasy. The goal is not to make AI feel magical. The goal is to make AI useful enough that a bank, regulator, CTO, analyst, or public institution can trust the system around it.

The Operating Doctrine

For regulated and high-trust domains, keep this doctrine close:

The AI collects and prepares. The analyst validates. The audit trail proves.

Sometimes an AI system may take low-risk actions automatically. Sometimes it may only draft. Sometimes it may recommend but not execute. The right boundary depends on the workflow’s risk. The wrong boundary is the one nobody can explain after something fails.