Book four in the Super AI Engineering Series
The demo worked once.
Then real users arrived. The agent looped on a broken tool, followed instructions hidden in an email, and ran up a bill several times the forecast. This is a decision guide to agents that survive that week: 28 chapters, 148 illustrations, not a single line of code.
PDF + EPUB · or sample Chapter 1 first, no signup
Instant download · 7-day money-back guarantee

A demo is one run. The product is every run after it.
A demo answers one question: can the agent succeed? A product has to answer harder ones: how often it succeeds on requests nobody chose, what each run costs, and what the worst run can reach. An agent that gets one request in ten wrong passes a three-request demo about three times in four, then gets about a hundred wrong in its first thousand real requests. Most agent projects fail because they built the wrong thing, not because they built it badly. This book helps you decide what to build.
Every pattern, the same four questions
Most explanations of agents answer the first question and stop. This book gives the other three as much room, and the fourth is where it takes sides.
How does it work?
The mechanism, as a process you could build in any language.
What breaks?
The failure modes you will actually meet, each with the symptom you will see in a run and the fix.
What does it cost?
Latency, tokens and money, complexity and operational risk, rated in the same four-row table in every chapter.
When is it overkill?
A verdict with conditions you can check in your own system, never "it depends", and the simpler thing to try first.
In your coding agent. Every chapter shows where its pattern lives inside the coding agent you already run, so you can test each claim against your own tool the day you read it.
Built not to go stale. It names no framework, SDK, model or vendor, and quotes no token prices or benchmark scores. The next framework you meet will have parts you can already name.
28 chapters in seven parts
In the order decisions arrive on a real project: whether to build an agent, what it can touch, how you will know it works, and only then the more ambitious patterns.
Part I
Before You Build
Whether you need an agent at all, what one actually is, and the fixed workflows to try first.
- 1Do You Even Need an Agent? (free)
- 2The Loop: What an Agent Actually Is
- 3Workflows First
Part II
Giving the Model Hands
Tools: how calling works, how to design them, the four kinds of tool that matter most (retrieval, the web, code, and standard protocols), and skills.
- 4How Tool Calling Works
- 5Designing Tools the Model Can Use
- 6Retrieval as a Tool
- 7Acting on the Web and the Screen
- 8Running Code
- 9Plugging In: Standard Protocols for Tools and Agents
- 10Skills: Know-How Loaded on Demand
Part III
Making It Reliable
Context, evals, tracing, guardrails, human approval, and cost. The work that decides whether an agent survives contact with real users.
- 11Context Engineering
- 12Evals: Knowing Whether It Works
- 13Tracing and Observability
- 14Guardrails and Prompt Injection
- 15Humans in the Loop
- 16What an Agent Costs
Part IV
Planning and Reasoning
Interleaving thought with action, planning ahead, checking your own work, and spending more thinking where it pays.
- 17Reason, Act, Observe
- 18Plan, Then Execute
- 19Reflection and Self-Correction
- 20Search and Thinking Budgets
Part V
State and Memory
Runs that outlive a crash, and what an agent should keep between sessions.
- 21State, Checkpoints, and Long-Running Work
- 22Memory, the Short Version
Part VI
Many Agents
Whether to split the work, and how orchestrators, workers, and handoffs actually behave.
- 23Should You Go Multi-Agent?
- 24Orchestrator and Workers
- 25Handoffs and Shared State
Part VII
Shipping
Deployment, the anatomy of a coding agent, and the ways agents fail.
- 26Deploying an Agent
- 27Anatomy of a Coding Agent
- 28How Agents Fail
Around the parts
Introduction and appendices
Why agents demo well and ship badly, then one decision tree from a task to the simplest design that handles it, with a pre-launch checklist and every term defined.
- Introduction: The Demo That Worked Once
- Appendix A: Choosing an Architecture
- Appendix B: Glossary
148 illustrations. Here are four.
Every chapter opens with a run going wrong and one analogy that carries the idea, and both are drawn. These four come from the introduction and Chapters 12, 14 and 27.




Written for the people who decide what gets built
Developers building agents
Mechanisms you can implement in any language, and the failure modes to look for in your own runs.
Technical product managers
The verdicts: what each pattern buys, what it costs and when to say no, in terms you can bring to a design review.
Teams with an agent already running
Start at Appendix A, a decision tree from the problem you have to the chapter that fixes it, and jump straight there.
No machine learning background needed. You need to know that a model reads text and writes text, and to have called one from code or watched a coding agent work.
Why this book vs. everything else
| Compared | This Book | Framework docs | Papers | Blog posts |
|---|---|---|---|---|
| No code required | ||||
| Says when a pattern is overkill | partial | |||
| Cost rated in every chapter | partial | |||
| Framework-agnostic | partial | |||
| Illustrated throughout | partial | partial |
What you get
- PDF and EPUB, both included, $59
- Full-color PDF, 484 pages, with live links
- EPUB for any e-reader
- Instant download after checkout
- 7-day money-back guarantee
- 148 custom illustrations across 28 chapters
- No code, and nothing to clone or install
From the author of RAG Made Simple and Agent Memory Made Simple
Nir Diamant is an AI researcher and open-source educator. His GitHub repositories have earned over 85,000 stars and draw more than 500,000 views every month. His DiamantAI Newsletter reaches 40,000+ subscribers and ranks in the top 0.1% on Substack.
This is the fourth book in the Super AI Engineering Series. RAG Made Simple and Agent Memory Made Simple go deep on what Chapters 6 and 22 cover in one chapter each. None of them is required reading here.
Build the agent the job needs.
Or find out the job needed no agent at all. Get the decisions that still hold when the next framework ships.
Need your agent to remember? Get it with Agent Memory Made Simple for $89 ($118 bought separately).
Or get all four books in the series for $159 ($236 bought separately).