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.
In Supervised mode, every response includes a nextActions array with control commands (stepForward, stepBackward, cancel).
Supervised mode pauses BEFORE executing each task, not after. When you start a supervised process or call StepForwardCommand, the engine:
- Executes the current task (if there is one)
- Moves to the next task
- PAUSES without executing it
- Returns
nextActionswith 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
StepForwardCommandto execute the current task - Can move backwards (
StepBackwardCommand) to review previous tasks (review only, doesn't undo) - Always returns
nextActionsarray 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
| Command | Purpose | When to Use |
|---|---|---|
| StartProcessInstanceCommand | Start a new process | Beginning of process |
| SignalProcessInstanceCommand | Resume at UserTask | When process is waiting at UserTask |
| GetProcessInstanceStateCommand | Check status | Anytime - monitoring |
| CancelProcessInstanceCommand | Stop process | When cancellation needed |
| SkipFailedTaskCommand | Skip failed task | When task fails and can be bypassed |
| RetryFailedTaskCommand | Retry failed task | When task fails temporarily |
Supervised Mode Commands
| Command | Purpose | When to Use |
|---|---|---|
| StartProcessInstanceCommand | Start in supervised mode | Beginning of process (with executionMode="Supervised") |
| StepForwardCommand | Execute next task | After each pause |
| StepBackwardCommand | Review previous task | For inspection (doesn't undo) |
| SignalProcessInstanceCommand | Resume at UserTask | When at UserTask, provide user input |
| GetProcessInstanceStateCommand | Check status | Anytime - monitoring |
| CancelProcessInstanceCommand | Stop process | When 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"
}
}
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
| Feature | Unsupervised Mode | Supervised Mode |
|---|---|---|
| Execution | Automatic | Manual (one task at a time) |
| Pauses At | UserTask only | After EVERY task |
| Resume Command | SignalProcessInstanceCommand | StepForwardCommand |
| NextActions | Only at UserTask | After every task ✅ |
| Can Step Backward | ❌ No | ✅ Yes |
| Use Case | Production | Development/Testing |
| Performance | Fast | Slower (manual control) |
| Debugging | Limited | Full 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
- Design - Create BPMN process definition
- Test in Supervised - Use Supervised mode to verify each task
- Debug - Use StepForward/StepBackward to inspect behavior
- Validate - Ensure all tasks execute correctly
- 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"
}
}
Related Documentation
- Start Process - Starting processes in either mode
- Step Forward - Supervised mode execution
- Step Backward - Supervised mode navigation
- Signal Process - Resuming at UserTasks
- Get Process State - Monitoring processes