Skip to main content
The step settings screen. Switch between form/YAML, configure run conditions, loops, and error handling, and inspect input/output data

The step settings screen. Switch between form/YAML, configure run conditions, loops, and error handling, and inspect input/output data

Overview

Each step in a Jinba Flow can be configured with advanced options that control how and when it executes. These options allow you to create sophisticated workflows with conditional logic, loops, and complex dependencies.

Step Dependencies (needs)

The needs option specifies which steps must complete before the current step can run. This creates an execution order and ensures data is available when needed.

Basic Usage

Key Points

  • Execution Order: Steps with needs wait for all specified dependencies to complete
  • Parallel Execution: Steps without dependencies run in parallel automatically
  • Failure Handling: If a dependency fails or is skipped, dependent steps are also skipped
  • Diamond Patterns: Complex dependency graphs are supported (A→B, A→C, B→D, C→D)

Example: Multi-Branch Workflow

Conditional Execution (when)

The when option allows a step to execute only if a specified condition is true. This enables dynamic workflow behavior based on previous step results.

Basic Syntax

Condition Expressions

Conditions support:
  • String Comparison: "{{steps.check.result.status}}" == "success"
  • Numeric Comparison: {{steps.count.result}} > 5
  • Boolean Evaluation: {{steps.validate.result.isValid}} == true

Example: Conditional Branching

Important Notes

  • Conditions are evaluated before step execution
  • If the condition is false, the step status becomes skipped
  • Skipped steps don’t affect downstream steps that depend on them (they will also be skipped)
  • Use single quotes around template variables in string comparisons

Loop Execution (forEach)

The forEach option executes a step multiple times, once for each item in a collection. This is useful for batch processing lists of data.

Basic Syntax

How It Works

  1. The forEach value is evaluated to get a list/array
  2. The step executes once for each item in the list
  3. Inside the step, {{item}} refers to the current item
  4. Results are collected as an array

Example: Processing Multiple Items

Accessing Item Properties

forEach with Index

If you need the index of the current item, you can use Jinja2 loops in the input:

Combining Options

You can combine needs, when, and forEach in a single step:
Evaluation Order:
  1. Wait for all needs dependencies to complete
  2. Check if when condition is true
  3. If true, execute forEach loop (or single execution if no forEach)

Best Practices

Dependencies

  • Keep dependency chains shallow when possible
  • Use parallel execution to improve performance
  • Clearly name steps to make dependencies readable

Conditions

  • Use meaningful condition expressions
  • Consider all possible outcomes (success, failure, edge cases)
  • Test conditions with various input values

Loops

  • Limit loop iterations to avoid long execution times
  • Handle empty arrays gracefully
  • Consider memory usage for large datasets