Stream - Collect
Type identifier:
stream:collectCategory: Stream Operations
Description
The Stream - Collect node consumes an asynchronous stream (such as LLM streaming responses) and processes each chunk as it arrives. It enables accumulator patterns where results build up incrementally, useful for streaming text aggregation, real-time processing, or tracking stream progress.
Input Handles
Handle | Type | Description |
|---|---|---|
| async iterable | An async iterator/stream to consume. |
| any | (Per-iteration) The accumulated result after processing each chunk. |
Output Handles
Handle | Type | Description |
|---|---|---|
| control | Triggered when stream processing begins. |
| control | Triggered for each chunk received from the stream. |
| control | Triggered when the stream is fully consumed. |
| any | The current chunk from the stream (available during |
| any | The accumulated result so far. |
| any | The final accumulated data after stream completion. |
Configuration Options
This node has no additional configuration options.
Behaviour
- Receives an async iterable stream from the input handle
- Triggers the
startcontrol handle when processing begins - Initialises the
accumulatedvalue tonull For each chunk in the stream:
- Sets the current
chunkvalue - Triggers the
processcontrol handle - Reads the
resultinput to update the accumulator - Updates
accumulatedwith the new value
- Sets the current
When the stream ends:
- Sets
datato the final accumulated value - Triggers the
donecontrol handle
- Sets
Iteration Pattern
Each chunk creates a processing cycle:
chunkbecomes available with the current stream valueprocessfires to allow handling- Connected nodes process and return a
result accumulatedupdates with that result
Processing is sequential: the next chunk's processing waits for the current processing cycle to finish. The result input is optional; without it, the accumulated value remains null. An empty stream also produces null. The start branch finishes before chunk processing begins.
If reading the stream or processing a chunk fails, collection stops without firing done.
Stream Requirements
The input must be a stream. The only current source is LLM streaming responses.
Streams are shared rather than copied: multiple consumers receive different chunks, not independent copies of the response. Closing a stream stops it for every consumer. Stream chunks cannot be replayed after a run ends.
Examples
Accumulate Streaming Text
Use case: Collect an LLM's streaming response into a complete string.
Flow:
- AI - Chat Message (streaming mode) →
stream Stream - Collect:
- On
process: Concatenatechunkwithaccumulated - Return via
result
- On
datacontains the complete response
Track Stream Progress
Use case: Count items in a stream and update progress.
Flow:
- Stream source →
stream Stream - Collect:
starttriggers progress initialisationprocessincrements counter and updates UIdonetriggers completion notification
Transform Each Chunk
Use case: Process and store each chunk independently while tracking totals.
Flow:
- Data stream →
stream Stream - Collect:
process→ Database insert for each chunkresult→ Running count/statistics
datacontains final statistics