{
"Comment": "Escalation workflow for knowledge base refresh failures or stale content alerts. Holds for review, runs parallel re-extraction and re-indexing, then routes to resolution or manual intervention.",
"StartAt": "SetRefreshEscalationContext",
"States": {
"SetRefreshEscalationContext": {
"Type": "Pass",
"Parameters": {
"documentId.$": "$.documentId",
"documentType.$": "$.documentType",
"title.$": "$.title",
"sourceUri.$": "$.sourceUri",
"namespace.$": "$.namespace",
"contentOwner.$": "$.contentOwner",
"tags.$": "$.tags",
"expiryDate.$": "$.expiryDate",
"qualityThreshold.$": "$.qualityThreshold",
"refreshEscalation": {
"escalationReason": "STALE_CONTENT_DETECTED",
"originalQualityScore": 0.61,
"qualityDropDelta": -0.14,
"stalenessDays": 45,
"triggeredAt": "2026-04-26T06:00:00Z",
"reIngestionForced": true
}
},
"Next": "ReIngestDocument"
},
"ReIngestDocument": {
"Type": "Task",
"Resource": "${IngestDocumentFunctionArn}",
"Retry": [
{
"ErrorEquals": [
"States.ALL"
],
"IntervalSeconds": 3,
"MaxAttempts": 2,
"BackoffRate": 2
}
],
"Catch": [
{
"ErrorEquals": [
"States.ALL"
],
"Next": "RefreshEscalationFailed"
}
],
"Next": "ReExtractText"
},
"ReExtractText": {
"Type": "Task",
"Resource": "${ExtractTextContentFunctionArn}",
"Retry": [
{
"ErrorEquals": [
"States.ALL"
],
"IntervalSeconds": 3,
"MaxAttempts": 2,
"BackoffRate": 2
}
],
"Catch": [
{
"ErrorEquals": [
"States.ALL"
],
"Next": "RefreshEscalationFailed"
}
],
"Next": "WaitForContentReview"
},
"WaitForContentReview": {
"Type": "Wait",
"Seconds": 5,
"Next": "ParallelReEmbedAndReIndex"
},
"ParallelReEmbedAndReIndex": {
"Type": "Parallel",
"Branches": [
{
"StartAt": "EscalatedEmbeddingGeneration",
"States": {
"EscalatedEmbeddingGeneration": {
"Type": "Task",
"Resource": "${GenerateEmbeddingsFunctionArn}",
"Retry": [
{
"ErrorEquals": [
"States.ALL"
],
"IntervalSeconds": 3,
"MaxAttempts": 2,
"BackoffRate": 2
}
],
"End": true
}
}
},
{
"StartAt": "EscalatedVectorStoreCleanup",
"States": {
"EscalatedVectorStoreCleanup": {
"Type": "Task",
"Resource": "${ValidateRetrievalQualityFunctionArn}",
"Retry": [
{
"ErrorEquals": [
"States.ALL"
],
"IntervalSeconds": 3,
"MaxAttempts": 2,
"BackoffRate": 2
}
],
"End": true
}
}
}
],
"Catch": [
{
"ErrorEquals": [
"States.ALL"
],
"Next": "RefreshEscalationFailed"
}
],
"Next": "EscalatedIndexing"
},
"EscalatedIndexing": {
"Type": "Task",
"Resource": "${IndexToVectorStoreFunctionArn}",
"Retry": [
{
"ErrorEquals": [
"States.ALL"
],
"IntervalSeconds": 3,
"MaxAttempts": 2,
"BackoffRate": 2
}
],
"Catch": [
{
"ErrorEquals": [
"States.ALL"
],
"Next": "RefreshEscalationFailed"
}
],
"Next": "EscalatedCatalogUpdate"
},
"EscalatedCatalogUpdate": {
"Type": "Task",
"Resource": "${UpdateKnowledgeCatalogFunctionArn}",
"Retry": [
{
"ErrorEquals": [
"States.ALL"
],
"IntervalSeconds": 3,
"MaxAttempts": 2,
"BackoffRate": 2
}
],
"Catch": [
{
"ErrorEquals": [
"States.ALL"
],
"Next": "RefreshEscalationFailed"
}
],
"Next": "NotifyRefreshOutcome"
},
"NotifyRefreshOutcome": {
"Type": "Task",
"Resource": "${NotifyIngestionStatusFunctionArn}",
"Retry": [
{
"ErrorEquals": [
"States.ALL"
],
"IntervalSeconds": 2,
"MaxAttempts": 2,
"BackoffRate": 2
}
],
"Next": "RouteRefreshOutcome"
},
"RouteRefreshOutcome": {
"Type": "Choice",
"Choices": [
{
"Variable": "$.retrievalValidation.meetsQualityThreshold",
"BooleanEquals": true,
"Next": "RefreshEscalationResolved"
}
],
"Default": "RefreshEscalationFailed"
},
"RefreshEscalationResolved": {
"Type": "Succeed"
},
"RefreshEscalationFailed": {
"Type": "Fail",
"Error": "RefreshEscalationFailed",
"Cause": "Knowledge base refresh escalation could not restore retrieval quality. Manual content review required."
}
}
}JSONAI 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.