Skip to main content
A Workflow is a collection of nodes connected together to perform a series of operations. Workflows define the flow of data between nodes and the execution order.

What is a Workflow?

Think of a workflow as a graph where:
  • Nodes are the vertices (operations)
  • Connections are the edges (data flow)
  • Execution follows the topological order

Creating a Workflow

Workflow Properties

string
Unique identifier for the workflow
string
Human-readable name for the workflow
Map<string, Node>
Collection of all nodes in the workflow
Connection[]
Array of connections between nodes
Record<string, any>
Global variables accessible during execution

Adding Nodes

There are several ways to add nodes to a workflow:

From Class

From Type String

Setting Initial Values

Connecting Nodes

Connections define how data flows between nodes:

Connection Example

Multiple Connections

One output can connect to multiple inputs:

Disconnecting Nodes

Remove connections between nodes:

Removing Nodes

Remove a node and all its connections:

Workflow Validation

Validate the workflow before execution:

Validation Checks

Ensures there are no circular dependencies in the workflow
Verifies all connections are valid (ports exist, types compatible)
Checks that all required inputs are connected or have values
Ensures connected ports have compatible types

Execution Order

Workflows execute nodes in topological order:
  1. Identify nodes with no dependencies (entry points)
  2. Execute those nodes
  3. Propagate data to connected nodes
  4. Repeat until all nodes are executed

Workflow Variables

Global variables can be accessed by all nodes:

Serialization

Workflows can be serialized to/from JSON:

To JSON

From JSON

JSON Format

Workflow Lifecycle

1

Creation

Create a new workflow instance
2

Building

Add nodes and create connections
3

Validation

Validate the workflow structure
4

Execution

Execute nodes in topological order
5

Results

Collect and process execution results

Best Practices

Always validate workflows before executing to catch structural issues early.
Consider using descriptive IDs for nodes to make debugging easier.
Design workflows without circular dependencies. CrystalFlow will detect and reject cycles.
Build and test workflows incrementally, adding nodes one at a time.
Add names and descriptions to workflows for better maintainability.

Example: Data Processing Workflow

Next Steps

Execution Engine

Learn how workflows are executed

Workflow Builder

Build visual workflow interfaces

Serialization

Save and load workflows as JSON

API Reference

Complete Workflow API docs