Skip to main content
Laravel, building with AI.

Preface

Julian Beaujardin

Every AI feature demos beautifully.

You wire a model into a controller, type a sentence, and something remarkable comes back. The room goes quiet. Somebody says ship it.

Then it meets production, and you discover that the remarkable part was never the hard part. The hard part is the request that took ninety seconds. The one that came back as prose when you asked for JSON. The one where a user pressed the button eleven times and each press cost you money. The one where the model, asked politely, tried to create the same paid resource twice.

None of those are AI problems. They are the ordinary engineering problems you already know how to solve (timeouts, idempotency, rate limits, trust boundaries, retries) wearing an unfamiliar hat.

That is the whole argument of this book.

The model is the least interesting part of your AI feature.

What This Book Is About

This book is about building AI features in Laravel that survive real users: features that cost what you expected, fail in ways you planned for, and can be handed to another developer without a séance.

It uses a production system as its running example: a platform where a conversational agent gathers what somebody wants, checks it, verifies their email, and hands them a live website the moment they start a trial. That agent calls tools. Some of those tools have side effects that cannot be taken back. It has been wrong, it has been slow, and it has been talked into things. Everything in this book was learned by fixing that.

You will not find prompt-engineering folklore here, and you will not find a benchmark of six models. You will find the code around the model: the boundary that isolates the provider, the queue job that survives a turn that runs too long, the tool that refuses to create the same thing twice, the logging that tells you what happened when you cannot reproduce it.

Who This Book Is For

This book is for Laravel developers who are comfortable with HTTP, queues and testing, and who are about to put a model in front of their users, or who already did and are now living with the consequences.

You do not need to know anything about machine learning. Nothing in this book requires it. If you can write a FormRequest, dispatch a job and fake an HTTP client in a test, you have every skill this book asks for.

It is also for the team lead who has noticed that the code is now arriving faster than anybody can read it. Part IV is for you.

Checkout

Opening secure checkout

The audio could not be loaded. Try again in a moment.

Members only. Sign in to listen, it is free. Sign in