Bulk Content Moderation

Batch content moderation using a Map state with MaxConcurrency 3. Supports large-scale content queue processing and retroactive moderation sweeps.
{
  "Comment": "Batch content moderation using a Map state with MaxConcurrency 3. Supports large-scale content queue processing and retroactive moderation sweeps.",
  "StartAt": "BatchModerateContent",
  "States": {
    "BatchModerateContent": {
      "Type": "Map",
      "ItemsPath": "$.contentItems",
      "MaxConcurrency": 3,
      "ItemProcessor": {
        "ProcessorConfig": {
          "Mode": "INLINE"
        },
        "StartAt": "BatchIngestContent",
        "States": {
          "BatchIngestContent": {
            "Type": "Task",
            "Resource": "${IngestContentFunctionArn}",
            "Retry": [
              {
                "ErrorEquals": [
                  "States.ALL"
                ],
                "IntervalSeconds": 2,
                "MaxAttempts": 2,
                "BackoffRate": 2
              }
            ],
            "Next": "BatchClassifyContent"
          },
          "BatchClassifyContent": {
            "Type": "Task",
            "Resource": "${ClassifyContentFunctionArn}",
            "Retry": [
              {
                "ErrorEquals": [
                  "States.ALL"
                ],
                "IntervalSeconds": 2,
                "MaxAttempts": 2,
                "BackoffRate": 2
              }
            ],
            "Next": "BatchRouteForReview"
          },
          "BatchRouteForReview": {
            "Type": "Task",
            "Resource": "${RouteForReviewFunctionArn}",
            "Retry": [
              {
                "ErrorEquals": [
                  "States.ALL"
                ],
                "IntervalSeconds": 2,
                "MaxAttempts": 2,
                "BackoffRate": 2
              }
            ],
            "Next": "BatchApplyAction"
          },
          "BatchApplyAction": {
            "Type": "Task",
            "Resource": "${ApplyModerationActionFunctionArn}",
            "Retry": [
              {
                "ErrorEquals": [
                  "States.ALL"
                ],
                "IntervalSeconds": 2,
                "MaxAttempts": 2,
                "BackoffRate": 2
              }
            ],
            "Next": "BatchUpdateFeedback"
          },
          "BatchUpdateFeedback": {
            "Type": "Task",
            "Resource": "${UpdateClassifierFeedbackFunctionArn}",
            "Retry": [
              {
                "ErrorEquals": [
                  "States.ALL"
                ],
                "IntervalSeconds": 2,
                "MaxAttempts": 2,
                "BackoffRate": 2
              }
            ],
            "Next": "BatchNotifyOutcome"
          },
          "BatchNotifyOutcome": {
            "Type": "Task",
            "Resource": "${NotifyModerationOutcomeFunctionArn}",
            "Retry": [
              {
                "ErrorEquals": [
                  "States.ALL"
                ],
                "IntervalSeconds": 2,
                "MaxAttempts": 2,
                "BackoffRate": 2
              }
            ],
            "End": true
          }
        }
      },
      "Next": "BatchModerationComplete"
    },
    "BatchModerationComplete": {
      "Type": "Succeed"
    }
  }
}
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