Streams
SDK reference for streams — Persist graph execution output to structured data tables and query the results.
Persist graph execution output to structured data tables and query the results.
createStream
Create a new stream that persists data from graph executions over time. The persistenceCondition is a JavaScript expression evaluated after each execution to decide whether to store the result (e.g., "true" to always persist, or "output.status === 'success'").
POST
Usage:
const result = await swirls.client.streams.createStream({
projectId: '...',
graphId: '...',
name: '...',
persistenceCondition: '...',
})Input:
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | No | |
projectId | string | Yes | |
graphId | string | Yes | |
name | string | Yes | |
description | string | No | |
persistenceCondition | string | Yes | |
enabled | boolean | No |
Output:
| Field | Type | Description |
|---|---|---|
id | string |
getStream
Get a stream by ID
GET
Usage:
const result = await swirls.client.streams.getStream({
id: '...',
})Input:
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes |
Output:
| Field | Type | Description |
|---|---|---|
id | string | |
projectId | string | |
graphId | string | |
name | string | |
description | string | null | |
persistenceCondition | string | |
enabled | boolean | |
createdAt | unknown | |
orgId | string | null | |
userId | string | |
graph | object |
updateStream
Update a stream
PUT
Usage:
const result = await swirls.client.streams.updateStream({
id: '...',
})Input:
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | |
name | string | No | |
description | string | No | |
persistenceCondition | string | No | |
enabled | boolean | No |
Output:
| Field | Type | Description |
|---|---|---|
id | string | |
projectId | string | |
graphId | string | |
name | string | |
description | string | null | |
persistenceCondition | string | |
enabled | boolean | |
createdAt | unknown | |
orgId | string | null | |
userId | string |
deleteStream
Delete a stream
DELETE
Usage:
const result = await swirls.client.streams.deleteStream({
id: '...',
})Input:
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes |
listStreams
List all streams in a project
GET
Usage:
const result = await swirls.client.streams.listStreams({
projectId: '...',
})Input:
| Parameter | Type | Required | Description |
|---|---|---|---|
projectId | string | Yes | |
pagination | object | No |
Output:
| Field | Type | Description |
|---|---|---|
pagination | object | |
results | object[] | |
totalCount | number |
listStreamSchemas
GET
Usage:
const result = await swirls.client.streams.listStreamSchemas({
streamId: '...',
})Input:
| Parameter | Type | Required | Description |
|---|---|---|---|
streamId | string | Yes | |
pagination | object | No |
Output:
| Field | Type | Description |
|---|---|---|
pagination | object | |
results | object[] | |
totalCount | number |
promoteStreamSchema
POST
Usage:
const result = await swirls.client.streams.promoteStreamSchema({
streamId: '...',
schemaVersion: 1,
includedColumns: [],
})Input:
| Parameter | Type | Required | Description |
|---|---|---|---|
streamId | string | Yes | |
schemaVersion | number | Yes | |
includedColumns | string[] | Yes |
Output:
| Field | Type | Description |
|---|---|---|
id | string | |
streamId | string | |
version | number | |
schema | object | |
tableName | string | null | |
draft | boolean | |
includedColumns | string[] | null | |
createdAt | unknown | |
orgId | string | null | |
userId | string |
listStreamTableColumns
GET
Usage:
const result = await swirls.client.streams.listStreamTableColumns({
projectId: '...',
streamId: '...',
})Input:
| Parameter | Type | Required | Description |
|---|---|---|---|
projectId | string | Yes | |
streamId | string | Yes |
getStreamTableSchema
GET
Usage:
const result = await swirls.client.streams.getStreamTableSchema({
projectId: '...',
streamId: '...',
})Input:
| Parameter | Type | Required | Description |
|---|---|---|---|
projectId | string | Yes | |
streamId | string | Yes |
executeStreamQuery
Query data from a stream using filters. To discover available columns, first call get_stream_table_schema or list_stream_table_columns for the stream.
POST
Usage:
const result = await swirls.client.streams.executeStreamQuery({
projectId: '...',
streamId: '...',
})Input:
| Parameter | Type | Required | Description |
|---|---|---|---|
projectId | string | Yes | |
streamId | string | Yes | |
filters | object[] | No | |
limit | number | No | |
offset | number | No |
Output:
| Field | Type | Description |
|---|---|---|
columns | string[] | |
rows | unknown[][] |