Workflow Nodes
Workflows are built from connected nodes that execute in sequence. Each node has a specific type that determines its behavior. This page documents all available node types.
Overview
| Node Type | Category | Purpose |
|---|---|---|
| Event | Trigger | Entry point — reacts to component data events |
| Recycle | Trigger | Timer-based recurring trigger |
| Expression | Operation | Runs JavaScript code |
| Integration | Operation | Calls a node exposed by an installed integration |
| Condition | Control Flow | Branches based on a boolean result |
| Switch | Control Flow | Multi-path branching |
| Each | Control Flow | Iterates over a collection |
Triggers
Trigger nodes are the entry points of a workflow. Every workflow must start with exactly one trigger node.
Event
The Event node starts the workflow when a data operation occurs on the component. It listens for a specific event and passes the affected documents to downstream nodes.
Use Event nodes when you need to react to data changes in real time — validating input before it's saved, syncing data to external systems after a create, sending notifications on updates, or cleaning up related records on delete.
Supported Events
| Event | Description |
|---|---|
Create |
After a new record is created |
Before::Create |
Before a new record is created (synchronous — can modify or block) |
Update |
After a record is updated |
Before::Update |
Before a record is updated (synchronous — can modify or block) |
Delete |
After a record is deleted |
Before::Delete |
Before a record is deleted (synchronous — can block) |
For components with multiple schemas, events are scoped per schema (e.g. orders::Create, orders::Before::Update).
Output
When an Event node triggers, it populates the execution context with:
$models— array ofModelinstances representing the affected documents$args— contextual arguments (e.g.current_revisionfor Update events)$context— metadata about the event (event name and initiator)$event— shorthand for the event name$initiator— the user or service that triggered the operation
See Expression Context for full details on all available variables.
Before Events
Before:: events run synchronously before the operation is committed. They can:
- Modify the data using the
decoratorobject - Block the operation by throwing an error
Warning
Before:: events block the API response until the workflow completes. Keep them fast and focused.
Recycle
The Recycle node is a timer-based trigger that executes on a fixed schedule. Each run starts with empty input; read the records you need from an Expression node.
Use Recycle nodes for background jobs that need to run periodically — syncing stale data, sending digest emails, cleaning up expired records, generating daily reports, or polling external APIs for updates.
Configuration
| Field | Type | Description |
|---|---|---|
timer |
string |
Schedule interval |
Available Intervals
| Value | Schedule |
|---|---|
5min |
Every 5 minutes |
30min |
Every 30 minutes |
1h |
Every hour |
3h |
Every 3 hours |
6h |
Every 6 hours |
9h |
Every 9 hours |
12h |
Every 12 hours |
1d |
Once per day |
mondays |
Every Monday |
tuesdays |
Every Tuesday |
wednesdays |
Every Wednesday |
thursdays |
Every Thursday |
fridays |
Every Friday |
saturdays |
Every Saturday |
sundays |
Every Sunday |
month_start |
First day of each month |
month_end |
Last day of each month |
Output
A Recycle run starts with empty input. It does not load records, and there is no models variable or ruleset filter. To process records, read them in an Expression node, for example with component.new("users") and a filter such as { active: true }.
Info
A Recycle node can be paused without removing it. Paused recycles are skipped during scheduled ticks.
Operations
Operation nodes perform actions — running code, calling an integration, sending emails, or making HTTP calls.
Expression
The Expression node executes JavaScript code in a secure sandbox. It is the most versatile node type, with access to the full platform SDK and all workflow context variables.
Use Expression nodes for any custom logic — transforming data, calling the SDK, interacting with external APIs, computing values, or preparing data for downstream nodes. It is the general-purpose workhorse of the workflow engine.
Avoid loops for batch operations
If you need to perform the same operation on many items (e.g. send 100 emails, update 100 records), do not use a for loop inside an Expression node. If the loop fails on item 50, the entire node is marked as failed. When the workflow engine retries, it re-executes the entire expression from scratch — repeating items 1–49 that already succeeded. Use an Each node instead for fault-tolerant batch processing.
Configuration
| Field | Type | Description |
|---|---|---|
expression |
string |
The JavaScript code to execute |
Execution Context
Expression nodes have access to the full set of runtime variables and libraries documented in the Expression Context page, including:
$models,$args,$context,$event,$initiator$globalEnv,$currentEnv$sdk— the platform SDKio— data flow control, includingio.inputfor expression input data- Platform services (Component, Query, Thunder, Functions, etc.)
- Utility libraries (Lodash, Moment, Handlebars, Crypto, etc.)
Data Flow
Use the io object to pass data to downstream nodes:
Reading Upstream Data
Access data piped from a specific upstream node:
Empty Return
If an expression returns nothing (bare return or no return statement), child nodes are skipped. This is useful for conditionally stopping execution:
if (!$models[0].active) {
return // stop here — don't execute downstream nodes
}
io.pipe({ id: $models[0].uuid })
Error Handling
| Error Type | Behavior |
|---|---|
throw new Error(...) |
Node fails without retry, unless the message contains a transient marker such as timeout, connection, network or service unavailable, which is retried |
throw RetryableError(...) |
Node retries with exponential backoff |
See RetryableError for retry behavior details.
Integration
The Integration node calls a node exposed by an installed integration — a satellite or marketplace app — from inside a workflow. Where an Expression node runs code you write, an Integration node hands the work to the integration and takes back whatever that node returns.
Use Integration nodes whenever a workflow needs something the platform does not do itself — taking a payment, sending mail, pushing a document into an external system, running a model completion — without assembling the call by hand. Every marketplace or satellite integration is driven through this node.
Configuration
An Integration node is identified by the marketplace integration that provides it, or by the satellite it belongs to, plus the node to call:
| Field | Type | Description |
|---|---|---|
integration_id |
string |
The installed marketplace integration that exposes the node — empty for satellite nodes |
satellite_id |
string |
The satellite that exposes the node — empty for marketplace integrations |
node_name |
string |
The node to call, as named by the integration |
inputs |
object |
Values for the inputs the node declares |
expressionModes |
object |
Which inputs are expressions rather than values |
A node is identified by either the marketplace integration that provides it or the satellite it belongs to, never both. These identifiers are set when you pick the node from the list of nodes the project's installed integrations expose — you do not type them by hand. inputs and expressionModes are the per-node settings described next.
Inputs
The integration declares its own inputs. Each input has a name and a type, and may carry a default used to prefill the field, a description and a required flag (shown as *). The editor renders the widget that matches the declared type:
| Input type | Editor widget |
|---|---|
string |
Single-line text field |
text |
Multi-line text area |
number |
Numeric field |
boolean |
On/off switch |
select |
Dropdown over the options the integration declares — a text field if it declares none |
string[] |
Tag list — type an item and press Enter |
object |
JSON editor |
object[] |
JSON editor holding an array of objects |
array |
JSON editor |
html |
Code editor in HTML mode |
Every input can be supplied in one of two modes, toggled per field:
| Mode | What the node receives |
|---|---|
| Value | The value as configured in the widget |
| Expression | The result of evaluating a JavaScript expression at run time |
Use Expression when the value depends on data flowing through the workflow rather than on something you can type while designing it. That mode offers a much smaller set of bindings than an Expression node gets — see Integration Input Expressions for what is allowed and what is not.
{{ }} placeholders are resolved in every input, in both modes, before the node runs.
Custom settings views
Some nodes ship their own settings view instead of the generic input form — the Kortex Agent Completion and Extract OCR nodes, for example. Those are configured by the integration's own widget, which replaces the form above and its Value/Expression toggle.
Outputs
The integration declares named outputs, shown read-only in the editor with their name and type. Outputs describe what the node returns; you do not fill them in.
Downstream Data
When the node completes, its result is stored under the node's name as two entries:
| Entry | Contents |
|---|---|
pipedData |
The node's result — the values behind its declared outputs |
debugData |
Debug information returned alongside the result, when the integration provides any |
A node further down the flow reads it by name. From an Expression node:
From an input in expression mode on another Integration node, where upstream results are available as input:
See Expression Context for the other helpers available to Expression nodes.
Kortex nodes and the run identity
A Kortex node is checked when it runs, against the workflow's run identity: the container's current run_as, the same identity its code nodes run as. When the workflow has none, that is Maintainer.
- The check applies on every run: trigger, schedule, event, restart, recycle and dry run. A dry run runs as
run_as, so it is refused the same way. - A node whose agent the identity can't use is refused with "run identity {identity} can't use agent {agent}". The fix: give that identity access to the agent in Kortex access, or move the workflow to an identity that has it.
- A Kortex node without an agent is refused with "Pick an agent for this Kortex step. Every Kortex step in a workflow runs as an agent." Every Kortex step in a workflow runs as an agent, so set one on the node.
agent_uuidcan be a{{ }}template or an expression. The check at run time sees the resolved agent.- Saving never checks agents. Anyone who may edit the workflow may choose any agent.
The editor marks such a node before anything runs:
Run identity {identity} can't use agent {agent}. A run or dry run of this node will be refused. Saving is not blocked.
The same rule covers Kortex nodes in a component's event graph and extension workflows. They use the component's identity.
Other integration nodes keep their own permissions and are not covered by run_as.
Kortex access for people, API users, roles and Forge apps is managed in the dashboard's Kortex access screen. See Owner and Maintainer.
Run playbook
The Kortex Run playbook step starts a Workforce playbook run and carries on at once. It does not wait for the run to finish.
| Input | Required | Meaning |
|---|---|---|
playbook_uuid |
yes | The playbook the step starts. |
instructions |
no | What the run should do. Supports variable substitution. |
data |
no | Data for the run, such as a value from an earlier step. In expression mode the value is passed as it is, for example an object. |
| Output | Meaning |
|---|---|
run_uuid |
The run that was started. |
status |
The run's status, normally queued. |
playbook_uuid |
The playbook. |
The run goes to the environment the workflow runs in (dev for a dev run, otherwise live), so the playbook needs a version deployed there. The step is checked against the workflow's run identity: it needs workforce::manage and access to every agent in the playbook, and each of those agents must be at work. The run can be opened in Workforce from the workflow history. See Deploy and run for every error message the step can show.
Capabilities
An expression node may declare capabilities: the permissions it needs. This works in project workflows and in component event graphs. A workflow or component as a whole declares none.
A node with capabilities runs narrowed. Its code and the evaluation of its inputs run as the container's run identity, but hold only the declared permissions the identity holds now, with no role memberships. A node without capabilities runs as the identity, with everything it holds.
Condition and switch nodes run with no identity: they only decide from their input, get no token and cannot call the platform. Kortex and other nodes keep the identity. Only expression nodes declare capabilities. A dry run uses the capabilities of the draft you are testing.
Declare them in the node's data:
{
"id": 3,
"name": "build_receipt",
"type": "operation",
"action": "expression",
"data": {
"expression": "...",
"capabilities": ["read shop::orders", "secrets::read global_env.payments"]
}
}
Each entry is a literal permission with an action and a resource. Invalid entries are refused with capability_invalid and the node's unit, for example node:3. An empty list means no permissions. Leaving the field out means none declared.
$globalEnv gets encrypted values only when a capability is secrets::read global_env, or secrets::read global_env.<group> for a group.
In the dashboard, the node editor has Run with only these permissions. See the security model for who may edit such a node.
Error Handling
Whether a failed node is retried is normally decided from its error message. A marketplace integration can override that decision by classifying the failure itself, and its classification wins:
| The integration's error reports | Behavior |
|---|---|
retryable: true |
Node retries with exponential backoff |
retryable: false |
Node fails immediately — no retry |
no retryable field |
Engine decides from the error message |
Retryable failures are retried on the same exponential backoff as RetryableError — see RetryableError — up to a per-node retry limit: 9 retries by default, 3 for Kortex Agent Completion (30 s, 1 min, 2 min). Classify a failure as terminal when retrying cannot help: bad input, a failed validation, or a request the integration rejected.
Nodes exposed by satellites cannot classify their failures — they report a message only, so the engine's message-based decision always applies. See Satellite JSON-RPC Contract → Errors.
If an input in expression mode cannot be evaluated, the node fails and is not retried — evaluation failures are treated as final.
Control Flow
Control flow nodes determine which path the workflow takes next.
Condition
The Condition node evaluates a JavaScript expression to either true or false and routes execution to the corresponding branch.
Use Condition nodes for simple yes/no decisions — checking if a value meets a threshold, whether a flag is set, or if a user has a specific role. For decisions with more than two outcomes, use a Switch node instead.
Configuration
| Field | Type | Description |
|---|---|---|
expression |
string |
JavaScript code that calls resolver.resolve() or resolver.reject() |
How It Works
The expression has access to a resolver object with two methods:
| Method | Effect |
|---|---|
resolver.resolve() |
Marks the condition as true — follows the pass connection |
resolver.reject() |
Marks the condition as false — follows the reject connection |
Connections
A Condition node has two outgoing connection types:
| Connection Type | When Followed |
|---|---|
pass |
resolver.resolve() was called |
reject |
resolver.reject() was called |
Nodes on the path not taken are marked as skipped.
Available Variables
Condition nodes have access to a limited context:
model— the triggering record when exactly one record triggered the workflow (its fields sit directly on it, for examplemodel.total);$modelsis not defined hereio— for reading upstream piped dataresolver—resolver.resolve()/resolver.reject()moment,_(Lodash)
Switch
The Switch node evaluates a JavaScript expression that selects one or more named paths to follow. Unlike Condition which only supports two branches, Switch supports unlimited named paths and can activate multiple paths simultaneously.
Use Switch nodes when a workflow needs to fan out based on a category or type — routing orders by fulfillment method, dispatching notifications to different channels, or triggering different processing pipelines based on record status. Each path can carry its own piped data, so downstream nodes receive only what's relevant to their branch.
Configuration
| Field | Type | Description |
|---|---|---|
expression |
string |
JavaScript code that calls follow.path(name) |
How It Works
The expression has access to a follow object:
| Method | Description |
|---|---|
follow.path(name) |
Selects a named path to follow. Returns a Path object |
Each named path corresponds to a named connection on the node. You can select multiple paths:
if (model.type === "subscription") {
follow.path("billing")
follow.path("notifications")
} else {
follow.path("one-time")
}
Path Data
Each path can pipe its own data to downstream nodes:
| Method | Description |
|---|---|
path.pipe(data) |
Pipe data to nodes on this specific path |
path.each(array) |
Pass an array to an Each node on this path |
const order = model
if (order.requires_shipping) {
follow.path("shipping").pipe({ address: order.shipping_address })
}
if (order.has_digital_items) {
follow.path("digital").pipe({ items: order.digital_items })
}
Connections
Each outgoing connection has a name that matches the string passed to follow.path(). Paths not selected are marked as skipped.
Available Variables
Switch nodes have access to:
model— the triggering record when exactly one record triggered the workflow;$modelsis not defined hereio— for reading upstream piped datafollow— the path selection objectdebug— for debuggingmoment,_(Lodash)
Each
The Each node iterates over a collection, executing its child nodes once per item. It is fed data from an upstream Expression or Switch node that calls io.each(array) or path.each(array).
Use Each nodes whenever you need to perform the same operation on multiple items — updating records one by one, calling APIs per item, or processing a batch of data.
Why Each Instead of a Loop?
The critical advantage of Each over a JavaScript for loop inside an Expression node is fault-tolerant, resumable iteration.
Consider this scenario: you need to process 100 items.
// DON'T DO THIS for batch operations
const items = await component.new("orders").find({ perPage: 100 })
for (const item of items.items) {
await http.post("https://api.example.com/sync", item)
}
If the HTTP call fails on item 50, the entire Expression node fails. When the workflow engine retries, it re-executes the whole expression from the beginning — items 1 through 49 are processed again, potentially causing duplicates or wasted work.
// Prepare node: pass items to Each
const items = await component.new("orders").find({ perPage: 100 })
io.each(items.items)
The Each node processes each item as an independent execution. The workflow engine saves progress after every iteration. If item 50 fails:
- Items 1–49 are already completed and will not be re-executed
- Only item 50 is retried
- Items 51–100 continue processing independently
Rule of thumb
If you're iterating over a list to perform side effects (API calls, emails, data writes), always use an Each node. Reserve Expression loops for pure data transformations that don't have side effects.
How It Works
- An upstream node calls
io.each(array)to provide the collection - The Each node receives the array and iterates over it
- For each item, all child nodes are executed with the current item available via the cursor
- The workflow engine saves a cursor after each iteration, enabling resume from the last successful position
Cursor
Inside child nodes of an Each loop, the current iteration data is available through the cursor:
| Template Variable | Description |
|---|---|
{{_cursor.current}} |
The current item |
{{_cursor.current.<field>}} |
A field on the current item |
{{_cursor.index}} |
The current zero-based index |
{{_cursor.total}} |
Total number of items |
In expression nodes, access the cursor via:
Supported Child Nodes
The following node types can be direct children of an Each node:
- Expression
Error Handling
Each iteration is independent — if one item fails, it does not affect other iterations. Failed iterations retry independently with their own backoff schedule.
This is the key differentiator from a manual loop: the workflow engine tracks which iterations completed, which failed, and which are pending. On retry, only the failed iteration is re-executed — completed iterations are never repeated.
Example
An expression node prepares a list of recipients:
const users = await component.new("users").find({ perPage: 100 })
io.each(users.items.map(u => ({ email: u.email, name: u.name })))
The connected Each node iterates, and its child Expression node processes each item:
const cursor = io.cursor()
const user = cursor.current
// process each user individually
await component.new("users").update(user.uuid, { last_notified: new Date().toISOString() })
Node Execution Lifecycle
Every node transitions through the following statuses during execution:
pending → running → completed
→ errored (may retry → running)
→ skipped (condition/switch path not taken)
| Status | Description |
|---|---|
pending |
Node is waiting to execute |
running |
Node is currently executing |
completed |
Node finished successfully |
errored |
Node failed — may retry depending on error type |
skipped |
Node was not executed (unused branch in Condition/Switch) |
Retry Behavior
Expression and Integration nodes support automatic retries:
- Retryable errors (timeouts, network issues,
RetryableError, an integration reportingretryable: true) are retried with exponential backoff - Non-retryable errors (syntax errors, validation failures) fail immediately
- Child nodes of an Each loop retry independently per iteration
Connections
Nodes are linked by connections that define the execution flow. Each connection has a type that determines when it is followed:
| Connection Type | Used By | When Followed |
|---|---|---|
| (default) | Operation, Event, Each | Always — after the node completes |
pass |
Condition | When resolver.resolve() is called |
reject |
Condition | When resolver.reject() is called |
| (named) | Switch | When follow.path(name) selects this path |