Backend and orchestrator
How a run flows between the Sommatic AI API and the workflow orchestrator: who receives the trigger, which records are created and when, how the graph is executed and reported back step by step, and who writes the result.
A run involves two services. The Sommatic AI API (the backend) owns every record and every entry point: it decides which graph runs, creates the run’s records and writes its results. The workflow orchestrator owns execution: it receives a graph and an input, runs the nodes one by one as Link Loom workers and reports each step as it happens. The orchestrator has no database.
A run, step by step
The trigger reaches the API
Every run starts at the API: a webhook, a chain call from another workflow, Run workflow in the studio, the
REST API or the scheduler (cron and mailbox triggers). If the workflow is paused
for that mode, nothing runs: a paused test call is refused, a paused prod call is recorded as a paused run.
The API picks the graph
test runs the definition’s draft; prod runs its default published version. See
Drafts and versions.
The API creates the run’s records
A flow instance (running) with the input and a copy of the graph, and a flow instance result (running,
outcome pending). The result exists from the first moment, so the run shows in the Runs tab before it finishes,
and its id (flow_instance_result_id) is the key that ties together everything that happens next.
The API hands the run to the orchestrator
It sends the graph, the input and the run ids, and keeps the connection open while the run lasts (a stream with a heartbeat, so long runs are not cut). No secret travels with the run: nodes carry only credential ids.
The orchestrator runs the graph
In memory, node by node: for each step it creates the node’s worker, resolves its expressions, runs it and follows the edge of the port it returned. A credential is resolved on the server when the node that needs it runs, and stays in that worker’s memory.
Every step is reported back
When a node starts and when it finishes, the orchestrator tells the API, which relays it to the studio console and to
anyone following the run: node-step-started, node-step-progress (for long nodes), node-step-completed.
The API writes the results
When the orchestrator finishes, the API writes one node execution per step and closes the flow instance and the
result as completed or failed, with the final envelope, a summary of the steps and the metrics, and sends
execution-completed (or execution-failed).
Who owns what
| Data | Owner |
|---|---|
| Definitions (draft, pause switches, trigger state) and versions | API |
| Flow instances, flow instance results, node executions | API: the only writer, after the run ends |
| Tasks created by a run | API: the orchestrator creates them through it |
| Credentials | API: stored encrypted, resolved for the node that needs them |
| The state of a run while it executes | Orchestrator memory |
| Schedules (cron and mailbox triggers) | API: a scheduler checks every 10 seconds |
| Live progress of a run | API: relayed to the console stream |
Synchronous and asynchronous runs
- Synchronous (
sync, the default for webhooks and chain calls): the caller’s request stays open until the run ends, and the response carries the steps and the result. - Asynchronous (
async): the API answers at once with the instance id andrunning, and the run goes on in the background. Read its outcome from the run’s result, or follow its events. Scheduled runs are always asynchronous.
What this means for a workflow
- A run is not saved step by step. Its state lives in the orchestrator while it runs; node executions appear
when the run ends. A run that is interrupted (for example, by a restart) is not resumed: it ends as
failed. - Node executions arrive at the end. While a run is in progress, follow it through the console or the execution stream; the per-node records exist once it finishes.
- Fan-in has no implicit wait. A node reached by several edges runs once for each arrival. To wait for every
branch, use
flow.splitwithflow.join. - Live progress lasts 30 minutes. A run longer than that still finishes and is recorded, but the console stops receiving its steps.
- Large values are stored apart. A text of more than about 64 KB in a node’s output is kept out of the run records: it is replaced by a reference when the workflow has a payload store, or marked as truncated otherwise. The run itself still receives the full value.
- A chain call is a run of its own.
workflow.chainstarts the target workflow through the API, with its own instance and result;chain_context.correlation_idand the root run’s id link them. - Tasks do not pause a run.
human.task.createcreates the task and the run continues; see Human in the loop.
Tracing a run
flow_instance_result_id exists before the orchestrator receives the run, so it is the one id to follow across both
services: it is $execution.id inside the run (or the root run’s id in a chain), it names the result in the Runs
tab, and it appears in every step the orchestrator reports.