Workflows are defined and triggered as code. This guide will walk you through creating your first workflow.

Defining a Workflow

A workflow must have a name and an input schema with a executionId field.

The executionId is used to track the execution of the workflow. It is a unique identifier for the execution of the workflow. You can trigger a workflow many times, but as long as the executionId is the same, you will get the same result.

Example: Risk Analysis Workflow

Let’s build a workflow that analyzes the risk of a loan. It must:

  1. Get the loan records for the customer
  2. Analyze the risk of each loan record
  3. If the risk for any one loan record is too high, notify the customer of the rejection
  4. If the risk is not too high, analyze the risk profile to get the aggregate risk, and notify the customer

Triggering Workflows

To make your workflow discoverable by the control plane, you need to register it by calling workflow.listen().

Once registered, the workflow can be called from any machine with access to your Inferable cluster: