Sulat.com / Writing on AIFriday, December 4, 2026
Enter →
Agent Engineering/4 December 2026

A hands-on guide to Laravel Converse’s web chat

Converse's built-in web chat streams replies, survives a reload and holds risky tool calls behind Approve and Reject. I built one with Codex, ran every step and broke it on purpose.

Red glass 3D Laravel logo sending a ribbon of glowing text into a frosted glass chat window, with an orange reconnect loop.
Illustration: Sulat, featuring the Laravel logo

At a glance

  • Converse ships a web chat that converse:install scaffolds into a React or Vue starter kit: a streaming chat page, tool pills, approval cards, file uploads and history.
  • I set one up on Laravel 13 and let Codex write a support desk agent with an order lookup tool and a refund tool that waits for approval.
  • Replies are written to an event log in your database and the browser reads from it, so a reload mid-reply picked up where it left off and an approval card survived a reload.
  • A message typed while the bot is answering is queued, interrupts the reply or is dropped, depending on one prop. A queued message is lost if you reload.
  • Without a queue worker the chat says Thinking for ever and shows no error, and php artisan serve froze page reloads for 9 to 10 seconds during a reply.

Laravel Converse launched on 1 December with a web chat that php artisan converse:install adds to a starter kit: a streaming chat page, tool calls, approval cards, file uploads and history. I set one up, had Codex write the agent, and tested what happens when a reply is interrupted, a worker is missing or a connection drops. This is the guide I’d want, with every step run.

My earlier Agent Kit and Converse hands-on skipped the web chat. The wider launch is in my roundup.

What launched

Converse is Laravel’s package for putting one agent on Slack, Telegram, GitHub and your own web pages. The web chat pairs a bot registered on the web connection with a Chat component from @laravel/converse-react or @laravel/converse-vue. Each message becomes a turn that runs on your queue, and every event of the turn is stored in your database. By default the browser reads those events over a server-sent event stream. A setting switches it to polling every two seconds.

That storage detail explains most of what follows. The reply doesn’t travel down the connection that sent the message. It’s written to a log, and the browser reads the log.

Flow: browser sends message, Laravel replies 202, queue worker runs the agent and writes to an event log the browser reads from.
The reply is written to a log and the browser reads the log.

Set it up

You need PHP 8.4, Node, a queue worker and an OpenAI key, because a new Laravel AI SDK app uses OpenAI by default. My versions were Laravel 13.45.0, Converse 1.0.2, the AI SDK 1.5.0 and Inertia 3.8, on the React starter kit.

  1. Create the app from the React starter kit’s main branch. The tagged release pulled in Laravel 12, which Converse wouldn’t install on.
Code
composer create-project laravel/react-starter-kit:dev-main chat-app
cd chat-app
cp .env.example .env
php artisan key:generate
php artisan migrate
  1. Add Converse and run its installer. Say yes to the web chat prompt. It registers an assistant bot on the web connection, publishes the web chat migration, the chat page and its components, adds the /chat routes and offers to install and build the frontend package.
Code
composer require laravel/converse
php artisan converse:install
php artisan migrate
npm install && npm run build
  1. Put the queue on the database and add your key to .env, then start a worker. Without one, nothing replies.
Code
QUEUE_CONNECTION=database
OPENAI_API_KEY=your-key

php artisan queue:work
  1. Serve the app with nginx and PHP-FPM, not php artisan serve. I explain why under what goes wrong. Sign in, then open /chat. The route needs a verified user.

Two setups that don’t work: a plain laravel/laravel app, where the installer published no chat page because there’s no React or Vue to publish it into, and the tagged starter kit, for the reason above. Use a starter kit on Laravel 13.

Let Codex write the agent

The installer leaves you a stock Assistant agent. I turned it into a support desk assistant for a small New Zealand shop with Codex CLI on my ChatGPT subscription, in one run. This is the prompt, word for word.

Code
This is a Laravel 13 app with Laravel Converse installed. `php artisan converse:install` has already run and the web chat scaffold is live at /chat.

Turn app/Ai/Agents/Assistant.php into a support desk assistant for a small online shop.

