> ## Content Index
> Fetch the complete content index at: https://www.artisancraft.dev/llms.txt
> Use this file to discover other available public pages before exploring further.

# Laravel finally has an official AI SDK. Here's why it matters.
- URL: https://www.artisancraft.dev/laravel-finally-has-an-official-ai-sdk-here-s-why-it-matters/
- Published: 2026-02-06T11:47:20.000Z
- Updated: 2026-02-06T11:47:20.000Z
- Description: Taylor Otwell just dropped something big: an official, first-party AI SDK for Laravel.
- Author: Daniel Plomp
- Tags: laravel, ai, php

Taylor Otwell just dropped something big: an official, first-party AI SDK for Laravel.

This is a proper, batteries-included SDK built by Taylor himself — with the same attention to developer experience you'd expect from Laravel.

After digging through [the documentation](https://laravel.com/docs/12.x/ai-sdk?ref=artisancraft.dev), I think this changes the game for AI in PHP.

---

## A unified API for multiple providers

The Laravel AI SDK (`laravel/ai`) gives you a unified API to work with multiple AI providers:

| Feature        | Providers                            |
| -------------- | ------------------------------------ |
| **Text/Chat**  | OpenAI, Anthropic, Gemini, Groq, xAI |
| **Images**     | OpenAI, Gemini, xAI                  |
| **Audio**      | OpenAI, ElevenLabs                   |
| **Embeddings** | OpenAI, Gemini, Cohere, Jina         |

The SDK also integrates deeply with Laravel's ecosystem — queues, events, broadcasting, testing.

---

## Dedicated agent classes

Instead of scattering AI logic across your codebase, you define dedicated Agent classes:

```bash
php artisan make:agent SalesCoach

```

```php
class SalesCoach implements Agent, Conversational, HasTools
{
    use Promptable;

    public function instructions(): string
    {
        return 'You are a sales coach helping reps improve their calls.';
    }

    public function tools(): iterable
    {
        return [
            new RetrievePreviousTranscripts,
        ];
    }
}

```

Clean. Testable. Laravel-like.

---

## Conversation memory out of the box

Most AI wrappers make you handle conversation history yourself. Laravel AI SDK includes a trait:

```php
use Laravel\Ai\Concerns\RemembersConversations;

class SalesCoach implements Agent, Conversational
{
    use Promptable, RemembersConversations;
}

// Start conversation
$response = (new SalesCoach)->forUser($user)->prompt('Hello!');

// Continue later
$response = (new SalesCoach)
    ->continue($conversationId, as: $user)
    ->prompt('Tell me more...');

```

Conversations are stored in your database automatically.

---

## Streaming and broadcasting

Stream responses to clients with native Laravel Events integration:

```php
// Streaming endpoint
Route::get('/coach', function () {
    return (new SalesCoach)->stream('Analyze this transcript...');
});

// Or broadcast to a channel
$stream = (new SalesCoach)->stream('Analyze...');
foreach ($stream as $event) {
    $event->broadcast(new Channel('analysis-results'));
}

```

Works with Vercel AI SDK protocol out of the box.

---

## Automatic failover between providers

Configure multiple providers, and the SDK falls back automatically:

```php
$response = (new SalesCoach)->prompt(
    'Analyze...',
    provider: ['openai', 'anthropic'],  // Falls back to Anthropic if OpenAI fails
);

```

No manual retry logic needed.

---

## Vector search with pgvector

The SDK includes built-in support for RAG workflows:

```php
// Migration
$table->vector('embedding', dimensions: 1536)->index();

// Query
$documents = Document::query()
    ->whereVectorSimilarTo('embedding', 'best wineries in Napa Valley')
    ->limit(10)
    ->get();

```

Your PostgreSQL handles it directly.

---

## Complete testing fakes

Laravel's testing philosophy extends to the AI SDK:

```php
SalesCoach::fake(['First response', 'Second response']);

// Make your API call
$response = (new SalesCoach)->prompt('Analyze this...');

// Assert it happened
SalesCoach::assertPrompted('Analyze this...');

```

Fakes exist for agents, images, audio, embeddings, vector stores — everything.

---

## Compared to Prism

[Prism](https://prismphp.com/?ref=artisancraft.dev) has been my go-to for Laravel AI integration. It's excellent. Here's an honest comparison:

|                       | Laravel AI SDK    | Prism     |
| --------------------- | ----------------- | --------- |
| **Maintainer**        | Laravel core team | Community |
| **Images/Audio**      | ✅                 | ❌         |
| **Vector stores**     | ✅ Built-in        | ❌         |
| **Broadcasting**      | ✅ Native          | ❌         |
| **Queueing**          | ✅ Native          | Manual    |
| **Testing fakes**     | ✅ Complete        | Basic     |
| **Long-term support** | ✅ Guaranteed      | Uncertain |

Prism isn't going anywhere, and if you're already using it, don't panic. But for new projects? Laravel AI SDK is the obvious choice.

---

## AI as a first-class citizen

Beyond the features, the signal matters.

Laravel now treats AI as a core part of the ecosystem.

That means:

- Documentation that matches Laravel's standards
- Testing patterns that feel native
- Integration with queues, events, broadcasting
- Long-term maintenance by the core team

For PHP developers who felt left behind in the AI wave, this is a big deal.

---

## When to use it

**Use Laravel AI SDK when:**

- Starting a new Laravel project with AI features
- You need multi-provider support
- Building complex agents with tools and memory
- You want RAG without a separate vector database
- Testing is important (it should be)

**Wait if:**

- You're deep in a Prism-based project (migration path TBD)
- You need Ollama/local models (not yet supported)
- Your project goes live next week (it's still `0.x`)

---

## Coming soon: stable release

The SDK is in preview now (`0.x`). A [livestream on February 9th](https://laravel.com/ai?ref=artisancraft.dev) with Taylor Otwell and Josh Cirre will likely announce the stable release alongside Laravel 13.

If you're building AI features in Laravel, bookmark that date.

---

*The* [*documentation*](https://laravel.com/docs/12.x/ai-sdk?ref=artisancraft.dev) *is already excellent — worth a read even if you're not planning to use it immediately.*

[![CTA Image](https://storage.ghost.io/c/8f/6e/8f6ec642-540e-4f85-ac9b-beb628cb9cfd/content/images/2025/10/symbol-2.png)](https://www.artisancraft.dev/consulting-services/) 

I offer hands-on consulting to help you resolve technical challenges and improve your CMS implementations.

Get in touch if you'd like support diagnosing or upgrading your setup with confidence.

[Learn more ](https://www.artisancraft.dev/consulting-services/)