Graphs
SDK reference for graphs — Create, update, execute, and manage workflow graphs, nodes, and edges.
Create, update, execute, and manage workflow graphs, nodes, and edges.
getGraphSnapshot
Get a graph snapshot with all its nodes and edges. Each node has position: { x, y } (canvas coordinates). Use before executeGraph.
GET
Usage:
const result = await swirls.client.graphs.getGraphSnapshot({
id: '...',
})Input:
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes |
Output:
| Field | Type | Description |
|---|---|---|
id | string | |
projectId | string | |
deploymentId | string | null | |
graphId | string | |
name | string | |
label | string | |
description | string | null | |
createdAt | unknown | |
orgId | string | |
userId | string | |
nodes | object[] | |
edges | object[] |
listGraphs
List one row per stable graph with preferred snapshot, version count, and active-deployment flag.
GET
Usage:
const result = await swirls.client.graphs.listGraphs({
projectId: '...',
})Input:
| Parameter | Type | Required | Description |
|---|---|---|---|
projectId | string | Yes | |
pagination | object | No |
Output:
| Field | Type | Description |
|---|---|---|
pagination | object | |
results | object[] | |
totalCount | number |
executeGraph
Execute a graph with input data. Returns an execution ID that can be used to track progress via get_execution.
POST
Usage:
const result = await swirls.client.graphs.executeGraph({
graphId: '...',
})Input:
| Parameter | Type | Required | Description |
|---|---|---|---|
graphId | string | Yes | |
input | object | No |
Output:
| Field | Type | Description |
|---|---|---|
executionId | string |
getExecution
Get the status and results of a graph execution, including all node executions. Use the executionId returned by execute_graph. The response includes the overall status and each node's individual execution status and output.
GET
Usage:
const result = await swirls.client.graphs.getExecution({
id: '...',
})Input:
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes |
Output:
| Field | Type | Description |
|---|---|---|
id | string | |
parentGraphExecutionId | string | null | |
graphSnapshotId | string | null | |
graphId | string | null | |
deploymentId | string | null | |
executorType | string | |
executorId | string | |
triggerId | string | null | |
triggerType | string | null | |
status | string | |
input | unknown | |
output | unknown | |
error | string | null | |
startedAt | unknown | |
completedAt | unknown | null | |
createdAt | unknown | |
orgId | string | |
userId | string | |
nodeExecutions | object[] |
listRunnableGraphs
List graphs in a deployment with each graph's entry node input schema and last execution. id in each row is the graph snapshot id. Last execution aggregates by stable graph when possible.
GET
Usage:
const result = await swirls.client.graphs.listRunnableGraphs({
projectId: '...',
deploymentId: '...',
})Input:
| Parameter | Type | Required | Description |
|---|---|---|---|
projectId | string | Yes | |
deploymentId | string | Yes |
Output:
| Field | Type | Description |
|---|---|---|
results | object[] |