1. Add an orders table, an Order model and a seeder with 12 orders across 4 customers (order number, customer name, item, total in NZD, status).
2. Add a LookupOrder tool that returns an order by its number.
3. Add a RefundOrder tool that needs human approval before it runs, using the AI SDK's tool approval support so that Converse's web chat shows its Approve and Reject card. When approved it marks the order refunded.
4. Add the AI SDK's web search provider tool.
5. Write the agent's instructions so it answers in Markdown, and uses a table whenever it lists orders.

Do not edit anything under resources/js and do not read .env. Run the migration and the seeder, then check your work with `php artisan converse:list` and by calling each tool directly from `php artisan tinker`.

Codex wrote the migration, model, seeder and both tools, ran them and checked each tool in tinker. The part that matters is the approval gate. A tool opts in by implementing Approvable and using InteractsWithApprovals, and the SDK then pauses every call to it until a person decides.

Code
class RefundOrder implements Approvable, Tool
{
    use InteractsWithApprovals;

    protected function needsApproval(Request $request): Approval
    {
        return Approval::required('Approve marking this shop order as refunded.');
    }

    // handle() validates order_number, uppercases it and updates the status
}

The agent registers its three tools in tools(), and routes/bot.php keeps the one line the installer wrote.

Code
public function tools(): iterable
{
    return [new LookupOrder, new RefundOrder, new WebSearch];
}

// routes/bot.php
Converse::agent('assistant', Assistant::class)->connections(['web']);

One requirement isn’t obvious. An agent on the web connection needs the RemembersConversations trait so Converse can store its history. Codex’s agent kept it from the stock one. The recording below shows the finished app: a reply streaming, a reload in the middle of it, then a refund waiting for approval.

Reload mid-reply, then approve a refund. Nothing was edited or sped up.

Streaming and Markdown

I asked for a retry explainer with a table, a PHP example and a numbered list of pitfalls, and repeated it three times. The first text arrived after 4.7 to 6.5 seconds, which includes the model’s web search. The table appeared 6.5 to 10.6 seconds in, the code block 10 to 15 seconds in, and the full answer of roughly 2,500 characters was finished in 14.7 to 19.4 seconds. Each run produced one table, one code block and five list items.

On the wire, the text arrives in batches. Converse’s event writer groups streamed text into batches of up to 32 events, and my raw capture showed a batch of 32 roughly every half second. The page renders Markdown as it goes, so a table shows its header before its rows, as in the capture below.

Converse web chat mid-reply with a web search chip, a paragraph on retries and the first table header already drawn.
A table draws its header first and fills in as the reply streams.

Reloads and dropped connections

This is the feature I came for. Each event in the log has a sequence number, and the stream endpoint takes an offset, so a client that lost its place asks for everything after the last number it saw. I reloaded the page in the middle of a reply three times and took the browser offline in the middle of one twice. Every time the reply finished, in one assistant message, with no repeated lines.

I compared the text on the page with the saved reply in the database. They matched except for the language labels on code fences, which the page doesn’t show, and the words of citation URLs, which the page shows as a source chip.

Checklist: streaming reply, approval card and dropped connection survive a reload; a message queued while it answers is lost.
Three of the four survive. The queued message doesn’t.

Tools and approvals

A lookup shows as a pill above the answer, and clicking it expands the call. The agent answered an order number with a table row. When I asked about a customer by name, it said it can only look orders up by number and asked for the numbers, which is what its instructions told it to do.

For a refund, the turn stops on a card with the tool’s message, the argument it chose and two buttons. While the card was waiting, the order was still shipped in the database. The card was still there after a reload. Approve took about five seconds to finish, the order became refunded and the agent reported it. On a second order, Reject left the order untouched and the reply said the refund was declined.

Converse web chat card reading Refund Order needs approval, order_number NZ-1002, with Approve and Reject buttons.
The agent has asked to refund NZ-1002. Nothing runs until someone clicks.

Typing while it answers

The queue prop on Chat decides what happens when someone sends a message during a reply. I tried all three on a long answer.

ModeWhat happened
queue (default)The second message appeared greyed out with a Queued label and started when the first reply finished, 9.7 seconds later.
interruptThe first reply stopped and showed Stopped. The second message was answered straight away with 42.
dropThe second message wasn’t sent and stayed in the text box.
The same long answer, three values of one prop.

