Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.ellomas.com/llms.txt

Use this file to discover all available pages before exploring further.

Control Flow

The if step evaluates a condition and executes either the then or else branch. It is how you model data-dependent logic in your workflows.

Basic If/Then

- name: check-status
  type: if
  condition: ["status_code", "==", 200]
  then:
    - name: log-success
      type: print
      message: "Request succeeded"
If the condition passes, the then steps run. If it fails, the step passes silently (no error).

If/Then/Else

Add an else block to handle the failure case:
- name: check-status
  type: if
  condition: ["status_code", "==", 200]
  then:
    - name: success
      type: print
      message: "Request succeeded"
  else:
    - name: failure
      type: print
      message: "Request failed with status {{ status_code }}"

Condition Format

The condition is a three-element array: [value_or_path, operator, expected_value].

Using State Variables

- name: route-by-role
  type: if
  condition: ["user_role", "==", "admin"]
  then:
    - name: admin-panel
      type: http
      request:
        method: GET
        url: /admin/dashboard
  else:
    - name: user-profile
      type: http
      request:
        method: GET
        url: /users/{{ user_id }}/profile
The first element refers to a variable in the state bag. The third element can be a literal or another state variable.

Using JSONPath on Results

- name: check-response
  type: http
  request:
    method: GET
    url: /health
  extract:
    healthy: $.data.status

- name: handle-status
  type: if
  condition: ["healthy", "==", "ok"]
  then:
    - name: all-good
      type: print
      message: "System healthy"
  else:
    - name: alert
      type: shell
      command: "echo 'System unhealthy!'"

Operators

OperatorAliasesTypeDescription
eq==, =AnyEqual (type-aware for numbers)
ne!=, <>AnyNot equal
gt>NumericGreater than
lt<NumericLess than
ge>=NumericGreater than or equal
le<=NumericLess than or equal
containsStringTarget contains substring
inArrayValue exists in array

Operator Examples

# Numeric comparison
condition: ["count", ">", 10]

# String containment
condition: ["email", "contains", "@"]

# Value in array
condition: ["role", "in", "admin,moderator,editor"]

# Not equal
condition: ["status", "!=", "error"]

# Greater or equal
condition: ["score", ">=", 100]

Nested If Steps

You can nest if steps inside then or else blocks:
- name: nested-logic
  type: if
  condition: ["authenticated", "==", true]
  then:
    - name: check-permission
      type: if
      condition: ["role", "==", "admin"]
      then:
        - name: grant-access
          type: print
          message: "Admin access granted"
      else:
        - name: limited-access
          type: print
          message: "Limited access granted"
  else:
    - name: reject
      type: print
      message: "Authentication required"

Combining with Extract

A common pattern: extract a value, then branch based on it:
- name: fetch-order
  type: http
  request:
    method: GET
    url: /orders/{{ order_id }}
  extract:
    order_status: $.data.status
    order_total: $.data.total

- name: process-by-status
  type: if
  condition: ["order_status", "==", "pending"]
  then:
    - name: approve
      type: http
      request:
        method: PUT
        url: /orders/{{ order_id }}/approve

    - name: notify
      type: print
      message: "Order {{ order_id }} approved"
  else:
    - name: skip
      type: print
      message: "Order {{ order_id }} is {{ order_status }}, skipping"

What’s Next?