Nodes/ComfyUI-aihub-workflow-exposer/AIHub Add Run Condition
ComfyUI Node

AIHub Add Run Condition

Only execute this workflow if a condition on the exposed values holds

By otavanopisto·Created about a year ago·Updated 22 days ago· 7
AIHub Add Run Condition
      conditionmy_expose_id > my_other_expose_id
      errorCondition failed

      AIHub Add Run Condition is the pack's validation gate. It takes a plain-text expression - like strength > 0.5 and not force_run - and registers it as a requirement for the run to execute. If the condition fails, the client is told the run didn't happen and why, before any expensive sampling starts. It's a guardrail for exposed workflows: the external app's UI can hand ComfyUI values that don't make sense together (a negative step count, a width beyond what the model supports, a "preview only" flag), and this node is where you say "no, don't run that."

      It's part of otavanopisto's ComfyUI-aihub-workflow-exposer, the bridge that lets external apps drive ComfyUI. Expose nodes make the client's values visible to the workflow; this node makes sure the combination of those values is sane before the graph burns GPU time.

      How it works

      The node itself is deceptively empty - when executed, its function just returns. The real work happens at the protocol level: the condition string is sent to the client as part of the workflow's exposed metadata, and the client evaluates it against the exposed values before queueing the run. That's why the expression references expose ids, not wire outputs. The README is explicit about the limits: it can only do basic operations - simple boolean logic and math operators on exposed values. If you need real logic, you write it on the client side, not here.

      The inputs that matter

      • condition (required) - the expression. It references expose ids by name and can compare them to literals or each other: steps >= 8 and steps <= 60, seed != 0, my_expose_id > 0.5. Keep it to the basics the README promises.
      • error (required) - the message the client shows when the condition fails. Make it actionable: "Resolution must be between 512 and 2048" beats "Condition failed."

      No outputs. It's a validator, not a data-flow node.

      Installing it

      ComfyUI Manager (search "ComfyUI-aihub-workflow-exposer"), or:

      cd ComfyUI/custom_nodes
      git clone https://github.com/otavanopisto/ComfyUI-aihub-workflow-exposer
      # restart ComfyUI
      

      No dependencies beyond ComfyUI itself.

      Where people get burned

      The biggest misunderstanding is that this node enforces anything locally. It doesn't - it registers a condition that the client must honor. If you're testing in the stock web UI, the node returns successfully and nothing is validated, because there's no client running the protocol. Second, remember the ids in the expression are the expose ids (the strings you set on expose nodes), not node titles or labels - a typo there makes the condition reference a nonexistent value. Keep expressions simple; the parser's promise is "very basic operations," and it means it.

      Categoryaihub/conditions

      Inputs (2)

      NameTypeDefaultDescription
      conditionSTRINGmy_expose_id > my_other_expose_idA condition expression using expose ids, e.g. my_expose_id > 0.5, other exposes are also accessible, only allows simple expressions, boolean logic and math operators
      errorSTRINGCondition failedThe error message to show if the condition fails

      Outputs (0)

      No outputs