What the Laravel AI SDK gives you
Laravel now has a first-party package for this, laravel/ai, which means less custom plumbing and a code style your team already knows. This is what it does, according to the official documentation.
- Agents
- An agent is a PHP class with its own instructions, created with php artisan make:agent. It can be prompted directly, streamed or queued.
- Tools your application controls
- php artisan make:tool defines what an agent may do in your system, with a schema for its arguments. Tools can also come from MCP servers.
- Human approval
- A tool that implements Approvable waits for a person before it runs, and can decide case by case. Deleting a record or sending a refund should work this way.
- Structured output
- An agent with HasStructuredOutput returns data matching a JSON schema, so your code can read a score or a category rather than parse prose.
- Document search
- Embeddings, reranking, vector stores and the SimilaritySearch tool let an agent answer from your own documents and data.
- Conversations
- The package's migrations create agent_conversations and agent_conversation_messages tables, so chat history is stored in your own database.
- Streaming and queues
- Stream replies over server-sent events, including the Vercel AI SDK protocol, or use queue() with then and catch callbacks for long-running work.
- Failover
- Pass a list of providers and the SDK moves on when one is rate-limited, overloaded or out of credits. A bad request does not trigger failover, which is what you want.
- Images, audio and transcription
- The same package covers image generation, text to speech and speech to text, each with its own list of supported providers.
- Testing without API calls
- Agents can be faked in tests with fixed responses, and assertPrompted checks what was sent, so the suite stays fast and costs nothing to run.
Source: Laravel AI SDK documentation.