Workflows
Multi-step data-collection processes you declare in code and run from the UI, an event, or a schedule.
Workflows are multi-step processes you declare in code and run from the UI, an event, or a schedule. Each workflow is a FormDefinition — a typed structure of slots, steps, and rows — rendered by the RilayKit form engine.
// @noverify
import type { FormDefinition } from "@stndrds/schema";
const onboardingWorkflow: FormDefinition = {
name: "client-onboarding",
label: "Client onboarding",
status: "published",
version: 1,
slots: [
{ id: "slot-contact", objectName: "contact", label: "Contact", mode: "create" },
{ id: "slot-company", objectName: "company", label: "Company", mode: "select" },
],
steps: [
{
id: "step-info",
label: "Basic info",
rows: [
/* FormRow definitions */
],
},
{
id: "step-confirm",
label: "Confirmation",
rows: [],
},
],
};Steps
Each step is a typed unit inside the steps array. A step contains rows, and each row holds field references that map to attributes on the objects bound to the workflow's slots. Common field types include text input, select, date, relation, and file upload — all resolved through the RilayKit renderer (workflowRilay) which wraps each field in a StackedField component with label and slot colour.
Triggers
A workflow submission can be started in several ways:
- From a UI button — render
FormFlowwith the definition and a freshFormSubmission, then calluseAdvanceFormStep/useSubmitFormFillto drive navigation. - From a record event — attach an
AgentTriggerDefinitionwitheventType: "record.created"or"record.updated"to fire the workflow when a matching record changes. - From a webhook — configure the trigger with
eventType: "webhook"and awebhookPath; the runtime accepts a POST and starts a new submission. - On a schedule — use
eventType: "schedule"and acronExpressionin the trigger definition.
Observe
Workflow submissions are modelled as FormSubmission records in the database. Each submission tracks currentStepIndex, status (draft | submitted | processing | completed | failed), and per-step values. You can query submissions through the standard records API:
// @noverify
import { useRecords } from "@stndrds/react";
const { data } = useRecords({ objectName: "form_submissions" });You can also inspect runs in the agent dashboard when a workflow is attached to an agent trigger — the trigger appears in the audit delegation chain with triggeredByActorId set.
For a complete end-to-end example including slot configuration, step routing, and backend wiring, see the Workflows guide.