Library / Building Blocks & Utilities
Building Blocks & Utilities
Run a generic state machine runtime with Data Tables and sub-workflows
When another workflow calls it, it provides a reusable building block using Data Table.
What it does
# Generic state-machine runtime ## How it works 1. The runtime rebuilds a case from accepted events and validates the next transition. 2. It appends one fact, starts the entered state’s task asynchronously, and returns the saved state. ## Setup - [ ] Connect machine_definitions, case_event_stream, and task_bindings Data Tables. - [ ] Bind tasks by machine + version + task and publish their workflows. ## Try it Call from an adapter with caseId, eventId, type and payload. A new case also needs machine + machineVersion. Read without writing: { "caseId": "your-case", "operation": "inspect" }. ## Expected result Applied, duplicate, rejected, or inspected; with state, sequence and outcome. Replay never starts tasks. PoC: sequential requests; append and dispatch are separate, with no automatic retry.
The steps
- Receive Event
- Prepare Event
- Read Machine Definitions
- Load Machine Definitions
- Find Event
- Plan Transition
- Append Event?
- Append Event
- Has Task?
- After Append
- Find Task Binding
- Prepare Task Dispatch
- Binding Available?
- Task Input
19 steps in total.
Similar automations
Email AutomationSync La Growth Machine messages and contacts with Attio people records8 stepsImage, Video & AudioGenerate Luma Dream Machine Videos from Text16 stepsFiles & Cloud StorageDownload a File to the Host Machine3 stepsMonitoring, Ops & IncidentsCalculate machine OEE and downtime with Google Sheets, OpenAI and WhatsApp30 steps