laravel/ai
Unified Laravel API for AI providers like OpenAI, Anthropic, and Gemini. Build intelligent agents with tools and structured output, generate images, synthesize and transcribe audio, and create vector embeddings, all through one consistent, expressive interface.
Verdict: viable for a Laravel-native team building AI features in the next 1–2 quarters, but only under an explicit pre-1.0 discipline (pinned versions, wrapped boundaries, fakes-first testing). Do not treat it as a stable platform dependency yet.
Architecture fit
laravel/ai (MIT, Laravel org) with a facade/contracts/trait design: Agent + Promptable, Conversational, HasStructuredOutput, RemembersConversations, plus static entry points (Image::of(), Audio::of(), Transcription::fromPath(), Embeddings::for(), Reranking::of(), Stores::create()). This is idiomatic Laravel — service container resolution (Agent::make(user: $user)), queues, cache, filesystem disks, events, broadcasting. Low conceptual impedance for any team already fluent in Laravel.openai-php and anthropic-sdk-php together.Integration feasibility
composer require laravel/ai, publish config, set provider keys, write an agent class. Days, not weeks, to a working vertical slice.assertPromptedTimes, and queued-generation fakes that still execute then(...) callbacks. This lets CI run without live provider calls and without token spend — a hard requirement for most orgs and rarely available in raw SDKs.Technical risk (ranked)
TextDelta::combine streaming gluing fixed (0.9.1), embeddings cache-key collision fixed (0.10.2). Under 0.x semver, every minor can break you.gemini-3.7-flash); a DeepSeek model name was deprecated. Never rely on package defaults in production; pin provider + model explicitly per prompt.Key questions to resolve before committing
response->usage or meter independently?RemembersConversations persistence meet our data-retention and deletion requirements (GDPR/DSAR)?Stack fit
Migration path
openai-php/*, anthropic-sdk-php, hand-rolled Guzzle), do not do a lift-and-shift. Insert an internal seam first: define your own AssistantGateway/EmbeddingGateway interfaces in your domain layer, implement them with the current SDK, then re-implement behind laravel/ai. This keeps Laravel\Ai\* types from leaking into controllers, jobs, and models, and preserves an exit option.Compatibility
composer.json (e.g. 0.11.*), not a caret range that can drift into the next breaking minor. Bump deliberately, reading the changelog and running the full suite against fakes.php and Laravel framework minimums will move with the package; verify against your supported PHP matrix before scheduling the upgrade.Sequencing (indicative, one squad)
Maintenance
Support
Scaling and cost
queue() on agents — move all generation off the request path. That converts provider latency and 429s into queue backlog, which is observable and retryable.prompt() call accepts a per-prompt timeout) and cap iterations.Failure modes to design for explicitly
failed_jobs handling, and idempotency on retry (a retried agent run can double-charge tokens).Ramp-up
Overall recommendation: proceed to a 1-week spike, not a platform commitment. Gate broader rollout on (a) a pinned version that has survived your own conformance and eval suite, (b) a failover policy you have actually exercised, and (c) an exit seam that keeps Laravel\Ai out of your domain layer. Reassess for full adoption when a 1.0 or LTS commitment appears and dependent-package adoption provides third-party validation.
How can I help you explore Laravel packages today?