Skip to main content
Streaming is a Ragrails capability for long-running or interactive workflows. Instead of waiting for one final response, callers can receive structured events while ingestion or chat is running. Use streaming when you need live progress, token-by-token chat output, responsive UIs, or observability during slow crawls and retrieval-backed generation.

What streams today

Streaming endpoints emit progress before the final result. The final event contains the same aggregate result shape as the non-streaming workflow.

Event shape

SDK streaming yields dictionaries. REST streaming sends the same dictionaries as Server-Sent Events (text/event-stream).
REST SSE frames wrap the event in an SSE event: line and a JSON data: line.

Chat streaming

chat_stream() runs normal RAG chat and streams progress, generated tokens, errors, and the final ChatResult.
Typical chat event sequence:

URL scrape streaming

scrape_stream() is for long crawls where the caller should see page progress and errors before the crawl finishes.
URL scrape streams can emit:
scrape_stream() does not accept a DLQ argument today. Use non-streaming scrape(..., dlq=...) when you need DLQ collection for retryable failures.

Interactive CLI streaming

Run the interactive chat with no query argument:
CLI
Inside the REPL, use:
The one-shot command ragrails chat "..." prints the completed answer. It does not expose structured stream events.

Boundaries