AI AGENTS

Re-check generated Replicate images and quarantine unsafe output

After Replicate finishes an image, this workflow runs the result through a HuggingFace image-safety classifier, deletes or quarantines unsafe images.

CategoryAI Agents
Enginesim
Difficultyadvanced
Triggerevent
Steps6
Setup~25 min

How it runs

The automated pipeline, trigger to output.

  • TriggerReplicate prediction completes (webhook)ReplicateReplicate
  • ActionClassify output image for safetyHugging FaceHugging Face
  • LogicBranch on unsafe score vs threshold
  • ActionMove unsafe image to S3 quarantine bucketAWS S3
  • ActionLog image reference and disposition to PostgresPostgreSQLPostgres
  • OutputReturn released URL or quarantine noticeHTTP webhook

What it does

Prompt screening catches unsafe text, but generators can still produce unsafe images from innocent-looking prompts. This workflow closes that gap by classifying the actual output image after generation. Safe images are released to the user; unsafe ones are quarantined in object storage and flagged, never delivered.

When to use it

Use it as a second layer behind a prompt gate, or on its own when your risk is in the imagery rather than the wording. Essential for public-facing generators where a single unsafe image is a serious incident.

How it works

  1. 1A Replicate prediction-complete webhook delivers the finished image URL.
  2. 2The image is run through a HuggingFace image-classification safety model.
  3. 3A logic branch checks the unsafe score against the threshold.
  4. 4Unsafe images are moved to a quarantine bucket in AWS S3 rather than served.
  5. 5The image reference, scores, and disposition are logged to Postgres.
  6. 6The caller receives either the released image URL or a quarantine notice.

Set it up

What you configure once, before turning it on.

  1. 1
    Connect ReplicateImage, video, and model inference.
  2. 2
    Connect Hugging FaceModels, datasets, spaces — the open-source hub.
  3. 3
    Connect AWS S3Buckets, objects, signed URLs.
  4. 4
    Connect PostgresAny Postgres URL — query, write, migrate.
  5. 5
    Connect HTTP webhookTrigger any URL on agent actions.
  6. 6
    Set each agent's modelWe leave models unset so you pick the tier — fast + cheap, or top-quality.
  7. 7
    Tune it to your dataEdit the prompts, filters, and field mappings so it matches how your team works.
  8. 8
    Test, then turn it onRun once against a sample, confirm the output, then enable the trigger.

Run this workflow in your colony.

14-day trial. No DevOps. No Sales call. Provisioned in under a minute.