Skip to main content
AI Aug 20, 2026 · 86 views

Building a Local-First AI Workflow Visualizer with Laravel

I combine the Laravel AI SDK, locally-running LM Studio Qwen-3.5 model, queue workers and reverb broadcasting to build a visual AI workflow application, with pre and post processing actions to enhance results.

AI Laravel
Building a Local-First AI Workflow Visualizer with Laravel

There is something uniquely satisfying about building software that runs entirely on your own machine. It removes the latency of cloud APIs, eliminates privacy concerns regarding sensitive data, and gives you total control over the inference process. Recently, I embarked on a journey to build an AI Workflow Visualiser, a locally running application designed to visualise how complex AI tasks are orchestrated.

The goal wasn't just to run a model; it was to understand the architecture required to make that model feel responsive, intelligent, and integrated within the Laravel ecosystem. Here is my reflection on building this tool using Laravel, the new Laravel AI SDK, LM Studio, and real-time broadcasting.

The Architecture: Orchestration with the Laravel AI SDK

The foundation of this project was the decision to move away from generic API wrappers and embrace Laravel 13's native AI capabilities. By integrating the Laravel AI SDK, I gained a robust abstraction layer that handles model registration, context management, and prompt templating out of the box.

For the actual inference engine, I chose LM Studio running locally on my machine. LM Studio is an excellent choice for local development because it supports quantized models efficiently and provides a simple HTTP server interface. Another option would be Ollama, which I have had success with in the past but for this project I wanted the more human-readable user interface of LM Studio to see when requests were hitting the model. I configured the Laravel application to register the Qwen-3.5 4B model via the SDK's default provider and model setting in the .env file, pointing it to the local LM Studio endpoint.

This setup allowed me to treat the local LLM not as an external dependency but as a first-class citizen within the Laravel service container. The SDK abstracts away the HTTP polling often required with older local servers, providing a clean, synchronous interface that fits perfectly into Laravel's request lifecycle.

Real-Time Features: Bridging Queues and Broadcasting

A common pitfall in AI applications is the "cold start" latency. Users expect immediate feedback, but LLM inference takes time. To solve this while maintaining a responsive UI, I implemented a hybrid architecture combining Laravel Queues and Reverb.

The Queue Strategy

Instead of blocking the HTTP request for the full generation time, I offloaded the heavy lifting to background jobs. When a user submits a prompt:

  1. 1. Laravel validates the input and queues the processing job immediately.
  2. 2. The controller returns a "Processing..." state instantly.
  3. 3. A worker picks up the job, executes the inference against Qwen-3.5 via the SDK, and stores the result in the database.

Reverb for Real-Time Updates

While queues handle the heavy computation, Laravel Reverb handles the user experience. I configured a channel where the background job publishes progress events (e.g., "Token 10/20 generated," "Finalising output") as they occur. The frontend listens to this channel and updates the visualiser in real-time without polling.

This combination ensures that even though the AI is thinking, the user feels like they are interacting with a live system. It transforms a potentially janky, laggy experience into a smooth, fluid workflow.

AI Workflow Logic: The Multi-Agent Pattern

The true power of this visualiser lies in its logic. Rather than sending raw user input directly to the model, I implemented an idea that I've been toying with a lot recently, the Multi-Agent Pattern, using custom prompts and context injection within the Laravel SDK. This enables me to send the raw user input to an agent for clean up and optimisation before it even hits the main processing agent, after all, who better to prompt the AI than a similar AI?

1. The Pre-Processing Agent

Before any generation occurs, the workflow invokes a dedicated "Pre-Processor" agent. This agent receives the user's raw prompt and applies specific constraints:

  • - It normalises formatting issues (e.g., fixing broken markdown).
  • - It expands vague queries into structured instructions suitable for Qwen-3.5.
  • - It injects relevant context from our local knowledge base if available.

This step acts as a filter, ensuring the main model only receives high-quality, optimised inputs, significantly reducing hallucinations and improving response relevance. Giving the agent everything it would expect or need for theoretically better average results, without too much concern over cost of the additional processing since its all running locally anyway.

2. The Post-Processing Agent

Once the Qwen-3.5 model generates its output, it doesn't just end there. A second agent, the "Verifier," takes over. It compares the generated text against the original user intent (which was preserved during pre-processing).

  • - If the output satisfies the constraints, it is returned to the UI.
  • - If not, the Verifier attempts a refinement loop or flags an error for manual review.

This additional two-stages of logic mimics human editorial workflows, ensuring that the AI's creativity is balanced with strict adherence to user requirements.

Reflection on Laravel AI Ecosystem Growth

Looking back at this journey, it is clear that the Laravel AI ecosystem has matured beyond just a production-ready infrastructure. The ability to seamlessly integrate local models like Qwen-3.5 via the SDK demonstrates how well-maintained and forward-thinking the framework's community is.

The components I utilised, from orchestration through the SDK, real-time communication via Reverb, and complex logic handling through multiple agents are no longer experimental features; they are building blocks for robust applications. This project proved that a "local-first" approach isn't just about privacy; it's about creating cohesive, responsive workflows where the AI feels like an extension of the application itself.

As we look to the future, I am excited to see how Laravel continues to evolve its AI tooling. The path forward involves deeper integration with vector databases for RAG (Retrieval-Augmented Generation) and perhaps even native support for multi-modal inputs directly within the framework. But for now, having built a visualiser that runs entirely on my machine, I feel confident in the direction this ecosystem is taking: empowering developers to build intelligent, private, and highly responsive applications with unprecedented ease.


If you're interested in the source code, find it on GitHub.

Share this post

Help others discover this content

© 2026 Anders Learmonth. All rights reserved. This article is original content and may not be reproduced, copied, or republished without written permission. Please link back with attribution if you reference or quote this work.

Keep reading

Related Posts

Perfect is the enemy of good enough
AI Mar 30, 2026

Perfect is the enemy of good enough

Embracing "Good Enough": How AI is Revolutionizing My Creative Process

Read more
Embracing Github Copilot to reduce tech debt in personal projects
AI Apr 17, 2026

Embracing Github Copilot to reduce tech debt in personal projects

The whole is greater than the sum of its parts, and AI is allowing me to finish off more parts than ever.

Read more
I've still never tried Claude Code
AI Apr 22, 2026

I've still never tried Claude Code

Am I the only person not using Claude?

Read more

Enjoyed this post?

Get more like this
in your inbox

No spam, ever. Just occasional updates when I publish something worth reading.

No spam, ever. Unsubscribe any time.

This site uses essential cookies to keep you securely logged in and to protect against CSRF attacks. No tracking or advertising cookies are used. By continuing to use this site you consent to these essential cookies. Read our Privacy Policy for full details.

Learn more