On this page
Sommatic Docs
Open portal

Ports and envelope

Every node returns an envelope with ok, data, port and meta. The data becomes the next node's input, and the port decides which edges the engine follows. This page covers ports, edges, fan-out and how the final port settles a run.

View as Markdown
Open in

A workflow does not branch by magic. Each node says what happened by naming a port, and the graph says where each port leads. Read this page and you can predict any run from its graph.

The envelope

When a node finishes, it returns an envelope:

JSON
{
  "ok": true,
  "data": { "label": "billing", "confidence": 0.92 },
  "port": "out",
  "meta": {}
}
FieldMeaning
okWhether the node did its work.
dataThe node’s output. It becomes $json for the next node and stays available to every later node through $('Node label').
portThe outcome. The engine follows the edges that leave this port. When a node returns no port, the engine uses out.
metaExtra information about the execution (for example, which cases matched in flow.switch).

In a run, each node leaves a node execution with its output, port, status and duration, so you can see later which port every node chose.

Ports

Each node declares its ports in the catalog. One of them is the default. Some common sets:

NodePorts
Most nodes (io.http, data.transform, code.js…)out, error
flow.iftrue, false, error
flow.switchone port per case you define, default, error
data.validatevalid, invalid, error
data.lookupfound, miss, error
ai.classify.triagesuccess, error
integrations.mongodb.operationout, empty, error
human.task.createcreated, error
flow.splitout (once per item), done, error
flow.trydo

A port with no edge is a valid end: when a node leaves through a port that has no edge, that branch stops there.

Edges

An edge connects a port of one node to another node:

JSON
{
  "from": { "node_id": "validate", "port": "valid" },
  "to": { "node_id": "route", "port": "in" }
}

The studio writes to.port as in; the engine only looks at from.node_id and from.port. An edge whose from.port is * is followed whatever port the node returns.

Fan-out

Several edges can leave the same port. The engine runs every target, one after the other, and each branch receives the same data. Branches run in the order their edges appear in the graph, and the engine runs one step of each branch before going deeper into any of them.

A node that two branches reach runs once per branch. To gather the items produced by flow.split, use flow.join, which waits for the done signal and collects the results.

Passing data along

Ports that only route, such as those of flow.if and flow.switch, pass the input through unchanged: the next node sees the same $json the router received. Nodes that do work replace $json with their own output, so read older data with $('Node label').item.json. See Expressions.

How the final port settles the run

When no edge is left to follow, the run ends. Its status depends on how it ended:

  • failed if a node raised an error the engine could not route, if the run went over 100 steps, or if the last node that ran left through error.
  • completed otherwise, including runs where a node failed, left through error and an edge on that port recovered the case.

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