Processes and execution

A process is a nested workflow that coordinates people, AI, scripts, integrations, and data. Steps run sequentially along the selected path.

Execution lifecycle

  1. A user, an AI assistant, or another process starts the process.
  2. Required start variables are validated against their JSON Schemas.
  3. Steps run in order. Branches can select a different path.
  4. A task can pause execution until its completion requirements are met.
  5. A Return step ends execution and exposes selected output variables.
  6. Process variables are deleted after execution ends.

Step types

Every step name must contain 1–32 characters.

Step Behavior
Script Runs finite Node.js business logic in a selected sandbox.
Agent Gives an AI agent a prompt, selected variables, processes, and optional sandbox terminal access.
Task Pauses for input or action from one or more users.
Notification Sends a persistent message without pausing execution.
Branch Selects a named path using the exact value of a string variable.
Return Ends the current process path and returns selected variables.

Script

A Script step can read or write selected variables, access tables, and execute selected processes. Its program must finish; scripts cannot be long-running services.

Agent

An Agent step can read or write selected variables and call selected processes. Optional terminal commands run in the selected sandbox; the AI agent itself does not run inside it.

The agent’s final message is logged. It does not update a variable unless the agent explicitly writes that variable.

Example Agent prompt:

Read the instructions from $request. Use the selected sandbox terminal to
complete the request, then save the result to $result.

The Agent step must grant access to $request, $result, and the sandbox terminal required by the prompt.

Task

A Task assigns the same action to users resolved from a user expression.

  • 1 user wins: execution continues after the first submission.
  • All users are needed: execution continues after every assigned user submits.
  • An optional deadline can end the waiting period.

Task output variables must be arrays. Each submission contributes one item to every output variable:

await ailaflow.submitForm({
  answer: ['Approved']
});

Two submissions produce an array such as ['Approved', 'Rejected']. Matching indexes across all task output variables belong to the same submission.

Task metadata can identify who submitted each item and when:

{
  status: 'completed',
  items: [{ time: 1770000000000, userName: '@robert' }]
}

Notification

A Notification resolves a user expression, stores one notification per matched user, forwards it to an active default chat when available, and continues immediately.

Branch

A Branch reads a string variable and executes the branch whose name exactly matches its value. Define a branch for every expected value.

Return

A Return step stops execution immediately, including from inside a branch. Selected variables become the process result.

Variables and schemas

Every variable has a JSON Schema. Define complete object properties and array items; avoid an unspecified schema such as { "type": "object" }.

Start variables are required process inputs. A caller must provide all required values with matching types.

Use variables for execution state:

  • Form input
  • Intermediate calculations
  • Task submissions
  • Branch selectors
  • Process results

Persistent data

Process variables disappear when execution ends. Use tables for data that must remain available.

Need Use
Data used by one execution Process variable
Data shared across executions Table
Long-lived files in a sandbox /data directory
Passwords or API tokens in tables Encrypted table value

Tables use string primary keys and store JSON-compatible values. Every row also contains _id and an automatically managed _updatedAt timestamp.