Skip to main content

Logic Nodes

Logic nodes control workflow execution flow. Use them to make decisions, iterate over data, pause execution, and handle complex branching scenarios.

Conditional Node

Branch execution based on conditions.

Modes

ModeDescription
SimpleCompare two values with an operator
ExpressionEvaluate a JavaScript expression

Simple Mode

{
conditionType: "simple",
leftValue: "{{user.role}}",
operator: "==",
rightValue: "admin"
}

Operators

OperatorDescription
==Equal to
!=Not equal to
>Greater than
<Less than
>=Greater than or equal
<=Less than or equal
containsString contains
startsWithString starts with
endsWithString ends with
isEmptyValue is empty/null
isNotEmptyValue has content
isNullValue is null
isNotNullValue is not null

Expression Mode

{
conditionType: "expression",
expression: "{{order.total}} > 100 && {{user.isPremium}} == true"
}

Branches

Each conditional node has two outputs:

  • True — Condition is met
  • False — Condition is not met

Connect different nodes to each branch to create different execution paths.

Examples

User role check:

leftValue: "{{user.role}}";
operator: "==";
rightValue: "admin";

Order value threshold:

expression: "{{order.total}} >= 500";

String validation:

leftValue: "{{input.email}}";
operator: "contains";
rightValue: "@";

Switch Node

Route to multiple paths based on a value.

Configuration

{
expression: "{{ticket.priority}}",
cases: [
{ value: "critical", label: "Critical" },
{ value: "high", label: "High Priority" },
{ value: "medium", label: "Medium Priority" },
{ value: "low", label: "Low Priority" }
],
defaultCase: "default"
}

How It Works

  1. Evaluates the expression
  2. Matches against case values
  3. Routes to matching case output
  4. Falls through to default if no match

Use Cases

  • Routing by status or type
  • Multi-language handling
  • Feature flag routing
  • Regional processing

Loop Node

Iterate over arrays or repeat operations.

Loop Types

TypeDescription
forEachIterate over each item in an array
whileRepeat while condition is true
countRepeat a fixed number of times

forEach Loop

{
loopType: "forEach",
arrayPath: "{{api_response.users}}",
itemVariable: "user",
indexVariable: "index"
}

Inside the loop, access:

  • {{loop.item}} or {{user}} — Current item
  • {{loop.index}} or {{index}} — Current index (0-based)
  • {{loop.isFirst}} — Is first iteration
  • {{loop.isLast}} — Is last iteration
  • {{loop.length}} — Total items

while Loop

{
loopType: "while",
condition: "{{hasMorePages}} == true",
maxIterations: 100
}

count Loop

{
loopType: "count",
count: 5,
startIndex: 0
}

Inside the loop:

  • {{loop.index}} — Current iteration (0-4)
  • {{loop.count}} — Total count (5)

Loop Outputs

After the loop completes, collected outputs are available:

// If loop body outputs to 'result'
{
{
loop_node.outputs;
}
} // Array of all 'result' values

Best Practices

  • Set maxIterations to prevent infinite loops
  • Use forEach for known arrays
  • Use while for pagination or dynamic conditions
  • Be mindful of rate limits when calling APIs in loops

Wait Node

Pause workflow execution.

Wait Types

TypeDescription
durationWait for a specific time period
untilWait until a specific timestamp

Duration Wait

{
waitType: "duration",
durationValue: 30,
durationUnit: "seconds" // ms, seconds, minutes, hours, days
}

Until Wait

{
waitType: "until",
timestamp: "{{scheduled_time}}",
timezone: "America/New_York"
}

Duration Units

UnitDescription
msMilliseconds
secondsSeconds
minutesMinutes
hoursHours
daysDays

Use Cases

  • Rate limiting between API calls
  • Scheduled actions
  • Polling with delays
  • Time-based orchestration

Human Review Node

Pause for human input or approval.

Configuration

{
prompt: "Please review this content before publishing:",
description: "Review the generated blog post for accuracy",
variableName: "approval",
inputType: "boolean",
placeholder: "",
required: true,
defaultValue: null,
validation: {},
outputVariable: "review_result"
}

Input Types

