logo-darkPipe0

Conditional runs

run_if runs a pipe only when its conditions match. Use it to gate expensive or irreversible pipes: only email people who passed a qualification step, only enrich records that are missing a value.

Conditions are evaluated per record. A pipe with a run_if can run for one record and be skipped for the next, within the same request. When a record is skipped, the pipe's output fields on that record get status skipped with reason PipeConditionUnmet, so you can tell a gated field from a failed one.

This request splits name only when it contains Tom (contains is case-insensitive, so tom matches too):

Request with run_if
{
  "pipes": [
    {
      "pipe_id": "person:name:split@1",
      "run_if": {
        "action": "run",
        "when": {
          "logic": "and",
          "conditions": [
            {
              "field_name": "name",
              "property": "value",
              "operator": "contains",
              "value": "Tom"
            }
          ]
        }
      }
    }
  ],
  "input": [...]
}

Conditions can also target another pipe's output. The Qualify & email example gates a send pipe on the is_icp_fit output of an AI prompt pipe.

Schema

action

What to do when conditions match. Defaults to "run". Reserved for future expansion.

Supported: run.

run_if doesn't override other gating. A pipe with missing required inputs is still skipped even if its run_if matches.

when.logic

How to combine conditions.

Supported: and (all must match), or (any matches).

when.conditions[]

The conditions to evaluate. Each checks a field's value or status; combined with when.logic.

condition.field_name

The field to evaluate. Either an input field or another pipe's output field. The field must exist in your request; a field_name that is neither fails validation with ConditionTargetFieldNotFound.

JSON fields can't be targeted directly. Expand JSON properties into their own fields first.

condition.property

Which aspect of the field to compare.

Supported: value (the field's value), status (its resolution status).

condition.operator

How to compare. Which operators work depends on property and field.type:

PropertyTypeOperators
valuestringeq, neq, contains, matches
valuedateeq, neq, lt, lte, gt, gte, matches
valuenumbereq, neq, lt, lte, gt, gte, contains, matches
valuebooleaneq, neq
statusanyeq, neq

An unsupported combination (for example gt on a string) passes request validation but fails when the condition is evaluated.

contains is a case-insensitive substring check. matches tests the value against a case-sensitive regular expression, for example ^Tom; the value is compared in its string form, so it works on numbers and dates too. An invalid regular expression is an evaluation error.

When the target field's value is null, only eq and neq compare against it; every other operator evaluates to false. Gate on {"operator": "neq", "value": null} to run a pipe only when a field has a value.

condition.value

What to compare against.

  • For property: "value": a primitive (string, number, boolean, or null). Empty strings and objects are rejected at validation.
  • For property: "status": one of completed, no_result, failed, skipped.

Next steps

On this page