Ligantic
Knowledge Base
Tutorials
Updates
Search Articles
Login
Free Sign Up
Home
Get Started
Tutorials
How-to guides
Reference
Explanation
Spaces
Schemas
Flows
Experiences
Endpoints
SDK and CLI
Browse documentation
Home
Get Started
Spaces
Schemas
Flows
Experiences
Endpoints
SDK and CLI
Docs
/

Stream - Collect

Type identifier: stream:collect Category: 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

stream

async iterable

An async iterator/stream to consume.

result

any

(Per-iteration) The accumulated result after processing each chunk.

Output Handles

Handle

Type

Description

start

control

Triggered when stream processing begins.

process

control

Triggered for each chunk received from the stream.

done

control

Triggered when the stream is fully consumed.

chunk

any

The current chunk from the stream (available during process).

accumulated

any

The accumulated result so far.

data

any

The final accumulated data after stream completion.

Configuration Options

This node has no additional configuration options.

Behaviour

  1. Receives an async iterable stream from the input handle
  2. Triggers the start control handle when processing begins
  3. Initialises the accumulated value to null
  4. For each chunk in the stream:

    • Sets the current chunk value
    • Triggers the process control handle
    • Reads the result input to update the accumulator
    • Updates accumulated with the new value
  5. When the stream ends:

    • Sets data to the final accumulated value
    • Triggers the done control handle

Iteration Pattern

Each chunk creates a processing cycle:

  1. chunk becomes available with the current stream value
  2. process fires to allow handling
  3. Connected nodes process and return a result
  4. accumulated updates 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:

  1. AI - Chat Message (streaming mode) → stream
  2. Stream - Collect:

    • On process: Concatenate chunk with accumulated
    • Return via result
  3. data contains the complete response

Track Stream Progress

Use case: Count items in a stream and update progress.

Flow:

  1. Stream source → stream
  2. Stream - Collect:

    • start triggers progress initialisation
    • process increments counter and updates UI
    • done triggers completion notification

Transform Each Chunk

Use case: Process and store each chunk independently while tracking totals.

Flow:

  1. Data stream → stream
  2. Stream - Collect:

    • process → Database insert for each chunk
    • result → Running count/statistics
  3. data contains final statistics

Related pages

AI - Chat Message
The AI - Chat Message node enables conversations with large language models (LLMs) from multiple providers including OpenAI, Anthropic, Google AI, and Groq. It supports dynamic message templates with variable interpolation, streaming responses, extended thinking, and AI actions (tool use).
Page not found. It may have moved or may not be published.
Browse documentation