For AI agents: the complete documentation index is available at https://a3s-lab.github.io/Flow/v1.0.0/en/llms.txt, the full documentation bundle is available at https://a3s-lab.github.io/Flow/v1.0.0/en/llms-full.txt, and this page is available as Markdown at https://a3s-lab.github.io/Flow/v1.0.0/en/nodes/condition.md.

Condition flow.condition

A condition selects one control path from data that is already committed. It is appropriate for order state, review decisions, thresholds, and results returned by earlier tasks. The node does not call a remote service and must not read a fresh clock, random value, or mutable process state. If a decision needs external information, obtain it in a task first, commit the result, and then evaluate that result here.

Input and expression

input holds the current value and may be replaced by a value connected from an upstream data port. expression uses the bounded expression format to read workflow input, the current value, or saved results. Test true, false, missing-field, empty-collection, and wrong-type cases before publication. A large business rule is easier to operate when split across clearly named conditions, because history and graph structure then show which decision was made at each point.

matched_label and otherwise_label change canvas copy only. The stable handles remain matched and otherwise. Editing labels does not alter connection identity, while editing the expression changes execution semantics. Both control outputs should lead somewhere explicit. When one branch ends the business process immediately, connect it to the intended complete, fail, cancel, or timeout node rather than leaving it open.

Wiring and diagnosis

Connect incoming control to in and optional upstream data to value. A true expression opens matched; every other valid result opens otherwise. Tests should prove that both branches can reach a terminal outcome and that no downstream edge loops back to the condition. If validation reports an expression path, inspect the upstream result shape and confirm whether the value connection overrides the local input value.

Use it to choose between two control branches from workflow data. The expression may read start input or an upstream data port; branch labels affect presentation only.

Runtime behavior

The condition evaluates during deterministic graph execution and does not call a host task. A true result selects matched; every other result selects otherwise.

Node contract

Type
flow.condition
Role
Control flow
Runtime binding
Host compilation
Durable identity
Defined by graph structure

Configuration properties

PropertyType and controlDefaultRules
inputInputdictJSONInput{}Current value to evaluate, or data connected from an upstream node.Optional · Advanced
expressionConditiondictA3SFlowExpressionInput{"apiVersion":"a3s.dev/flow-expression/v1","expression":{"op":"eq","left":{"op":"field","path":"input.approved"},"right":{"op":"literal","value":true}}}Evaluate workflow input or saved step results without performing external actions.Required
matched_labelTrue branch labelstrStrInputMatchedNames the true branch on the canvas. Connected edge labels update immediately while the stable port ID remains matched.Required
otherwise_labelFalse branch labelstrStrInputOtherwiseNames the fallback branch on the canvas. Connected edge labels update immediately while the stable port ID remains otherwise.Required

Ports

DirectionPort IDKindValue types
InputinIncontrolFlowControl
InputvalueValuedataJsonValue
OutputmatchedMatchedcontrolFlowControl
OutputotherwiseOtherwisecontrolFlowControl

Node JSON example

The CLI creates the same structure from manifest defaults. Canvas position, title, and selection are presentation data.

workflow.json
{
  "position": {
    "x": 320,
    "y": 160
  },
  "id": "example-flow-condition",
  "data": {
    "input": {},
    "expression": {
      "apiVersion": "a3s.dev/flow-expression/v1",
      "expression": {
        "op": "eq",
        "left": {
          "op": "field",
          "path": "input.approved"
        },
        "right": {
          "op": "literal",
          "value": true
        }
      }
    },
    "matched_label": "Matched",
    "otherwise_label": "Otherwise",
    "type": "flow.condition"
  }
}

CLI usage

Inspect the installed manifest first, then create the node and validate the complete workflow. Every command emits JSON.

Terminal
a3s-flow node flow.condition --pretty
a3s-flow new flow.condition --id example-flow-condition --pretty
a3s-flow validate workflow.json --pretty
a3s-flow compile workflow.json --pretty
a3s-flow digest workflow.json --pretty

Skill usage

The package includes the a3s-flow Skill. It queries the CLI catalog before creating, validating, compiling, and digesting a workflow.

Prompt
Use $a3s-flow to add the "flow.condition" node to workflow.json, connect valid ports, and validate the result.

CLI usage · Skill usage

Operational notes

  • Read only data already committed to history.
  • Do not read clocks, randomness, or remote state in an expression.
  • Connect both control branches to explicit downstream behavior.