---
title: "Laravel AI SDK: How to Add AI to the Laravel App You Already Have"
description: "What the official Laravel AI SDK does, which AI features pay off in an app you already run, what to fix first, guardrails, costs and how Boost differs."
author: ["Yevhen Borovoi"]
date: 2026-11-28
updated: 2026-11-28
section: "Development"
language: en
canonical: https://peretz.agency/blog/laravel-ai-sdk-existing-app
publisher: "Peretz Agency"
---

# Laravel AI SDK: How to Add AI to the Laravel App You Already Have

> What the official Laravel AI SDK does, which AI features pay off in an app you already run, what to fix first, guardrails, costs and how Boost differs.

![A wooden library card catalogue with one drawer pulled open and a single red index card standing above the others](https://peretz.agency/photos/1/blog/laravel-ai-sdk-existing-app.jpg)

## Laravel now has its own first-party AI package. For a company that already runs a Laravel application, this changes the question from "should we rebuild for AI" to "which two or three features are worth adding to what we have". Here is what the SDK does, where it pays off, what has to be in place before you start, the guardrails we put around it and how it differs from Laravel Boost.

Over the past year, searches for "laravel ai sdk" in the United States grew by about 1,350 percent, according to Google Trends in November 2026, and "laravel agency" by about 200 percent. **Owners of Laravel products are asking a practical question:** can the system we already paid for get AI features without a rewrite, a new stack or a separate Python team?

For most applications on a supported Laravel version, the answer is yes. This article is for the people who make that call: founders, product owners and CTOs of companies with a working Laravel app. We have built on Laravel for eight to nine years. Today 17 Laravel projects are in our work, some of them run by our developers directly inside client teams, and this autumn we moved more than ten of them to Laravel 13. What follows is how we look at AI features in that kind of system.

### What the Laravel AI SDK is

The Laravel AI SDK is the official package `laravel/ai`, built and maintained by the Laravel team. Its first public version appeared on Packagist on 5 February 2026, version 1.0 on 23 September 2026, and version 1.4.2 on 23 November 2026. **By late November it had more than 16 million installs, about four million a month.** The Laravel 13 release notes present it as a first-party part of the framework's story, and the package also supports Laravel 12.

In plain terms, it gives your developers one way to talk to many AI providers. Text and agents work with OpenAI, Anthropic, Gemini, Azure, Bedrock, Mistral, Groq, xAI, DeepSeek, Ollama, OpenRouter and Cohere. Beyond text, it covers images, speech in both directions, embeddings for search, reranking, classification, files and vector stores.

The central idea is the agent: a PHP class that holds the instructions, the conversation history, the tools the model may call and, when you need it, a strict output schema. Your team creates one with `php artisan make:agent`, the same way it already creates controllers and jobs. That matters more for a business than it sounds. **The AI code lives inside your application, follows its conventions and passes through the same code review as everything else,** instead of sitting in a separate service that only one person understands.

> AI code that lives in your app gets reviewed like your app.

### Features that pay off in an existing app

The best AI features in a working system use data you already have and remove a step someone does by hand every day. Five patterns come up again and again in the products we see.

**Sorting what comes in.** Support tickets, leads, contact forms and returns arrive as free text. The SDK's classification and structured output can tag each one with a category, urgency and language, and route it to the right person before anyone reads it. This is usually the cheapest feature to build and the easiest to measure.

**Search over your own content.** Customers and staff search for what they mean, and keyword search finds only the words they typed. Laravel 13 added vector queries for PostgreSQL with pgvector, and the SDK generates the embeddings. A help centre, a product catalogue or an internal knowledge base can answer "a waterproof jacket for a child" with relevant results even when no page uses those exact words.

**Summaries of long records.** A CRM card with two years of notes, a support thread with forty messages, a medical or legal file. A summary at the top, built on request, saves minutes every time someone opens it.

**Reading documents into fields.** Invoices, applications, contracts and IDs arrive as PDFs or photos. An agent with an attachment and an output schema returns the fields your database expects, and a person confirms them. The schema is what makes this usable: your code gets typed values, not a paragraph to parse.

**An assistant that can look things up.** Tools let the model call your own code: find an order, check stock, read a delivery status. With tools the assistant answers from your data instead of from its general knowledge. We wrote separately about why a [website assistant is not a chatbot](https://peretz.agency/blog/ai-website-assistants-are-not-chatbots); the SDK is now the most direct way to build one inside Laravel.

What these five have in common is that each one is a single feature with a clear before and after. **None of them requires rebuilding the application,** and each can be switched off without breaking anything else.

### What has to be in place first

The SDK is easy to install. Most of the work we do before an AI feature goes live is about the application around it.

| Check | Why it matters |
| --- | --- |
| Laravel 12 or 13 | The package requires Laravel 12 or 13 and PHP 8.3 or newer. Laravel 11 no longer gets security fixes, so older apps should be upgraded first. |
| Queues that work | Model calls take seconds. The SDK can run an agent in the background with `queue`, which needs a working queue worker and monitoring. |
| A place for history | Conversation memory is stored in two database tables that the SDK's migrations create. Someone has to decide how long it is kept. |
| Data rules | Decide which fields may leave your servers, which provider and region receive them, and what must never be sent. |
| A budget line | Every response reports the tokens it used. Without a monthly limit and a dashboard, cost becomes a surprise. |

The first row decides more than the others. **If your app runs on Laravel 8, 9 or 10, the AI feature is the second project, not the first.** We described the path in [upgrading an old Laravel and PHP site](https://peretz.agency/blog/upgrading-old-laravel-php-site-2026) and in a real [Laravel 7 to 13 upgrade case](https://peretz.agency/blog/laravel-7-to-13-upgrade-case-study). The upgrade is useful on its own: it brings back security support and makes every later change cheaper.

The fourth row is where projects slow down, and it should. A support inbox contains names, phone numbers and order details. Before the first request leaves your server, someone has to write down what the feature may send and what it may never send. **The model does what it is asked, including what you forgot to forbid.** We see the same pattern in code written with AI, which we covered in [how to check code your contractor wrote with AI](https://peretz.agency/blog/contractor-ai-written-code-check).

### The guardrails we put around it

The SDK already contains most of the controls a careful team needs. Our job is to switch them on and decide the rules.

**Human approval for anything that changes data.** A tool that issues a refund, deletes a file or emails a customer can be marked as approvable. The agent stops, shows what it wants to do and continues only after a person confirms. Reading can be automatic. Writing waits for a human.

**A log of every step.** Agent middleware runs before each step is sent to the provider. We use it to record what was asked, which tools were called and what came back, with personal data masked. When a customer asks why the assistant said something, the answer is in the log.

**Cost per answer, not per month.** Each response carries its token usage, including cached and reasoning tokens. We store it next to the feature and the user, so the owner sees the cost of one sorted ticket or one summary.

**A backup provider.** You can pass a list of providers, and the SDK switches to the next one when the first is rate limited, overloaded or out of credits. Ordinary errors do not trigger the switch, which is the right behaviour.

**Tests that do not call the model.** Every agent can be faked in tests with fixed or computed answers, including answers that wait for approval. The rest of the application keeps its normal test suite, and a release does not depend on a paid API being up.

> Reading can be automatic. Anything that changes data waits for a person.

There is one risk the package cannot solve for you. When an agent reads text written by outsiders, such as emails, reviews or web pages, that text can contain instructions aimed at the model. We wrote about this in [prompt injection in AI coding agents](https://peretz.agency/blog/prompt-injection-ai-coding-agents), and the rule carries over: **an agent that reads outside text should not hold tools that can do damage.** Approval and narrow tools are how we keep the two apart.

### What an AI feature costs to build and run

There are two bills, and owners usually ask only about the first.

The build is ordinary Laravel work: the agent, its tools, the screens where people review results, the logs, the tests and the data rules. **A single feature on a healthy, upgraded app takes days to a few weeks, not months,** and most of that time goes into the review screens and the data rules. Our development rate is $45 to $100 an hour depending on seniority, and assistants that answer from your own data start from $5,000, or from $12,000 with integrations into your other systems. If the app first needs an upgrade, that is priced separately after an audit.

The run cost is the provider bill, and it depends on three numbers: how many requests a day, how long each prompt is, and which model you use. We do not quote provider prices in articles because they change every few months. We do something more useful in each project. **Before building, we run the feature on a sample of real requests and report the cost per 1,000 answers,** for two models side by side. The owner then decides with real figures.

Prompt caching helps more than most teams expect. OpenAI, Gemini and several other providers discount repeated prompt prefixes automatically. With Anthropic and Bedrock the SDK can mark the instructions and tool definitions for caching with two attributes. For an assistant with long instructions and many tools, this is often the largest single saving.

### Laravel Boost is for your developers

The second name in the Trends data, Laravel Boost, solves a different problem, and the two are often confused.

The AI SDK builds features for your users. **Boost helps the AI coding tools your developers use,** such as Claude Code or Cursor, write better Laravel code for your project. It is installed as a development dependency and gives those tools version-aware guidelines for Laravel and its packages, a way to inspect your application, and a documentation search over more than 17,000 pieces of Laravel knowledge. Teams can add their own rules in a `.ai/guidelines` folder, so the assistant follows the project's conventions.

The Laravel team adds a third name to the list: MCP, a way to let outside AI assistants work with your application. Its blog post on choosing between the SDK, Boost and MCP is worth reading before you plan.

For an owner, Boost matters in one way. AI coding tools are now part of almost every team's work, including ours, and their output is only as good as the context they get. **Clean Laravel code with clear conventions is one of the easiest kinds of code for these tools to work with,** and in our experience it takes fewer tokens to change than a large CMS. A project with written guidelines gets more consistent changes from every developer and every tool that touches it.

### How we work with AI in Laravel projects

We use AI coding tools every day on Laravel projects, under the same rule as any other code: a person reads each change before it is merged, and the project has to run for someone other than its author. That rule holds across all 17 of our current Laravel projects, including those where our developers work directly inside a client's team, and it is how this autumn we moved more than ten sites and portals to Laravel 13, several of them in three languages.

On the product side, we work the same way the SDK encourages. A recent example is a shopping assistant for a clothing brand. **Before anything touched the live store, we built a sandbox prototype on public catalogue data only,** wrote 25 test questions that real customers ask, compared two models and measured the cost per 1,000 conversations. Only after that does the owner decide whether the feature goes into the store, and how.

We also keep a habit that sounds old fashioned: we check whether the task needs a model at all. The search on our own site runs on full-text search, synonyms in three languages and correction of text typed in the wrong keyboard layout, with no AI and no paid service. It answers in milliseconds and costs nothing per query. **A model is the right tool when the task needs judgement over messy text,** and plain code remains the right tool when it does not.

### When to wait, and where to start

Three situations call for a pause before any AI feature.

The first is an unsupported Laravel version. Upgrade first, then build. The second is when nobody can say what success looks like: "add AI" is not a feature, while "sort 80 percent of tickets without a person" is one. The third is data you are not allowed to send to a provider. That can sometimes be solved with a model hosted in your own environment, which the SDK also supports through Ollama, but it is a separate decision with its own cost.

For everyone else, a sensible start is small. Pick one repetitive task, measure how long it takes today, build the feature behind approval and logs, and run it on real cases for a few weeks. **If it saves time and the cost per answer makes sense, extend it. If it does not, switch it off,** and you have lost little. Our articles on [what Laravel development costs](https://peretz.agency/blog/how-much-does-laravel-development-cost) and on [Laravel support and maintenance](https://peretz.agency/blog/laravel-support-and-maintenance-cost) cover the rest of the budget.

### Frequently asked questions

#### Do we need to rebuild our application to add AI features?

No, if the app runs on Laravel 12 or 13. The SDK is a Composer package that lives inside the existing application. Older versions should be upgraded first, which also restores security support.

#### Which AI provider should we choose?

Choose by the task, the data rules and the measured cost per answer. The SDK lets you switch providers through configuration and set a backup provider, so the first choice does not lock you in.

#### Will customer data be used to train the provider's models?

That depends on the provider, the plan and the settings, and it should be checked in the contract for business use. Independently of that, we decide which fields may be sent at all and mask the rest before anything leaves your server.

#### Is the Laravel AI SDK stable enough for production?

It reached version 1.0 in September 2026 and is maintained by the Laravel team, with releases every few weeks. Treat it like any other dependency: pin versions, read the changelog and keep tests that fake the model.

#### What is the difference between the AI SDK and Laravel Boost?

The AI SDK builds features your users see. Boost is a development tool that gives AI coding assistants Laravel guidelines and documentation, so they write better code for your project. Many teams use both.

#### How do we keep the running cost under control?

Store the token usage of every response, set a monthly limit, cache long instructions and choose the smallest model that passes your test questions. Measure the cost per 1,000 answers before launch, not after.

**Sources**

- [Laravel documentation: Laravel AI SDK](https://laravel.com/framework/docs/ai-sdk)
- [Laravel 13 release notes](https://laravel.com/framework/docs/13.x/releases)
- [Laravel documentation: Laravel Boost](https://laravel.com/framework/docs/13.x/boost)
- [Laravel blog: Laravel AI SDK, Boost, or MCP: Which Tool Do You Need?](https://laravel.com/blog/laravel-ai-sdk-boost-or-mcp-which-tool-do-you-need)
- [Packagist: laravel/ai](https://packagist.org/packages/laravel/ai)

**Want AI features in your Laravel app without a rewrite? Let's look at which ones will pay off.**

[Book a Strategic Session](https://peretz.agency/services/strategic-session)

[Laravel Development](https://peretz.agency/services/laravel-development)

---

Source: Peretz Agency, https://peretz.agency/blog/laravel-ai-sdk-existing-app
