Building AI features used to mean wrestling with complex Python scripts or fragmented APIs. Laravel has changed the script. With the release of the first-party Laravel AI SDK, the world’s most popular php web framework now offers a native, elegant way to integrate intelligence into your applications.
This isn't just a wrapper for OpenAI. It is a full-featured toolkit designed for the modern php developer tools ecosystem. You can now build chatbots, generate content, and implement vector search using the same syntax you love.
The Philosophy: AI as a First-Class Citizen
Laravel thrives by removing friction. The Laravel AI SDK follows this tradition. It provides a unified API that abstracts away the differences between providers like OpenAI, Anthropic, and Google Gemini.
You no longer need to rewrite your logic when you swap models. The SDK treats AI as a core service, much like your database or cache. It’s built to help you build rest api with php that can think, reason, and act on your behalf.

Agents: Your AI Logic in PHP Classes
The core of the SDK is the "Agent." Instead of messy prompt strings scattered throughout your controllers, you define agents as dedicated PHP classes.
An agent contains its own instructions, memory, and tools. This structure keeps your code clean and testable. You can give an agent a specific role, such as a "Content Strategist" or a "Technical Support Representative."
By wrapping AI logic in classes, you maintain the "joyful development" experience Laravel is known for. You can inject these agents into your services and call them with simple methods.
Building Intelligent Features
The SDK covers the full spectrum of modern AI requirements.
Text and Structured Output
Generating text is the baseline. The real power lies in structured output. You can force an agent to return a specific JSON schema. This makes it easy to save AI-generated data directly into your database without fragile parsing logic.
Audio and Vision
The SDK handles more than just text. You can generate speech from text (TTS) or transcribe audio with speaker diarization. Image generation via DALL-E or xAI is also supported with a single line of code.
Vector Search and RAG
Retrieval-Augmented Generation (RAG) is the gold standard for accurate AI. The SDK includes built-in support for vector embeddings and similarity search. You can store your data in a vector store like Postgres with pgvector and query it using semantic search.

Performance: Streaming and Queues
AI operations are often slow. If you make a user wait 30 seconds for a response, they will leave. Laravel provides two ways to handle this.
First, you can use streaming. By integrating with Livewire or Inertia, the SDK can push tokens to the frontend as they are generated. The user sees the response appearing in real-time.
Second, you can offload heavy tasks to queues. Instead of calling prompt, you call queue. Laravel’s built-in queue system handles the background processing. When the AI is finished, it can trigger an event or update the UI via WebSockets.

Laravel Boost: Enhancing Your Workflow
While the AI SDK helps you build features for your users, Laravel Boost helps you write the code itself.
Boost is a specialized tool that optimizes how AI agents understand your Laravel project. It ensures that when you use an AI coding assistant, it generates idiomatic Laravel code that follows the latest best practices. It bridges the gap between general AI knowledge and your specific application context.
Testing and Reliability
Production AI applications must be reliable. The SDK includes first-class testing fakes. You can simulate agent responses, image generation, and even vector store operations. This allows you to run your test suite without hitting expensive API limits or waiting for slow network calls.
The SDK also supports automatic failover. If your primary provider (like OpenAI) goes down, the SDK can automatically switch to a fallback provider (like Anthropic). Your app stays online, and your users never notice a thing.

Getting Started
Ready to build the next generation of intelligent apps? The journey starts with a simple composer command.
composer require laravel/ai
After installing, you can publish your configurations and start defining your first agent. The official Laravel documentation and Laracasts offer deep dives into every feature.
Whether you are a solo indie maker or part of a large enterprise, the Laravel AI SDK gives you the tools to ship faster and smarter. Your story belongs in the next wave of AI-powered development.
We'd love to hear what you're building. Connect with the community and start shipping features that were impossible just a few years ago.