Streaming
When you setstreaming: true in SessionConfig, you can receive Copilot responses as a stream.
Stdio and TCP modes already behave similarly to streaming. The difference is that you also receive ASSISTANT_MESSAGE_DELTA.
- For smooth output, print chunks as-is without adding line breaks.
- Do not combine with Laravel Prompts
spin(), because display output can break.
Practical usage patterns
Artisan command
As shown above, print directly withecho or $this->output->write(). This is easy to understand because the display is similar to running Copilot CLI directly. You can also use Laravel Prompts stream() to display output with a fade-in effect.
Deliver as SSE on a web page
Using response()->eventStream()
response()->eventStream() was added around the Laravel 12 release period. This package supports Laravel 12+, so you can use it.
Using response()->stream()
Frontend example
copilot.blade.php below is only for quick verification. For production, use Laravel’s official npm packages if you are using React or Vue: @laravel/stream-react or @laravel/stream-vue.
WebSocket delivery
You can also deliverdelta updates over WebSocket by combining Laravel notifications, broadcasting, and Reverb.
Livewire wire:stream
You can stream output in Livewire using the wire:stream directive.
For the latest updates, see the GitHub repository.