Workflow YAML reference
A workflow is a directed graph of typed nodes wired by edges, authored in
the visual builder and serialized to YAML. The canonical shape is a single
JSON Schema generated from the same
zod source the web app validates against (web/src/lib/api-schemas-workflow.ts),
so the document, the editor, and the runtime never disagree.
Editor validation
Section titled “Editor validation”Mail attachments and acknowledgment
Section titled “Mail attachments and acknowledgment”An imap or managed email_plus_address trigger captures attachments when its
configuration sets store_attachments: true. The default is false.
max_attachment_bytes can lower the 16 MiB limit, from 1 through 16777216 bytes.
Storage also enforces the workspace plan, daily quota, media allowlist and retention.
Each captured attachment retains filename, content_type and size_bytes, and
adds stored: true, sha256, file_ref: "artifact:<uuid>" and the equivalent
storage_path. A refused attachment has stored: false and a skipped_reason
(too_large, media_type, plan_storage, quota, original_mismatch or error).
In the default best_effort mode the message still fires, so a workflow can report
the refusal. Native imap triggers can set attachment_capture_mode: required
alongside store_attachments: true: every attachment must be stored, read back and
match its original size and SHA-256 before the run is published or the mailbox cursor
advances. This mode also applies the 32 MiB run preload budget and is
not supported by managed email triggers. A published run’s later processing failure
still requires reconciliation; the cursor does not wait for workflow completion.
Attachment bytes stay outside run
context, events and input snapshots.
A bound Python code node reads sc_storage.read(attachment["file_ref"]); a bound
JavaScript or TypeScript node reads scStorage.read(attachment.file_ref) and receives
a Uint8Array. sc_storage is also a JavaScript alias. The host serves only file
references from the original mail run’s captured trigger context, with matching
workspace and durable publication proof. References supplied through node inputs
grant no authority. The preload budget is 32 MiB per run. In-process and pooled
placements carry these files; runner_fleet refuses before dispatch.
An IMAP trigger finds new mail through its UID cursor alone: bodies are read with
BODY.PEEK[], so a fetch never sets \Seen or any other flag, and a message a person
already read is still delivered. delta_mode accepts only uid_cursor; the retired
seen_flag mode, which marked every fetched message read, is refused, and a trigger
still stored with it does not poll until it is switched. mark_seen_on_claim is
accepted as a boolean and has no effect. Marking, moving or deleting a message is
an explicit imap_ack node with a mode the workflow names.
Native IMAP context includes folder, uid, uid_validity and
backlog: { uid, uid_validity, high_water_uid, remaining }. remaining measures
the UID distance to the mailbox high-water mark, including gaps left by deleted
messages. A fresh uid_cursor_start: "beginning" cursor drains oldest mail first,
including a backlog. messages_per_tick bounds each batch. A workspace budget hard
stop leaves messages pending and does not advance the cursor.
received_since: "YYYY-MM-DD" optionally restricts UID-cursor delivery to an inclusive
mailbox arrival calendar day. IMAP SINCE uses the server’s INTERNALDATE, ignoring
time and timezone; the sender’s Date header is unrelated. Omitted/null retains
unfiltered history. Timestamps are refused. The date applies after generation reset too; it never rewinds an existing
cursor. Use a fresh beginning cursor for an explicitly dated initial backlog.
The original message cap, UID generation and durable claims still govern delivery.
Managed mail preserves its flat from, to, subject, text and html fields.
Its additional message envelope contains those fields plus headers,
headers_raw, body_plain, message_id, uid, uid_validity and attachments.
headers_raw contains the original header block; raw MIME attachment bodies are
not exposed.
An imap_ack node operates on one positive numeric UID. message_uid,
source_folder, target_folder and uid_validity resolve trigger.* templates.
Omitted source folder and generation inherit the original native mail context.
The original resource and mailbox account must still match. A changed generation
is a validation failure; a message already moved or deleted returns noop: true.
mode is required and is move or delete: a node whose stored config names none, or
names mark_read, is refused before any mailbox effect. No acknowledgement marks a
message read. move uses native MOVE with a durable COPY/UID EXPUNGE
fallback; delete uses UID EXPUNGE. Cleanup requires UIDPLUS and never expunges
unrelated messages. Moves require an existing target folder and never create one.
An uncertain MOVE/COPY result remains held by its durable receipt for reconciliation.
Native structured extraction
Section titled “Native structured extraction”A Python or TypeScript code node declares a code_llm block in one of two forms.
The calibrated lane is the normal form: code_llm: { lane: document_extraction, max_tokens: 2048, reserve_usd: 1.0 }. The workflow names no model and no provider
resource. Two lanes exist:
document_extractionreads original documents. Its chain is the workspace’s lane override under Settings › Models, or else the built-in default. A stored override that does not parse puts no chain in force: the settings view shows none and the node fails withinvalid_stored_chain. Entries of this lane take noeffort, because the call sends no reasoning-effort parameter. Saving one is refused. Aneffortstored by an earlier version is ignored with a server warning, and the settings editor drops it on the next save. A storedeffortthat is not a known effort value is not ignored: no chain is in force, and the node fails withinvalid_stored_chain.text_draftingwrites text, for example a mail reply draft. It uses the workspace’sfastmodel tier, routed the same way the server’s internal calls route it. The lane ignores theeffortof afastentry, which still applies to agent tasks. A stored text override that the model settings would refuse to save fails the node withinvalid_stored_chainand the same message, instead of falling back to the built-in chain. This lane takes no attachments: a call withfile_refsorinline_filesfails withattachments_refused.
When the node starts, the server picks the first chain entry the workspace can call.
Callable means three things: the server speaks a structured dialect to the provider,
the catalog lists the model as reading the lane’s input (PDF or text), and the
workspace holds its own credential for the provider. That credential is an API key or
the pinned system credential, or a subscription only where the provider accepts one
for API calls. The instance’s own key never counts. The calibrator ranks and replaces
the document chain from measured evidence; the built-in default is the cost/quality
class of the extraction ruling, not a pin; its last entry is OpenCode Go, so a
workspace whose only key is an OpenCode Go key still resolves the lane. If no entry
resolves, the node still runs its code, so the workflow can record its own review
row: every lane call of that run fails with the named reason (empty_chain,
no_reachable_entry, invalid_stored_chain) as code_llm lane '<lane>' unavailable (<reason>): ..., the same error a call-time refusal such as lane_exhausted raises.
No model is called and none is substituted.
The fixed form stays available as an explicit exception: code_llm: { binding: anthropic, model: <model id>, max_tokens: 2048, reserve_usd: 1.0 } beside
resource_bindings. A block that mixes both forms is refused. An older server
version refuses a lane-form node before calling any model, so lane-form workflows
need the current version on every server that runs workflows.
sc_llm.extract({"lane": "document_extraction", "prompt": "...", "schema": {...}, "file_refs": [attachment["file_ref"]]}) returns data,
documents: [{file_ref, text}], provider/model and original response cost evidence.
The fixed form names its binding as resource instead. JavaScript uses
scLlm.extract or sc_llm.extract. Credentials stay inside the host. Bytes the
workflow already holds, for example a file read from its own storage inbox, go in
"inline_files": [{"name": "scan.pdf", "data_base64": "..."}]. They count toward the
same limit of eight attachments and 16 MiB as file_refs.
A lane result also carries call_id, lane, chain_position and latency_ms.
When the workflow’s own checks reject a result, it calls sc_llm.extract again with
"escalate": true. That call takes the next callable chain entry with a different
model: the same model through another provider route does not count. Past the last
one, the call fails with lane_exhausted. A call without escalate starts at the
first entry again. The workflow reports its verdict on a lane call with
sc_llm.extract({"report": {"call_id": result["call_id"], "verdict": "ok"}}). The
verdict is ok, needs_review or invariant_failed. Each successful call takes one
verdict, from the run that made it; a failed call takes none. The calibrator reads the
document lane’s verdicts as that lane’s own acceptance evidence.
PDF documents, including scans without a text layer, reach the model as original binary documents. Optional local text supports independent plausibility checks; missing text grants no fabricated confirmation. Local decoded PDF streams share a 32 MiB budget and document text is limited to 64 KiB per attachment.
Only the original active workflow child, unchanged stored model/resource grant or
lane, active owner membership and shared workspace/provider budget can admit a call.
Both forms run through the same admission, reservation, metering and receipts.
Schema validation and file limits precede paid effects; response receipts precede
parsing. An exact retry returns the retained result; an indeterminate invocation
remains held and cannot pay for a second provider call. Unknown price or model
metadata retains a conservative hold. Native model calls require in_process
placement, at most eight attachments totaling 16 MiB and a 32 KiB output schema.
The original code timeout also bounds async host calls.
A portable imap_ack uses original_trigger_resource: true with a nil
resource_ref. Its mailbox UUID, account, UID, generation and source folder must
come from the exact durably published native IMAP run. Missing proof and substituted
message addresses fail before a protocol effect. Explicit UUID-based acknowledgment
keeps its ordinary behavior.
Every workflow exported from the builder begins with a modeline that points your editor’s yaml-language-server at the schema, giving inline validation and node-kind autocompletion:
# yaml-language-server: $schema=https://supacloud.run/schemas/workflow.jsonname: nightly-triagestages: - node_key: classify role: plan who: triage-agentnodes: - key: classify kind: llm_classify config: {}edges: []Top-level fields
Section titled “Top-level fields”| Field | Type | Notes |
|---|---|---|
name |
string | Workflow name. |
project_id |
string | The owning project. |
nodes |
array | The typed-node graph (the V8 builder surface). |
edges |
array | Connections between nodes, by source/target key. |
steps |
array | The v1 agent-only step view, kept for back-compat. |
stages |
array | Optional first-class metadata assigning graph nodes to semantic workflow stages. |
max_concurrent_runs |
integer | null | Caps simultaneous runs; null = unbounded. |
Stages annotate existing graph nodes; they do not add execution edges or a second
runtime. Each node_key must name one node in the same workflow and can appear
only once. role is intentionally an open semantic label, so custom and
Marketplace workflows can use their own vocabulary (common roles are plan,
implement, and review). who is optional metadata for the intended agent,
profile, or owner.
| Field | Type | Notes |
|---|---|---|
node_key |
string | Required key of an existing workflow node. |
role |
string | Required non-empty semantic stage label. |
who |
string | Optional non-empty intended agent/profile/owner label. |
| Field | Type | Notes |
|---|---|---|
key |
string | Unique node key (referenced by edges). |
kind |
enum | One of the node kinds below. |
config |
object | Kind-specific configuration (open object today). |
position |
{ x, y } |
Canvas coordinates for the builder. |
| Field | Type | Notes |
|---|---|---|
source |
string | Source node key. |
target |
string | Target node key. |
source_handle |
string | Which output handle the edge leaves (default out; gates use branch handles). |
Node kinds
Section titled “Node kinds”| Kind | Purpose |
|---|---|
agent |
Run an AI coding agent with a prompt. |
gate |
Branch on a predicate to different output handles. |
human |
Pause for a human decision or input. |
end |
Terminal node. |
code |
Run a Bash/Python/TypeScript/Go/Rust/C# snippet (defaults to Bash). Unbound: hermetic container, no network/DB. A Python/TypeScript node may declare resource_bindings to run on the credentialed sandbox with vetted egress + a host-mediated guarded DB call (ADR 0058). |
db_query |
Read from a bound PostgreSQL resource. params resolve ${{ nodes.* }}/${{ trigger.* }}/${{ steps.* }} typed (#990); the SQL text itself is deliberately never templated. |
db_execute |
Write to a bound PostgreSQL resource. params resolve references like db_query (#990); SQL text never templated. |
http_request |
Make an outbound HTTP call (SSRF-guarded, IP-pinned). url, headers and body resolve ${{ }} references typed (#990); the resolved URL passes the same SSRF vetting as a literal one. |
transform |
Reshape data flowing between nodes. |
notify_telegram |
Send a Telegram message. |
notify_email |
Send an email. Optional attachments (#1050): up to 5 entries of content_b64 (base64 or a ${{ nodes.<key>.<field> }} reference), filename, content_type; 10 MiB decoded total. An unresolvable or undecodable attachment fails the node loudly — an invoice mail never sends hollow. Optional in_reply_to and references make the mail a reply in the original conversation: in_reply_to takes the Message-ID it answers (typically ${{ nodes.<key>.message_id }} of the inbound mail), references the earlier ids of the thread, root first, separated by spaces or commas. Ids may carry angle brackets or not. The parent always ends References (with only in_reply_to, it is the one reference); a long thread keeps its root and the newest 19 ids. A value that is not a message id (id-left@id-right in printable ASCII, at most 900 characters, no space, control character or angle bracket inside) fails the node before anything is sent. |
notify_webhook |
POST to a webhook. |
notify_discord |
Send a Discord message. |
loop |
Iterate over a collection. over is a TYPED value slot (#990 Teil 2): a single ${{ nodes.<key>.<field> }} / ${{ trigger.<field> }} reference resolving to an array, or a static JSON array literal. The legacy string-interpolation form was removed — a mixed string fails loudly with a migration hint. |
wait_event |
Pause until an external event arrives. |
llm_classify |
Classify input with an LLM. |
imap_ack |
Acknowledge an IMAP message. |
app |
Invoke a deployed App. inputs resolves ${{ }} references typed (#990). |
connector |
Run a marketplace connector node. Optional resources pin (#1044): {"<resource_kind>": "<resource name>"} selects WHICH same-kind workspace resource each required kind binds; an unpinned kind keeps the deterministic first-by-name default, a pinned name that does not exist fails the run loudly. |
ssh_exec |
Run ONE command on a bound ssh_host resource (#1049). The command is STATIC (no ${{ }} templating — that would be a shell-injection channel); dynamic data goes on stdin_b64. Output (stdout/stderr/exit_code) is byte-capped; a non-zero remote exit fails the node. The host/port are SSRF-vetted and IP-pinned; the private key/password come only from the resource secret. |
Upstream node results flow to a node via SC_NODE_INPUTS; a trigger payload via
SC_TRIGGER_CONTEXT. See the build-your-first-workflow tutorial
to author one in the visual builder.
The bound native model resource uses the existing custom kind, explicit
provider: anthropic and base_url: https://api.anthropic.com configuration.
Its API key remains in the resource secret. The admission ticket freezes that
original provider endpoint; ambient server endpoints or credentials cannot replace it.
Aliases of the native provider credential remain host-only. Other explicitly bound
Custom resources retain their original capabilities.
Bound Python also receives the original node/project source tree and workspace lib/
through host-owned code-file: capabilities. The existing materializer keeps node
path precedence, per-node templating and verbatim shared modules. Python supports
from lib.einvoice import ..., relative packages and the existing flat library
imports without filesystem preopens or ambient search paths. Module/source files
share the 32 MiB run-file budget with attachments, at most 256 original files.
Imported run modules and the temporary importer are removed after success or failure.