Skip to main content

Execution Modes

The BankLingo Process Engine supports two execution modes that control how processes run: Unsupervised Mode (automatic) and Supervised Mode (step-by-step).

Unsupervised Mode (Default)

Unsupervised Mode is the default execution mode where processes run automatically from start to completion without manual intervention.

Behavior

  • Process executes continuously
  • Tasks execute sequentially
  • Only pauses at UserTask (waiting for human action)
  • Continues automatically after user completes task with SignalProcessInstanceCommand
  • Runs until completion or error

When to Use

  • ✅ Production workflows
  • ✅ Fully automated processes
  • ✅ Normal business operations
  • ✅ Background jobs

Starting in Unsupervised Mode

POST /api/core/cmd
Content-Type: application/json

{
"cmd": "StartProcessInstanceCommand",
"data": {
"id": 45,
"runtimeContext": "{\"loanAmount\": 50000, \"customerId\": 789}",
"executionMode": "Unsupervised"
}
}

Or simply omit the executionMode (defaults to Unsupervised):

{
"cmd": "StartProcessInstanceCommand",
"data": {
"id": 45,
"runtimeContext": "{\"loanAmount\": 50000, \"customerId\": 789}"
}
}

Execution Flow

Flow: Start → Task1 (Auto) → Task2 (Auto) → UserTask (PAUSE) → Signal → Task3 (Auto) → End

Supervised Mode

Supervised Mode executes one task at a time, pausing BEFORE each task for manual control. This enables step-by-step debugging and process inspection.

NextActions Always Available

In Supervised mode, every response includes a nextActions array with control commands (stepForward, stepBackward, cancel).

IMPORTANT: Pauses BEFORE Execution

Supervised mode pauses BEFORE executing each task, not after. When you start a supervised process or call StepForwardCommand, the engine:

  1. Executes the current task (if there is one)
  2. Moves to the next task
  3. PAUSES without executing it
  4. Returns nextActions with control commands

You explicitly control when each task runs by calling StepForwardCommand.

Behavior

  • Process positions at ONE task at a time without executing it
  • Pauses BEFORE each task (not after - awaiting explicit execution command)
  • Requires manual StepForwardCommand to execute the current task
  • Can move backwards (StepBackwardCommand) to review previous tasks (review only, doesn't undo)
  • Always returns nextActions array with available control commands
  • Execution history is tracked in completedTasks
  • Full step-by-step control over workflow execution

When to Use

  • 🔍 Process development and testing
  • 🐛 Debugging complex workflows
  • 📊 Training and demonstrations
  • 🔬 Process inspection and analysis

Starting in Supervised Mode

POST /api/core/cmd
Content-Type: application/json

{
"cmd": "StartProcessInstanceCommand",
"data": {
"id": 45,
"runtimeContext": "{\"loanAmount\": 50000, \"customerId\": 789}",
"executionMode": "Supervised"
}
}

Response After Starting (Supervised Mode)

IMPORTANT: In supervised mode, the process starts and pauses at the first task WITHOUT executing it. You must call StepForwardCommand to execute the task.

{
"isSuccessful": true,
"message": "Process started in Supervised mode. Paused at first task.",
"statusCode": "00",
"data": {
"instanceGuid": "abc-123-def-456",
"status": "waiting",
"executionMode": "Supervised",
"currentActivityId": "Task_ValidateApplication",
"state": {
"variables": {
"loanAmount": 50000,
"customerId": 789
},
"currentNode": "Task_ValidateApplication",
"completedTasks": []
},
"nextActions": [
{
"id": "Task_ValidateApplication",
"name": "stepForward",
"type": "control",
"description": "Execute the next task"
},
{
"id": "Task_ValidateApplication",
"name": "cancel",
"type": "control",
"description": "Cancel process execution"
}
],
"logs": [
"[START] Process instance: abc-123-def-456",
"[START] Variables: [\"loanAmount\",\"customerId\"]",
"[PARSE] Process: LoanApproval",
"[START] First task: Task_ValidateApplication",
"[SUPERVISED] Process started in supervised mode. Paused at first task: Task_ValidateApplication",
"[SUPERVISED] Use StepForwardCommand to execute this task."
],
"taskInfo": {
"taskId": "Task_ValidateApplication",
"taskName": "Validate Application",
"taskType": "ScriptTask"
}
}
}
}

Response After Step Forward

What happens: The previous task executes, and the process pauses at the next task WITHOUT executing it.

{
"isSuccessful": true,
"message": "Task executed successfully. Paused at next task.",
"statusCode": "00",
"data": {
"instanceGuid": "abc-123-def-456",
"status": "waiting",
"currentTask": {
"taskId": "Task_CreditCheck",
"taskName": "Perform Credit Check",
"taskType": "ServiceTask"
},
"state": {
"variables": {
"loanAmount": 50000,
"customerId": 789,
"validationPassed": true
},
"completedTasks": [
"Task_ValidateApplication"
]
},
"nextActions": [
{
"id": "Task_CreditCheck",
"name": "stepForward",
"type": "control",
"description": "Execute the next task"
},
{
"id": "Task_CreditCheck",
"name": "stepBackward",
"type": "control",
"description": "Go back to previous task (review only, does not undo)"
},
{
"id": "Task_CreditCheck",
"name": "cancel",
"type": "control",
"description": "Cancel process execution"
}
],
"logs": [
"[EXEC] Executing: Task_ValidateApplication (bpmn:ScriptTask)",
"[SCRIPT] Executing script task: Task_ValidateApplication",
"[SCRIPT] Result: {\"validationPassed\": true}",
"[SCRIPT] Task Task_ValidateApplication completed successfully",
"[SUPERVISED] Task Task_ValidateApplication executed. Paused before next task. Use StepForwardCommand to continue."
]
}
}

