Docs / utilities / parseSSELine

parseSSELine

utility

Parse a single Server-Sent Events line into a typed StreamEvent.

import { parseSSELine } from 'flowstack-sdk'

Parses one raw SSE line (e.g. data: {"type":"content","content":"Hello"}) from an agent stream into a typed StreamEvent. Use it when you control your own stream-reading loop; for full streams prefer parseSSEStream or processSSEStream.

Signature

const event = parseSSELine(line: string)

Parameters

ParamTypeNotesDescription
linestringrequiredA single raw SSE line, e.g. data: {...}.

Returns

FieldTypeDescription
eventStreamEventThe parsed stream event.

Examples

Parse a single SSE line
const event = parseSSELine('data: {"type":"content","content":"Hello"}');
NoteStreamEvent types: content, delta, text, tool_start, tool_result, tool_error, progress, status, interrupt, done, error.

See also

parseSSEStream · processSSEStream · useAgent

Source: README.md#streaming-utilities · Also available in llms-full.txt and registry.json.