Skip to main content
Control execution with conditions, handlers, and decision routing.

Pre-Conditions

Skip a step if a condition is false.

Common Conditions

Condition Functions

Step Dependencies (DAG Execution)

Steps can declare dependencies on other steps using the depends_on field. This enables:
  • Parallel execution of independent steps
  • Automatic ordering based on dependencies
  • DAG (Directed Acyclic Graph) execution

Basic Dependencies

In this example:
  • subfinder and amass run in parallel (no dependencies)
  • merge-results waits for both to complete before executing

DAG Execution

The executor builds a dependency graph and uses topological sorting (Kahn’s algorithm) to determine execution order:
Steps at the same “level” (no dependencies between them) execute concurrently.

Multiple Dependencies

The step waits for all listed dependencies to complete successfully.

Cascade Failure

If a dependency fails:
  1. The dependent step is marked as failed (not executed)
  2. All downstream steps are also marked as failed
  3. Independent branches continue execution

Dependencies vs Sequential Execution

Without depends_on, steps execute sequentially in order:
With depends_on, steps can run in parallel:

Linter Validation

The workflow linter validates dependencies:

Flow Module Dependencies

Flows also support depends_on for modules:

Decision Routing

Route to different steps based on variable values using switch/case syntax.

Decision Syntax

  • switch: Template variable evaluated at runtime (exact string match)
  • cases: Map of string values to goto targets
  • default: Fallback when no case matches (optional)
  • goto: Target step name or _end to terminate

Inline Execution in Cases

Cases support running commands or functions inline, not just goto:
Each DecisionCase supports:

Condition-Based Decision Routing

In addition to switch/case, decisions support conditions — an array of JavaScript expressions evaluated at runtime. All matching conditions execute (no short-circuit):

Condition Fields

All matching conditions in the array are executed — there is no short-circuit behavior. If you need exclusive routing, use switch/case instead.

Special Goto Targets

Success Handlers

Execute actions when a step succeeds.

Available Actions

Error Handlers

Handle step failures.

Error Action Types

Combined Example

Flow-Level Conditions

Conditional module execution in flows:

Branching Patterns

If-Then-Else

Early Exit

Loop with Retry

Best Practices

  1. Always check file existence before processing
  2. Use meaningful log messages
  3. Handle errors gracefully
  4. Use decision routing for complex logic
  5. End workflows cleanly

Next Steps