The book moves outward from the single call, in five parts.
Part I, The Call, builds the boring foundation: one boundary, structured output you can trust, prompts in version control, caps on what any of it can cost, a browser that never talks to the model, and a turn that is allowed to be slow.
Part II, The System, gives the model hands: tools, the agent loop, what to do with tool results, side effects you cannot take back, the trust boundaries that keep an agreeable model from becoming an expensive one, and content too long for one call.
Part III, Proof, deals with knowing it works: testing something that never answers twice, measuring quality instead of guessing at it, and observability for things you cannot reproduce.
Part IV, The Team, is about who owns all this, and about how a Scrum team works when agents write much of the code.
Part V, Production, is about everything that happens after it works: failure as a designed state, and shipping changes to something whose behaviour is a distribution.
Each chapter is built on code that runs in production today. The listings are a cleaned-up reference version of that code, not a copy of it: comments trimmed, names made generic where they were ours, and a few places fixed where the book’s version is better than what we shipped. Where a pattern exists because something broke, the book says what broke.
Conventions Used In This Book
Code follows the same conventions as the previous book: strict types, explicit return types, FormRequests for validation, DTOs for typed data, and every error rendered once, in bootstrap/app.php, with a stable code a client can branch on. Examples target Laravel 13 and PHP 8.5, the official Laravel AI SDK (laravel/ai, version 1) and Laravel MCP (laravel/mcp, version 1).
The term “provider” means whoever runs the model: the company you send a request to and get tokens back from. “Agent” means a class that holds the instructions, tools and schema for one job, in the sense the AI SDK uses. “Tool” means a function you have exposed to the model. A “step” is one request to the provider and its answer. A “turn” is everything that happens between a user pressing enter and the feature going quiet again, which can be many steps.
Provider APIs change faster than framework APIs. Request shapes in this book were checked against the providers’ documentation in October 2026. Treat the shape as the lesson and the field names as a snapshot, and check the current documentation before you copy one.