Execution Flow

Flow: Start → PAUSE (at Task1) → StepForward → Execute Task1 → PAUSE (at Task2) → StepForward → Execute Task2 → PAUSE (at UserTask) → Signal+StepForward → Execute UserTask → PAUSE (at Task3) → StepForward → Execute Task3 → PAUSE (at End) → Complete

Key Point: Each PAUSE happens BEFORE executing the task. You explicitly control when each task runs.

Available Commands by Mode

Unsupervised Mode Commands

CommandPurposeWhen to Use
StartProcessInstanceCommandStart a new processBeginning of process
SignalProcessInstanceCommandResume at UserTaskWhen process is waiting at UserTask
GetProcessInstanceStateCommandCheck statusAnytime - monitoring
CancelProcessInstanceCommandStop processWhen cancellation needed
SkipFailedTaskCommandSkip failed taskWhen task fails and can be bypassed
RetryFailedTaskCommandRetry failed taskWhen task fails temporarily

Supervised Mode Commands

CommandPurposeWhen to Use
StartProcessInstanceCommandStart in supervised modeBeginning of process (with executionMode="Supervised")
StepForwardCommandExecute next taskAfter each pause
StepBackwardCommandReview previous taskFor inspection (doesn't undo)
SignalProcessInstanceCommandResume at UserTaskWhen at UserTask, provide user input
GetProcessInstanceStateCommandCheck statusAnytime - monitoring
CancelProcessInstanceCommandStop processWhen cancellation needed

Command Examples

Step Forward (Supervised Mode Only)

POST /api/core/cmd
Content-Type: application/json

{
"cmd": "StepForwardCommand",
"data": {
"instanceGuid": "abc-123-def-456"
}
}

Response with NextActions:

{
"isSuccessful": true,
"message": "Task executed successfully.",
"statusCode": "00",
"data": {
"previousTask": {
"taskId": "Task_ValidateData",
"taskName": "Validate Application Data",
"executionTime": 156,
"succeeded": true
},
"currentTask": {
"taskId": "Task_CreditCheck",
"taskName": "Credit Check",
"taskType": "ServiceTask"
},
"nextActions": [
{
"action": "stepForward",
"label": "Execute Next Task",
"command": "StepForwardCommand"
},
{
"action": "stepBackward",
"label": "Go Back",
"command": "StepBackwardCommand"
}
],
"state": {
"variables": {
"validationPassed": true
}
}
}
}

Step Backward (Supervised Mode Only)

POST /api/core/cmd
Content-Type: application/json

{
"cmd": "StepBackwardCommand",
"data": {
"instanceGuid": "abc-123-def-456"
}
}
Does Not Undo Execution

Stepping backward only moves the execution pointer for review. It does NOT undo task execution or revert variable changes.

Response:

{
"isSuccessful": true,
"message": "Stepped back successfully.",
"statusCode": "00",
"data": {
"movedFrom": "Task_CreditCheck",
"currentTask": {
"taskId": "Task_ValidateData",
"taskName": "Validate Application Data",
"taskType": "ScriptTask",
"previousExecution": {
"executedAt": "2025-12-19T10:15:30Z",
"succeeded": true,
"executionTime": 156
}
},
"reviewMode": true,
"nextActions": [
{
"action": "stepForward",
"label": "Step Forward Again",
"command": "StepForwardCommand"
}
]
}
}

Signal Process (Both Modes)

Used to resume a process waiting at a UserTask:

POST /api/core/cmd
Content-Type: application/json

{
"cmd": "SignalProcessInstanceCommand",
"data": {
"instanceGuid": "abc-123-def-456",
"signalData": "{\"userAction\": \"approve\", \"comments\": \"Approved by manager\"}"
}
}

Comparison Table

FeatureUnsupervised ModeSupervised Mode
ExecutionAutomaticManual (one task at a time)
Pauses AtUserTask onlyAfter EVERY task
Resume CommandSignalProcessInstanceCommandStepForwardCommand
NextActionsOnly at UserTaskAfter every task ✅
Can Step Backward❌ No✅ Yes
Use CaseProductionDevelopment/Testing
PerformanceFastSlower (manual control)
DebuggingLimitedFull visibility

Best Practices

When to Use Each Mode

Use Unsupervised Mode:

  • ✅ In production environments
  • ✅ For fully tested workflows
  • ✅ When performance matters
  • ✅ For background/batch processes

Use Supervised Mode:

  • ✅ During process development
  • ✅ When debugging issues
  • ✅ For training purposes
  • ✅ To understand process flow
  • ✅ When testing new workflows

Development Workflow

  1. Design - Create BPMN process definition
  2. Test in Supervised - Use Supervised mode to verify each task
  3. Debug - Use StepForward/StepBackward to inspect behavior
  4. Validate - Ensure all tasks execute correctly
  5. Deploy - Switch to Unsupervised mode for production

Monitoring

Use GetProcessInstanceStateCommand in both modes to check:

  • Current status (running, waiting, completed, error)
  • Variable values at any point
  • Completed tasks
  • Current position in the workflow
POST /api/core/cmd
Content-Type: application/json

{
"cmd": "GetProcessInstanceStateCommand",
"data": {
"instanceGuid": "abc-123-def-456"
}
}