On this page
Sommatic Docs
Open portal

How a node runs

Each step of a run creates a Link Loom worker for the node, activates it in the background and stops it: what the worker receives, what it returns and why no state survives the step.

View as Markdown
Open in

The orchestrator that runs workflows is a service built on the Link Loom SDK, and every node operator (io.http, ai.classify, flow.if…) is a Link Loom worker: a class whose lifecycle is driven by a finite state machine. A run does not call a node as a function; for each step, the engine creates a worker, activates it and stops it.

Spawn

A new instance of the node’s worker is created for this step only, with its own alias (step-<node_id>-<time>). The state machine receives CREATE and the worker enters INACTIVE; its setup hook runs.

Activate in the background

ACTIVATE_BACKGROUND moves it to ACTIVE_BACKGROUND and runs activateBackground(ctx) with the node’s configuration, its input ($json), the run’s variables and the outputs of earlier nodes. The worker resolves the {{ }} expressions of its configuration, does its job and returns the envelope { ok, data, port, meta? }.

Stop

STOP moves it to TERMINATING and then to TERMINATED, and the instance is removed. The engine stops the worker whether the step succeeded or failed.

No instance outlives its step: a node keeps no memory between steps or between runs. What one step must pass to the next travels in its output, which later nodes read with $json or $('Node label').

What the worker receives

activateBackground(ctx) receives the context the engine builds for the step. The node’s own configuration is spread at the top of ctx.options, next to the run data:

In ctx.optionsWhat it holds
The node’s configuration keysIts config, as saved in the workflow (expressions not yet resolved)
payload, inputThe input of the node: the output of the node that routed to it ($json)
inputsWhen several branches join into the node, the outputs of each one
nodeThe node definition: node_id, label, operator_slug, config
stateThe run’s variables: the output of every node that already ran, keyed by node_id, and the run ids
graphThe outputs of the nodes that already ran, keyed by label, for $('Node label')

The worker resolves the {{ }} values of its configuration first, then works with real values.

What the worker returns

Every node returns the same envelope, { ok, data, port, meta? }: data becomes the input of the next node, port picks the edge to follow and meta carries details for the run history. See Ports and the envelope.

Next steps

Install agent tools

Give your coding agent the official Sommatic AI docs: skills, the docs MCP server and Markdown pages, so it never has to scrape the site.

Skills only. They do not update by themselves; run it again to refresh.

npx skills add https://docs.sommatic.ai
How agents read these docs