Skip to content
SoulFire LogoSoulFire

Flow Control

Inputs, outputs, and defaults of the 11 built-in nodes in the Flow Control category.

Generated from the pinned SoulFire source. Regenerate these pages with bun run generate-node-reference.

Branch

flow.branch

Branches execution based on a boolean condition

Also called: if, condition, switch, split.

Inputs

PortTypeRequired / defaultDescription
in (In)execOptionalExecution input
condition (Condition)booleanfalseCondition to evaluate

Outputs

PortTypeDescription
exec_true (True)execExecutes if condition is true
exec_false (False)execExecutes if condition is false
branch (Branch)stringWhich branch was taken
condition (Condition)booleanThe evaluated condition

Implementation

Cooldown

flow.debounce

Rate-limits execution by enforcing a cooldown period

Also called: Debounce, debounce, rate limit, throttle.

Inputs

PortTypeRequired / defaultDescription
in (In)execOptionalExecution input
cooldownMs (Cooldown (ms))number1000Milliseconds between allowed executions
key (Key)string"default"Unique key for this debounce

Outputs

PortTypeDescription
exec_allowed (Allowed)execExecution path if cooldown elapsed
exec_denied (Denied)execExecution path if still in cooldown
allowed (Allowed)booleanWhether execution was allowed
remainingMs (Remaining (ms))numberMilliseconds until next allowed execution

Implementation

For Each

flow.foreach

Iterates over each item in a list

Also called: foreach, loop, iterate, list, array.

Inputs

PortTypeRequired / defaultDescription
in (In)execOptionalExecution input
items (Items)list<T>RequiredList of items to iterate

Outputs

PortTypeDescription
exec_loop (Loop)execExecutes for each item
exec_done (Done)execExecutes when iteration completes
item (Item)TCurrent item
index (Index)numberCurrent index
isComplete (Complete)booleanWhether iteration is done
size (Size)numberTotal items count

Implementation

For Each Bot

flow.foreach_bot

Iterates over each bot in a list

Also called: foreach, bot, iterate, loop.

Inputs

PortTypeRequired / defaultDescription
in (In)execOptionalExecution input
bots (Bots)list<bot>RequiredList of bots to iterate

Outputs

PortTypeDescription
exec_loop (Loop)execExecutes for each bot
exec_done (Done)execExecutes when iteration completes
bot (Bot)botCurrent bot in iteration
index (Index)numberCurrent bot index
count (Count)numberTotal number of bots
isComplete (Complete)booleanWhether iteration is done

Implementation

Gate

flow.gate

Conditionally passes through execution and values

Also called: filter, pass, block, conditional.

Inputs

PortTypeRequired / defaultDescription
in (In)execOptionalExecution input
condition (Condition)booleantrueWhether to allow pass-through
value (Value)anyRequiredValue to pass through

Outputs

PortTypeDescription
exec_allowed (Allowed)execExecutes if condition is true
exec_blocked (Blocked)execExecutes if condition is false
passed (Passed)booleanWhether execution was allowed
value (Value)anyThe passed-through value

Implementation

Loop

flow.loop

Repeats execution a specified number of times

Also called: repeat, for, iterate, count.

Inputs

PortTypeRequired / defaultDescription
in (In)execOptionalExecution input
count (Count)number10Number of iterations

Outputs

PortTypeDescription
exec_loop (Loop)execExecutes for each iteration
exec_done (Done)execExecutes when loop completes
index (Index)numberCurrent iteration index
isComplete (Complete)booleanWhether loop is done
count (Count)numberTotal iteration count

Implementation

Rate Limit

flow.rate_limit

Limits execution rate using a token bucket algorithm

Also called: rate, limit, throttle, bucket, spam, cooldown.

Inputs

PortTypeRequired / defaultDescription
in (In)execOptionalExecution input
key (Key)string"default"Unique key for this rate limiter
maxTokens (Max Tokens)number10Maximum tokens in bucket
refillRate (Refill Rate)number1Tokens added per second
tokensRequired (Tokens Required)number1Tokens consumed per execution

Outputs

PortTypeDescription
exec_allowed (Allowed)execExecution path if allowed
exec_denied (Denied)execExecution path if rate limited
wasAllowed (Was Allowed)booleanWhether execution was allowed
tokensRemaining (Tokens Remaining)numberTokens left in bucket
retryAfterMs (Retry After (ms))numberMilliseconds until tokens available

Implementation

Repeat Until

flow.repeat_until

Repeats execution until a condition is met (do-while semantics)

Also called: loop, repeat, until, while, condition, do-while.

Inputs

PortTypeRequired / defaultDescription
in (In)execOptionalExecution input
maxIterations (Max Iterations)number10000Safety limit

Outputs

PortTypeDescription
exec_loop (Loop)execExecutes for each iteration
exec_check (Check)execEvaluates condition after each iteration (must end with a Result node)
exec_done (Done)execExecutes when condition is met or limit reached
index (Index)numberCurrent iteration index
conditionMet (Condition Met)booleanWhether the condition was met (false if limit reached)

Implementation

Result

flow.result

Reports a boolean result back to a loop's check chain

Also called: check, condition, loop, terminal.

Inputs

PortTypeRequired / defaultDescription
in (In)execOptionalExecution input
value (Value)booleanfalseThe boolean result to report back to the enclosing loop

Outputs

None.

Implementation

Sequence

flow.sequence

Executes multiple branches in order

Also called: order, steps, then.

Inputs

PortTypeRequired / defaultDescription
in (In)execOptionalExecution input
branchCount (Branch Count)number2Number of branches to execute

Outputs

PortTypeDescription
exec_0 (Then 0)execFirst branch
exec_1 (Then 1)execSecond branch
exec_2 (Then 2)execThird branch
exec_3 (Then 3)execFourth branch
exec_4 (Then 4)execFifth branch
exec_5 (Then 5)execSixth branch
exec_6 (Then 6)execSeventh branch
exec_7 (Then 7)execEighth branch
branchCount (Branch Count)numberNumber of branches

Implementation

Switch

flow.switch

Performs a multi-way branch based on a value

Also called: case, branch, select.

Inputs

PortTypeRequired / defaultDescription
in (In)execOptionalExecution input
value (Value)string""Value to switch on
cases (Cases)string"case1,case2,case3"Comma-separated case values

Outputs

PortTypeDescription
exec_default (Default)execExecutes if no case matches
exec_case0 (Case 0)execExecutes if case 0 matches
exec_case1 (Case 1)execExecutes if case 1 matches
exec_case2 (Case 2)execExecutes if case 2 matches
exec_case3 (Case 3)execExecutes if case 3 matches
exec_case4 (Case 4)execExecutes if case 4 matches
exec_case5 (Case 5)execExecutes if case 5 matches
exec_case6 (Case 6)execExecutes if case 6 matches
exec_case7 (Case 7)execExecutes if case 7 matches
branch (Branch)stringWhich case matched
caseIndex (Case Index)numberIndex of matched case (-1 for default)
matched (Matched)booleanWhether any case matched

Implementation

How is this page?

Last updated on