Consulting
Laravel AI Architecture
Architecture for Laravel systems that need AI in them: where models, tools and data live, how they are authorized and logged, and how the codebase stays legible while agents help write it.
Most teams that add AI to a Laravel application start in the right place: a controller, an API key and a prompt. It works in a demo. Six months later there are prompts in five places, nobody knows which model answers which question, the costs are a surprise every month, and the code the AI touched no longer looks like the rest of the codebase.
I help teams put AI into Laravel systems the way the rest of the system is built: with clear boundaries, explicit contracts and boring infrastructure. The stack that lets you ship and sleep, now with a model in it.
What this covers
- Where AI sits in the application. Which parts of the domain an LLM may read, which actions it may trigger, and which stay behind the existing services and policies. AI becomes a client of your application layer, not a shortcut around it.
- Model and provider choices. Laravel AI, direct provider SDKs or a gateway; which model for which job; how to switch when prices or quality change without touching business code.
- Tool and data layers. MCP servers, typed tool definitions, retrieval over your own data, and the authorization and audit trail every one of those needs.
- Async and cost control. Queues and Horizon for long-running calls, caching, rate limits, and the numbers you need on a dashboard before the invoice arrives.
- Evaluation. How you know an answer is good: fixtures, regression sets, and checks that run in CI like any other test.
Codebases that agents can work in
The other half of AI architecture is the code itself. Claude Code, Cursor and Codex now write a real share of most Laravel codebases, and they default to the common denominator unless you tell them otherwise.
I set up conventions that agents follow: domain-driven structure, actions instead of fat controllers, data objects instead of request classes, query classes for the read side, and stubs that act as executable specifications. They ship as a Laravel Boost skill, so every agent session starts with the same rules. The Laravel Playbook is the open-source version of this, and Kalimera scaffolds a new project with all of it wired in from the first commit: Pint, PHPStan, Rector, Vet, Boost and a guard that blocks destructive database commands while an agent is driving.
What you get
- A written architecture for the AI parts of your system: components, boundaries, data flows, and the decisions behind them.
- A working first slice in your codebase, reviewed and merged, that the rest of the work can copy.
- Conventions, stubs and agent guidelines your team and your agents both follow.
- A short list of what not to build yet.
When it fits
You run a Laravel application that matters to the business, you want AI in it rather than next to it, and you want it to still be maintainable in five years. It fits greenfield projects too, but it is most useful where there is an existing system with real data and real users.
I have been building with Laravel and Symfony for more than 15 years and I am CTO at Well Digit, where this is what we build every day.