Overview
Streaming enables your application to process and display data as soon as it is available, rather than waiting for the entire response. This can improve user experience and reduce perceived latency.How to Use Streaming
To enable streaming with commands, use the event-driven approach with.on() listeners for stdout and stderr events. The API will emit events as data is generated.
💡 Recommended: Use
executeCommand with stdout/stderr events for the best streaming experience. The deprecated generateCode method also supports streaming but will be removed in a future version.Example Usage with executeCommand (Recommended)
Legacy Streaming with generateCode (Deprecated)
With Branch Support
Legacy: With Conversation History (Deprecated)
When to Use Streaming
- When you want to display results to users as soon as they are available
- For long-running code generation tasks where incremental updates improve UX
- For interactive coding sessions where immediate feedback is valuable
- For chatbots or Q&A mode where responses can be shown progressively
Streaming Events
VibeKit uses an event-driven approach for streaming with the following events:Notes
- Streaming is available for both “ask” and “code” modes
- The final response is still returned as a Promise, even when using streaming events
- Event listeners are optional - you can use the method without them for non-streaming behavior
- Handle errors appropriately in your
errorevent listener to provide good user experience

