A FIELD GUIDE TO LARAVEL · VOLUME II · THE ECOSYSTEM
ENTRY II.47 · AI AGENTS
AI SDK
Laravel\Ai · Package · first recorded 5 February 2026, v0.1.0 on Packagist; v1.0 on 23 September 2026
One API for every model provider, in the shape of the framework: an agent is a class, a tool is a class, a conversation is rows in your database, and a tool that matters pauses for a person. Prompt, stream or queue the same agent.
Specification
Kind Package. Agents and tools as classes; two tables for conversations
Interface Promptable: prompt(), stream(), queue(), broadcastOnQueue(); JsonSchema out
Runs on OpenAI, Anthropic, Gemini, Azure, Bedrock, Groq, xAI, Mistral, Ollama +
Installed by composer require laravel/ai · vendor:publish · migrate
Voice make:agent · make:tool · make:agent-middleware
Scales by Failover across providers on a rate limit; ToolSearch defers rare tools
Range Cloud: yes. Queued runs on managed queues, keys in secrets
Forge, VPS: yes, the same, with a queue worker
Vapor: yes; API Gateway stops a request at 30 s, so long runs go on the queue
Neighbours
Laravel MCP faces the other way: it exposes your app's tools to an outside AI client, and the SDK can take tools from MCP servers through its client. Boost serves the agent writing your code, not agents your app runs. Here a conversation is rows in your database.
Field marks
config/ai.php
ANTHROPIC_API_KEY · OPENAI_API_KEY
app/Ai/Agents/ · app/Ai/Tools/
agent_conversations table
Fig. II.47.1 · One agent turn, with approval
Parts
1 Agent. A class with instructions(), tools() and optionally schema(); Promptable adds prompt() and stream().
2 Middleware, once per step, not per prompt: swap the model, trim the messages, take a tool away once it has been used.
3 Provider. OpenAI, Anthropic, Gemini or any of a dozen, chosen per call; a list [Lab::OpenAI, Lab::Anthropic] fails over.
4 Tool. schema(), description(), handle(Request $request); a validation failure goes back to the model to retry.
5 Approval gate. An Approvable tool pauses the turn; pendingApprovals lists each call and its reason until a Decision lands.
6 Conversation store. agent_conversations and agent_conversation_messages, one row per turn, a steps entry per round-trip.
Hidden joinery
Failover fires only on a FailoverableException: rate limit, overloaded provider, no credits; a bad request does not. Anthropic and Bedrock cache prompts only when asked, with #[CacheInstructions]. Embeddings are cached with ai.caching.embeddings.cache on. Paused turns match by conversation, not participant: check ownership.
Every line checked on 2026-10-08 against docs, source, Packagist and The Monitor; see the ledger.
TITLE
AI SDK · one agent turn
SOURCES
laravel.com/docs/13.x/ai-sdk · github.com/laravel/ai · packagist.org/packages/laravel/ai · laravel.com/blog/introducing-laravel-ai-sdk-v1 · laravel.com/blog/everything-we-announced-at-laracon-us-2026 · docs.vapor.build/projects/environments · laravel.com/cloud/docs/queues · laravel.com/docs/13.x/mcp · laravel.com/docs/13.x/boost · Monitor 7, 556
STATUS
Verified · 2026-10-08
SHEET
II.47 of 48
REV
A · 2026-10-08
DRAWN
BS
FINISH
All faces, including the back