Execution model

Connecties, branching en runtime uitvoering

Deze pagina legt uit hoe de graph wordt opgebouwd en uitgevoerd: connection schema, branch routing, context-overdracht en validatie.

1. Connection schema

Veld Type Required Beschrijving
idstringYesUnieke connection ID.
sourceIdstringYesBron node ID.
targetIdstringYesDoel node ID.
branchdefault/if/elseNo*Route type (essentieel bij condition-like nodes).
labelstring|nullNoUI-label; legacy labels YES/NO worden naar branch gemapt.
{
  "id": "edge_cond_if",
  "sourceId": "cond_revenue_down",
  "targetId": "action_warn",
  "branch": "if",
  "label": "YES"
}

2. Branching regels

Condition en LLM condition

  • Node types condition en llmcondition vereisen twee uitgangen.
  • Er moet een if-connection en een else-connection bestaan.
  • Als branch ontbreekt op zulke edges, faalt blueprint-validatie.

Legacy mapping

  • YES of IF label wordt gezien als if.
  • NO of ELSE label wordt gezien als else.
  • Andere waarden vallen terug op default.

Branch selectie tijdens runtime

  • condition: evaluatie true = if, false = else.
  • llmcondition: modeloutput wordt naar boolean geparsed, daarna idem.
  • Als operands ontbreken in condition, route valt deterministisch terug op else.
  • llmresponse route is altijd default.

3. Runtime traversing en context

Entry node selectie

  • Eerst alle nodes met 0 inbound edges.
  • Als die er niet zijn: trigger nodes.
  • Daarna: datasource nodes.
  • Geen entry gevonden = runtime error.

Context merge gedrag

  • NodeContext reist mee over alle edges.
  • Bij meerdere inbound paden worden contexten samengevoegd.
  • Filters, metrics, math-values, llm traces en history blijven beschikbaar downstream.
  • Template tokens lezen uit deze merged context.

Safety guards

  • UI voorkomt cycles bij connecteren via wouldCreateCycle().
  • Runtime heeft een traverselimit: max(len(nodes) * 10, 100).
  • Overschrijding geeft error: Automation traversal exceeded safety limit.

4. Validatie in AI flow generatie en runtime

Laag Regel Typische fouttekst
Blueprint validatie Condition-like edges moeten if/else branch hebben. missing outgoing branch connections: if, else
Schema validatie Node moet id hebben. nodes.*.id: Field required
Schema validatie Connection moet sourceId en targetId hebben. connections.*.sourceId: Field required
Runner Node IDs moeten uniek zijn. Duplicate node id ...
Runner Edge moet naar bestaande nodes wijzen. Connection references unknown source/target node

5. Build checklist voor stabiele flows

  1. Gebruik op elke node een expliciete id (geen alleen key).
  2. Gebruik in connecties altijd sourceId en targetId.
  3. Zet voor condition/llmcondition altijd exact twee branches: if en else.
  4. Controleer dat niet-action nodes uitgaande edges hebben en niet-trigger nodes inbound edges.
  5. Voer Test uit na iedere branch- of metricwijziging.
{
  "connections": [
    { "id": "edge_1", "sourceId": "metric_current", "targetId": "cond_drop", "branch": "default" },
    { "id": "edge_2", "sourceId": "metric_previous", "targetId": "cond_drop", "branch": "default" },
    { "id": "edge_3", "sourceId": "cond_drop", "targetId": "action_warn", "branch": "if" },
    { "id": "edge_4", "sourceId": "cond_drop", "targetId": "action_ok", "branch": "else" }
  ]
}