TypeDescriptionWidget
textSingle line textText input
numberNumeric valueNumber input
booleanYes/No decisionToggle/checkbox
jsonStructured dataJSON editor

How It Works

  1. Workflow pauses at this node
  2. Notification sent to reviewers
  3. Reviewer provides input
  4. Workflow continues with input value

Notifications

Configure who receives review requests:

  • Email notifications
  • Slack messages
  • Dashboard alerts

Use Cases

  • Content approval workflows
  • Manual quality checks
  • Decision points requiring human judgment
  • Data validation before processing

Transform Node

Transform and manipulate data.

Operations

OperationDescription
mapTransform each item in array
filterFilter array items
reduceReduce array to single value
sortSort array
mergeCombine multiple objects
extractExtract specific fields
customCustom JavaScript transformation
parseXMLParse XML to JSON
parseJSONParse JSON string
passthroughPass data unchanged

Map Operation

{
operation: "map",
inputData: "{{api_response.users}}",
expression: "{ name: item.fullName, email: item.email }",
outputVariable: "mapped_users"
}

Filter Operation

{
operation: "filter",
inputData: "{{orders}}",
expression: "item.total > 100",
outputVariable: "large_orders"
}

Reduce Operation

{
operation: "reduce",
inputData: "{{orders}}",
expression: "acc + item.total",
initialValue: 0,
outputVariable: "total_sum"
}

Sort Operation

{
operation: "sort",
inputData: "{{items}}",
expression: "a.date - b.date", // or "a.name.localeCompare(b.name)"
outputVariable: "sorted_items"
}

Custom JavaScript

{
operation: "custom",
inputData: "{{raw_data}}",
expression: `
const result = data.map(item => ({
...item,
formattedDate: new Date(item.date).toISOString(),
isActive: item.status === 'active'
}));
return result.filter(x => x.isActive);
`,
outputVariable: "processed_data"
}

Shared Memory Node

Store and retrieve data across workflow nodes with optional semantic search.

Operations

OperationDescription
storeStore a key-value pair
searchSearch stored values

Store Operation

{
operation: "store",
key: "customer_{{customer.id}}",
value: "{{customer_data}}",
enableSemanticSearch: true
}

Search Operation

{
operation: "search",
searchQuery: "customer with billing issues",
topK: 5,
similarityThreshold: 0.7
}

Use Cases

  • Cache intermediate results
  • Share data between parallel branches
  • Build context for downstream nodes
  • Semantic retrieval from workflow memory

Code Node

Execute custom JavaScript or Python code.

Languages

LanguageRuntime
JavaScriptV8 (Node.js compatible)
PythonPython 3.11

Configuration

{
language: "javascript",
code: `
const items = inputs.data;
const processed = items.map(item => ({
...item,
total: item.price * item.quantity
}));
return { processed, count: processed.length };
`,
timeout: 30000,
memory: 256,
inputVariables: ["data"],
outputVariable: "code_result",
allowNetworkAccess: false,
allowFileSystemAccess: false
}

Input Variables

Access workflow variables via inputs:

const users = inputs.users;
const threshold = inputs.threshold;

Python Example

import json

items = inputs["data"]
processed = [
{**item, "total": item["price"] * item["quantity"]}
for item in items
]

return {"processed": processed, "count": len(processed)}

Security Options

OptionDefaultDescription
allowNetworkAccessfalseAllow HTTP requests
allowFileSystemAccessfalseAllow file operations
timeout30000Max execution time (ms)
memory256Memory limit (MB)

Use Cases

  • Complex data transformations
  • Custom business logic
  • Integration with libraries
  • Calculations and formatting

Best Practices

Conditional Nodes

  • Use simple mode for basic comparisons
  • Use expression mode for complex logic
  • Always handle both true/false branches
  • Consider edge cases (null, empty values)

Loops

  • Always set maxIterations as a safety limit
  • Avoid nested loops when possible (performance)
  • Use forEach for predictable arrays
  • Accumulate results for downstream use

Human Review

  • Provide clear, actionable prompts
  • Set appropriate timeouts
  • Have fallback paths for non-response
  • Log decisions for audit trails

Code Nodes

  • Keep code focused and simple
  • Handle errors gracefully
  • Use typed inputs/outputs
  • Test code separately before deploying