Definitions
Processes
defineProcess follows one object across several tasks, with a funnel, an SLA and the instances stuck at each step.
A process is a flow that crosses several background tasks, such as an order going from payment to parcel. Vigie groups task attempts by the object they work on and shows where each one is.
definitions/processes/acme.ts
import { defineProcess, step } from 'vigie/sdk'
export const fulfilment = defineProcess({
id: 'order-fulfilment',
title: 'Order fulfilment',
subject: 'order',
keyPrefix: 'order:',
description: 'From a Paynest payment to a parcel on its way.',
sla: '4h',
steps: [
step.task('paynest.payment.ingest', { label: 'Payment confirmed by Paynest', expectWithin: '30m' }),
step.parallel([
step.task('receipts.email', { label: 'Customer emailed', expectWithin: '1h', optional: true }),
step.task('parcelo.ship', { label: 'Shipment created at Parcelo', expectWithin: '15m', provider: 'parcelo' }),
]),
],
})
Instances are grouped by task.key on each attempt (order:o_81). Only keys starting with keyPrefix belong to the process.
| Field | What it does |
|---|---|
subject | What one instance follows, in your words. |
steps | step.task(kind, { label, expectWithin?, optional?, provider? }), and step.parallel([...]) for steps that run side by side. |
expectWithin | After this long without the step, the instance counts as stuck. |
sla | The time the whole flow should take. |
standing | For flows on a clock, with runs instead of instances. |
aliases | When some tasks name the object by another id, such as the provider's, read the mapping from your app's database. |
The Processes screen shows the funnel, the stuck instances with the reason from their last attempt, and each instance's timeline. Agents read it with list_processes and list_stuck_instances.