Repository navigation
Laravel, AI and blocking IO #59786
Replies: 5 comments 9 replies
This feels like a quite random suggestion—I've never heard of it 🤔 Also, it's not yet stable (expected end of the year). What I've heard of are
The relationship of true-async to the extensions is buried somewhere in the docs (true-async RFC 1, motivation). Apparently, it is a wrapper for Swoole (Swoole evidence) as well as an RFC for a native PHP implementation without extensions (true-async RFC 2). Then there's also a third RFC that I didn't find in the docs. |
|
laravel-spawn - Laravel Spawn is an async runtime for Laravel powered by PHP TrueAsync. You can test it now |
|
Laravel AI Agents can take a prompt via I've built a very busy AI app using this approach with Laravel Horizon and have no problems. You can also also broadcast responses from agents that have finished with |
|
I would be careful about treating AI workloads as one single async problem. In practice, there are at least three different paths:
For the second and third categories, Laravel's existing strengths are still very relevant: queues, Horizon, failed job handling, rate limits, events, notifications, policies, audit logs, and database-backed workflow state. I would usually avoid tying those operations directly to the HTTP request lifecycle. Put the AI call behind a job, persist the workflow state, give the user progress/status, and make retries/idempotency explicit. For truly interactive experiences, there are already viable patterns depending on the deployment model:
The bigger risk I see in AI applications is not only blocking I/O; it is unmanaged workflow authority. If an AI feature can access tools, data, or downstream systems, the application also needs approval gates, prompt/output logging, replayable job state, rate limiting, and clear failure handling. Laravel is actually strong in those areas. So I agree that async support matters, and projects like TrueAsync are worth watching. But I would not say Laravel is a non-starter for AI applications. I would separate latency-sensitive streaming from auditable AI operations, then choose the runtime pattern accordingly. For many institutional and regulated AI use cases, that separation is healthier than pushing everything into the request thread. |
Uh oh!
There was an error while loading. Please reload this page.
Hi!
I really love the Laravel ecosystem.
But the reality of long-running outgoing LLM HTTP calls makes Laravel a non-starter with regards to competing in the space of ai apps. Building an AI stack on a framework with blocking I/O is hard to defend.
I can't be the only one figuring this out, are there any plans from the Laravel team on this topic?
If not, i would urge the Laravel team to get involved in supporting or collaborating with the true-async project if there is a serious goal of being competitive as a framework for AI workflows and applications:
https://github.com/true-async
I have no affiliation with the project. I’ve just followed its progress and am impressed with its maintainer.
I genuinely believe it could become a cornerstone in securing Laravel’s competitive future.
I say it only because i believe in the work you've put into Laravel and want it to become successful. But as a user of it, PHPs blocking nature becomes undifensible in the AI era and with it hurting Laravels competiveness as a one stop shop.
Kindly Fredrik
All reactions