The Stop button ended a reply in 98 milliseconds. The run was marked cancelled, the text stayed as it was and the next message went through. Laravel’s docs say an interrupted turn stops at the next streamed event, and the provider still bills for tokens already generated. I changed the prop in the published chat.tsx and rebuilt for each test, then restored it.

Converse web chat mid-reply with a second message greyed out and labelled Queued, and a Stop button in the composer.
In the default mode a second message waits its turn.

Files, history and limits

Files. The composer accepts JPEG, PNG, GIF, WebP, PDF, plain text and CSV, up to 10 MB each and five per message. I attached a PNG of a support ticket and the agent read the ticket number out of it. A CSV of pending orders answered a question about which customer was waiting. An 11 MB text file was refused with “The attachment may not be larger than 10 MB”, a Word document with “The attachment type is not allowed”, and a sixth file with “The turn may carry at most 5 attachments”. Pasting an image into the box adds it as an attachment too.

History. I seeded a conversation with 120 messages. The page loaded the latest 50 and fetched older ones as I scrolled to the top, until all 122 were there. The installer’s page already wires this to Inertia’s infinite scroll.

Rate limit. Converse allows 10 turns a minute per user per bot. I sent 11. The eleventh got a 429 and the page showed “Too many messages. Sending again in 17s”, then sent it by itself when the wait was over. All 11 messages got an answer. The docs also cap a user at three turns running at once, which I didn’t test.

Converse web chat showing the banner Too many messages. Sending again in 17s after the eleventh turn in a minute.
The eleventh message in a minute waits, then sends itself.

What goes wrong

ProblemWhat you seeFix
No queue workerThe page says Thinking for ever. I watched it for 40 seconds and no error appeared. Starting a worker finished the turn.Run php artisan queue:work before you test anything.
php artisan serveReloading the page during a reply took 9 to 10 seconds, because the stream holds a PHP worker. It did the same with 32 workers.Use nginx with PHP-FPM, where a reload took about 50 milliseconds. The docs also offer polling, which I didn’t test.
Reload with a queued messageThe queued message is gone.Use interrupt mode, or tell users to wait.
Tagged starter kitComposer can’t install Converse on Laravel 12.Use laravel/react-starter-kit:dev-main.
Each one hit during my runs.
Converse web chat showing a sent message and Thinking with a Stop button while no queue worker is running.
No worker, no error, no reply.

Composer couldn’t download dev packages from GitHub in my sandbox, so I installed without them. That means no Pest and no Converse::fake, and I haven’t run Laravel’s testing helpers for the web chat. One setting I read in the docs and didn’t test: the turn timeout has to stay below your queue connection’s retry_after, or Converse throws when a user sends a message.

How it compares

Chat UIs that survive a reload exist elsewhere, but you build more of them yourself. I checked each against its own documentation and didn’t run them.

OptionHow it worksWhat you write
Converse web chatBuilt in. Events live in your database and the client resumes from an offset.The agent and its tools. The page and endpoints are scaffolded.
Vercel AI SDK useChatResume needs Redis, the resumable-stream package and message persistence.Two endpoints, storage and the stream plumbing.
OpenAI ChatKitAn embeddable chat UI from OpenAI.A server integration for your own backend.
Converse trades flexibility for a working chat on your own stack.

The Laravel AI SDK can also stream the open AG-UI protocol and the Vercel protocol, and reports approvals as interrupts, so a React page you built yourself can talk to the same agent.

What I’d do

If you run Laravel and want a chat on your own pages, start here. The reload behaviour is the hard part of a chat UI, and it worked first time. Run a queue worker from day one, serve through PHP-FPM, put an approval on every tool that changes data, and set the queue prop on purpose rather than taking the default. If you need a chat in a non-Laravel front end, use the AI SDK’s stream protocols instead.

Everything ran on one 4 vCPU Intel Xeon 2.30 GHz virtual machine with 15 GB of memory and a 252 GB disk, under Ubuntu 24.04 with Linux 6.18. It ran PHP 8.4.28, Node 22, nginx with PHP-FPM, a SQLite database, the queue worker and headless Chromium together. The agent used an OpenAI model through an API key. I tested the web chat only, not Slack, Telegram or GitHub.


Sources

Disclosure: I’m an OpenAI, Firecrawl and Devin ambassador. Codex wrote the app code and the agent ran on an OpenAI model.