Model Drift Escalation

Escalation workflow for models flagged with performance drift. Applies a review hold, runs parallel re-evaluation and retraining, then routes to endpoint rollback or redeployment.
{
  "Comment": "Escalation workflow for models flagged with performance drift. Applies a review hold, runs parallel re-evaluation and retraining, then routes to endpoint rollback or redeployment.",
  "StartAt": "SetDriftContext",
  "States": {
    "SetDriftContext": {
      "Type": "Pass",
      "Parameters": {
        "modelName.$": "$.modelName",
        "modelVersion.$": "$.modelVersion",
        "algorithm.$": "$.algorithm",
        "datasetId.$": "$.datasetId",
        "dataSource.$": "$.dataSource",
        "targetColumn.$": "$.targetColumn",
        "taskType.$": "$.taskType",
        "requestedBy.$": "$.requestedBy",
        "performanceThreshold.$": "$.performanceThreshold",
        "driftEscalation": {
          "driftDetected": true,
          "driftType": "PERFORMANCE_DEGRADATION",
          "triggeredAt": "2026-04-26T10:00:00Z",
          "driftMetric": "aucRoc",
          "driftDelta": -0.042,
          "endpointOnHold": true,
          "escalationLevel": "L2_ML_ENGINEER"
        }
      },
      "Next": "ReIngestDriftData"
    },
    "ReIngestDriftData": {
      "Type": "Task",
      "Resource": "${IngestTrainingDataFunctionArn}",
      "Retry": [
        {
          "ErrorEquals": [
            "States.ALL"
          ],
          "IntervalSeconds": 3,
          "MaxAttempts": 2,
          "BackoffRate": 2
        }
      ],
      "Catch": [
        {
          "ErrorEquals": [
            "States.ALL"
          ],
          "Next": "DriftEscalationUnresolved"
        }
      ],
      "Next": "RePreprocessDriftFeatures"
    },
    "RePreprocessDriftFeatures": {
      "Type": "Task",
      "Resource": "${PreprocessFeaturesFunctionArn}",
      "Retry": [
        {
          "ErrorEquals": [
            "States.ALL"
          ],
          "IntervalSeconds": 3,
          "MaxAttempts": 2,
          "BackoffRate": 2
        }
      ],
      "Catch": [
        {
          "ErrorEquals": [
            "States.ALL"
          ],
          "Next": "DriftEscalationUnresolved"
        }
      ],
      "Next": "WaitForDriftReview"
    },
    "WaitForDriftReview": {
      "Type": "Wait",
      "Seconds": 5,
      "Next": "ParallelDriftRetrainAndEvaluate"
    },
    "ParallelDriftRetrainAndEvaluate": {
      "Type": "Parallel",
      "Branches": [
        {
          "StartAt": "EscalatedRetrainingJob",
          "States": {
            "EscalatedRetrainingJob": {
              "Type": "Task",
              "Resource": "${LaunchTrainingJobFunctionArn}",
              "Retry": [
                {
                  "ErrorEquals": [
                    "States.ALL"
                  ],
                  "IntervalSeconds": 5,
                  "MaxAttempts": 2,
                  "BackoffRate": 2
                }
              ],
              "End": true
            }
          }
        },
        {
          "StartAt": "EscalatedBaselineEvaluation",
          "States": {
            "EscalatedBaselineEvaluation": {
              "Type": "Task",
              "Resource": "${EvaluateModelFunctionArn}",
              "Retry": [
                {
                  "ErrorEquals": [
                    "States.ALL"
                  ],
                  "IntervalSeconds": 3,
                  "MaxAttempts": 2,
                  "BackoffRate": 2
                }
              ],
              "End": true
            }
          }
        }
      ],
      "Catch": [
        {
          "ErrorEquals": [
            "States.ALL"
          ],
          "Next": "DriftEscalationUnresolved"
        }
      ],
      "Next": "EscalatedModelRegistration"
    },
    "EscalatedModelRegistration": {
      "Type": "Task",
      "Resource": "${RegisterModelFunctionArn}",
      "Retry": [
        {
          "ErrorEquals": [
            "States.ALL"
          ],
          "IntervalSeconds": 3,
          "MaxAttempts": 2,
          "BackoffRate": 2
        }
      ],
      "Catch": [
        {
          "ErrorEquals": [
            "States.ALL"
          ],
          "Next": "DriftEscalationUnresolved"
        }
      ],
      "Next": "EscalatedEndpointRedeployment"
    },
    "EscalatedEndpointRedeployment": {
      "Type": "Task",
      "Resource": "${DeployModelEndpointFunctionArn}",
      "Retry": [
        {
          "ErrorEquals": [
            "States.ALL"
          ],
          "IntervalSeconds": 5,
          "MaxAttempts": 2,
          "BackoffRate": 2
        }
      ],
      "Catch": [
        {
          "ErrorEquals": [
            "States.ALL"
          ],
          "Next": "DriftEscalationUnresolved"
        }
      ],
      "Next": "NotifyDriftResolution"
    },
    "NotifyDriftResolution": {
      "Type": "Task",
      "Resource": "${NotifyTrainingStatusFunctionArn}",
      "Retry": [
        {
          "ErrorEquals": [
            "States.ALL"
          ],
          "IntervalSeconds": 2,
          "MaxAttempts": 2,
          "BackoffRate": 2
        }
      ],
      "Next": "RouteDriftOutcome"
    },
    "RouteDriftOutcome": {
      "Type": "Choice",
      "Choices": [
        {
          "Variable": "$.evaluation.meetsThreshold",
          "BooleanEquals": true,
          "Next": "DriftEscalationResolved"
        }
      ],
      "Default": "DriftEscalationUnresolved"
    },
    "DriftEscalationResolved": {
      "Type": "Succeed"
    },
    "DriftEscalationUnresolved": {
      "Type": "Fail",
      "Error": "DriftEscalationUnresolved",
      "Cause": "Model drift could not be resolved after escalated retraining. Manual intervention required."
    }
  }
}
JSON
Expand
100%

AI teams can use patterns like this to build reliable, compliant, and scalable automation for payment systems and can test and refine these flows locally with Thrubit to reduce cloud cost and speed up iteration.

Free Trial