Skip to main content

Workflows and events

Behavior layer (beta v0.1). Builtins: Specification. Example: crm-reference.aip.

event

Domain event contract:
Publish from a workflow with emit (do not redeclare event inside the workflow):

workflow

when trigger is required:
Task must be declared as an entity in the reference spec. In create, lead: Lead refers to the instance from the when trigger. Durations: 15m, 1h, 1d in expressions and in dispatch Job after 15m. Forward references are valid: emit may use event blocks declared later in the file.

lifecycle

Prefer when multiple hooks exist on one entity:

Conditions and errors


job and queue

Delayed dispatch: dispatch SendReminder after 15m.

Best practices

  • Declare every entity used in create.
  • Use emit for publication; reserve event { } for type definition.
  • Keep workflows short; split long logic into jobs.
  • Prefer lifecycle for multiple hooks per entity.
crm-reference.aip contains workflow LeadReceived, event LeadAssigned, and entity Task.