Skip to main content
R2R provides powerful streaming capabilities for its retrieval services, including RAG responses and agent interactions. These streaming features allow for real-time updates as information is retrieved and processed, enhancing user experience for applications that benefit from immediate feedback.

Streaming Events

When using streaming in R2R, various event types are emitted during the retrieval and generation process:

Streaming RAG

Basic Streaming RAG

To use streaming with basic RAG functionality:
To include web search in your streaming RAG:

Streaming Agent

R2R provides a powerful streaming agent mode that supports complex interactions with both document-based knowledge and web resources.

Basic Streaming Agent

Advanced Research Agent with Tools

R2R’s agent mode can leverage multiple tools to perform in-depth research:

Streaming Citations

R2R’s streaming citations provide detailed attribution information that links specific parts of the response to source documents:
Each citation includes:
  • id: Unique identifier for the citation
  • index: The display index (e.g., /[1], /[2])
  • start_index and end_index: Character positions in the response
  • source_type: The type of source (chunk, graph, web)
  • source_id: ID of the specific chunk/node
  • document_id: ID of the parent document
  • source_title: Title of the source document

Implementing Streaming UI

To create a responsive UI with streaming RAG, consider these patterns:

Frontend Implementation