AI AGENTS

Gate Replicate prompts with a self-hosted HuggingFace classifier

Screens submitted image prompts using a HuggingFace text-classification model instead of a third-party moderation API.

CategoryAI Agents
Enginesim
Difficultyintermediate
Triggerwebhook
Steps6
Setup~15 min

How it runs

The automated pipeline, trigger to output.

  • TriggerPrompt submitted via webhookHTTP webhook
  • ActionClassify prompt on HuggingFace endpointHugging FaceHugging Face
  • LogicCompare top unsafe label to confidence floor
  • ActionDispatch passing prompt to ReplicateReplicateReplicate
  • ActionAppend label and decision to Postgres audit tablePostgreSQLPostgres
  • OutputRespond with prediction handle or denialHTTP webhook

What it does

This is a moderation gate for teams that prefer to run classification on their own HuggingFace inference endpoint rather than send prompts to a hosted moderation API. It applies a fine-tuned NSFW/toxicity text classifier to each prompt, blocks anything over your configured confidence floor, and only then lets Replicate generate.

When to use it

Reach for this when data-residency or model-control requirements rule out external moderation services, or when you have a domain-specific policy classifier you have trained yourself.

How it works

  1. 1A webhook receives the prompt and submitter identity.
  2. 2The prompt is sent to a HuggingFace text-classification endpoint, returning label probabilities.
  3. 3A logic step compares the top unsafe label against your confidence threshold.
  4. 4Prompts under the threshold are dispatched to Replicate for image generation.
  5. 5The classifier label, score, and final action are appended to a Postgres audit table.
  6. 6The caller receives the prediction handle or a typed denial response.

Set it up

What you configure once, before turning it on.

  1. 1
    Connect HTTP webhookTrigger any URL on agent actions.
  2. 2
    Connect Hugging FaceModels, datasets, spaces — the open-source hub.
  3. 3
    Connect ReplicateImage, video, and model inference.
  4. 4
    Connect PostgresAny Postgres URL — query, write, migrate.
  5. 5
    Set each agent's modelWe leave models unset so you pick the tier — fast + cheap, or top-quality.
  6. 6
    Tune it to your dataEdit the prompts, filters, and field mappings so it matches how your team works.
  7. 7
    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.