The Condition step is used to branch between different paths in your spell based on certain criteria.

For example, imagine you are building a spell to screen job applicants based on their resume’s content. You may want to look for certain keywords, and can use the Condition step to create two paths: one for moving forward with the candidate, and another for rejecting them.

Options

The Condition step has a custom options panel. There are two high-level concepts:

  • Paths
  • Conditions

Paths represent different routes the spell can take if its conditions are met. Inside of each path is a condition which decides whether that path is executed. For example, in the image above, we’re defining two paths with a “contains” condition - if the resume contains “javascript” it will execute Path 1, and if it contains “python” it will execute Path 2.

Note that multiple paths can be executed as long as their conditions are satisfied. If the resume contains both “javascript” and “python”, both paths will be executed.

When a new path is created, a new connector will be created where you may attach later steps. Steps attached to a path will only execute if that path’s condition is met.

Conditions are comprised of 3 parts:

  • First value
  • Condition operator
  • Second value

To create a valid condition, you’ll need to fill out all 3 parts. You can insert variables into any of these fields, and usually at least one of the value fields will use a variable.

Below are the possible operators:

OperatorDescription
equalsWhether the first value exactly matches the second value.
is not
is in
is not in
is less thanWhether the first value is less than the second value. If either of the values are not numbers (and cannot be converted to numbers), this will be false.
is less than or equal toWhether the first value is less than or equal to the second value. If either of the values are not numbers (and cannot be converted to numbers), this will be false.
is greater thanWhether the first value is greater than the second value. If either of the values are not numbers (and cannot be converted to numbers), this will be false.
is greater than or equal toWhether the first value is greater than or equal to the second value. If either of the values are not numbers (and cannot be converted to numbers), this will be false.
containsWhether the first value is contained anywhere within the second value.
starts withWhether the first value begins with the second value.
ends withWhether the first value ends with the second value.

Outputs

The Condition step does not produce any outputs on its own; it only decides which paths should be executed. Steps placed after a Condition step can still use variables produced from steps before the Condition.

Behavior

When the Condition step runs, each condition is evaluated at the same time. Any conditions that are met will be marked as “passed”. Once all conditions have been evaluated, the step(s) after the passed conditions will be run.

If the Condition step encounters an error, no further steps will be executed even if some conditions passed. This is done to prevent behavior where multiple paths are expected to always run together, but only one path successfully executed before another one errored.