Chatbot Content Moderation: How to Set Safety Rules

Build a chatbot content moderation policy with clear categories, severity rules, response actions, thresholds, and test cases your team can audit.

Cover Image for Chatbot Content Moderation: How to Set Safety Rules

Mistral released Shieldstral on August 4 as a policy-adaptive safety classifier. Instead of forcing every application into one fixed harm taxonomy, it accepts a plain-language policy question and scores whether a prompt, response, prompt-response pair, or image violates that policy. The release makes one awkward fact hard to avoid: a flexible classifier is only useful when the product team has written a precise policy for it to enforce.

A chatbot content moderation policy should turn business risk into repeatable decisions. It must say what gets checked, what counts as a violation, what the visitor sees, when a human reviews the exchange, and which evidence the team keeps. Start with this one-page contract, then attach examples and tests to each row.

Start with a one-page moderation contract

Policy fieldDecision to recordExample
ScopeWhich inputs and outputs are checkedVisitor text, retrieved passages, generated answers, uploaded images
CategoryThe exact behavior being classifiedDirected harassment, credible threats, secret exposure
BoundaryIncluded and excluded examplesAngry criticism is allowed; targeted abuse is limited
SeverityConsequence if the classifier is rightLow, medium, high, critical
ActionWhat the application doesAllow, limit, replace, hand off, or stop
Customer copyReviewed response for each actionAcknowledge the issue and offer a supported next step
EvidenceWhat the review record containsPolicy version, score, decision, message ID, reviewer outcome
OwnerWho may change the ruleTrust lead, support lead, or legal owner

Keep the contract short enough to review in one meeting. Put long examples in a test set, not in the core policy. A 40-page safety document that the runtime cannot map to a decision is governance theater.

Write categories as decisions, not themes

Provider categories are a useful starting point. The OpenAI moderation API reports categories such as harassment, hate, illicit activity, self-harm, sexual content, and violence. Your product still needs narrower rules because a category name does not determine the right customer experience.

Take harassment. A support chatbot may receive all of these messages:

  • "Your delivery service is awful."
  • "The courier was rude to me."
  • "Your courier is an idiot."
  • "Give me the courier's address so I can teach them a lesson."

Blocking all four would hide two legitimate complaints. Allowing all four without intervention would pass a threat and a private-data request into the normal support flow. The policy needs a boundary that distinguishes criticism of the service, a report about conduct, targeted abuse, and a credible safety risk.

Write every category with four parts: a definition, examples that violate it, nearby examples that do not, and the required action. Include business-specific categories alongside general harms. A financial chatbot may prohibit personalized investment instructions. A children's service may restrict adult topics far more tightly. A software support bot may discuss credential recovery but must never ask a visitor to paste a secret into chat.

This is where moderation becomes a product decision. The classifier can estimate whether content matches a rule. It cannot decide how much risk your business accepts or whether a safe partial answer would still help the customer.

Moderate three different objects

Checking only the visitor's message leaves two important paths unreviewed.

Input moderation. Classify what the visitor sent. Preserve legitimate intent even when the wording is angry or contains quoted harmful text. Someone reporting abuse should not receive the same response as someone issuing the abuse.

Context moderation. Check retrieved passages, tool results, and uploaded material before the model uses them. A public webpage can contain slurs in a historical quotation, a support ticket can contain credentials, and a compromised document can contain instructions aimed at the model. The policy should say whether to redact, exclude, quarantine, or permit each kind of context.

Output moderation. Check the final answer, including any tool result rendered to the visitor. Apply stricter rules to the chatbot's own words because they appear under the company's name. The brand-safety test guide covers the adversarial prompts that should probe this output gate after every model or policy change.

Record which object triggered the decision. A log entry that says only harassment: true cannot tell a reviewer whether the visitor used abusive language, a source document contained it, or the chatbot generated it.

Map every verdict to a customer action

A moderation score is not a response plan. Give the application a small set of actions that support can explain and engineering can implement.

ActionUse whenRuntime behaviorVisitor experience
AllowContent fits policyContinue normallyDirect answer
Answer with a boundaryPart of the request is allowedOmit the unsafe portionUseful partial answer and a brief limit
Replace and recoverGenerated output violates policyDiscard output and use fixed copySafe next step without leaked text
Hand offA person must assess intent or riskPreserve a redacted summary and route itClear ownership and response expectation
Stop and containContinuing could cause immediate harmEnd tools, isolate evidence, alert an ownerMinimal reviewed safety copy

Use fixed customer copy for the last three actions. Asking the same model that crossed a boundary to improvise a safer version creates a second chance to fail. Fixed copy can still include structured facts that the application has already validated, such as a support case number or opening hours.

Avoid a universal "I can't help with that" response. It hides why the request stopped, blocks harmless portions of mixed requests, and sends legitimate customers into loops. The refusal-testing guide shows how to measure false denials separately from correct refusals.

Worked case: preserve the complaint, remove the threat

Consider a delivery chatbot that receives this message:

Visitor: Your driver left my order at the wrong building. He is a
worthless idiot. Give me his home address so I can deal with him.

A useful moderation receipt looks like this:

policy_version: support-safety-12
object: visitor_input
categories:
  targeted_abuse: true
  credible_threat: review
  private_data_request: true
supported_intent: missing_delivery
severity: high
action: hand_off
retain:
  - order_id
  - delivery_timestamp
redact:
  - requested_private_address
customer_copy: delivery-safety-handoff-v3

The customer-facing response can stay plain:

I can help report the missing delivery, but I cannot provide a
driver's private address. I have sent the order details and your
safety concern to a delivery specialist for review. Your case number
is D-1842.

The chatbot does not repeat the insult, reveal private data, or ignore the order problem. The handoff record carries the supported facts and flags the safety concern for a person. If the customer then asks when the specialist will reply, the bot should answer from the normal service policy. One high-severity turn should not lock the entire conversation into refusal mode.

Set thresholds with both probability and severity

Classifier confidence and business impact answer different questions. Google's Gemini safety settings explicitly note that harm probability does not measure harm severity. A low-probability event can still deserve a cautious action when the possible result is severe.

Set thresholds by category and action. A medium harassment score may permit the conversation with a warning in the review log. A medium score for exposed credentials may justify redaction before the model sees the text. A credible threat can require human review even when the classifier is uncertain.

Use a labeled evaluation set to choose the thresholds. Suppose 1,000 support messages include 30 real policy violations. A proposed setting blocks 27 of them, misses 3, and blocks 45 allowed complaints. A dashboard may celebrate 90 percent recall. Support will feel the 45 false blocks, and security will care which three violations passed. Break the errors down by category, severity, language, and customer action before approving the setting.

For each category, document the cost of a false block and the cost of an unsafe pass. Then choose the threshold that matches the action. Automatic account suspension needs much stronger evidence than sending a conversation to a review queue.

Test the safe neighbors around every violation

A moderation test set needs clear violations, but the neighboring allowed cases reveal whether the policy is usable. Pair each blocked prompt with examples that share the same vocabulary and have a legitimate intent:

  • A threat versus a customer quoting a threat they received
  • Instructions for self-harm versus a request for crisis resources
  • A slur aimed at a person versus a report that quotes abusive language
  • A credential pasted into chat versus a request for credential-rotation steps
  • A dangerous action request versus a product safety question about that action

Add mixed requests, follow-up turns, misspellings, and the languages that produce meaningful traffic. Run the same cases against input, context, and output checks. A policy can catch harmful generation while still mishandling a quoted phrase in retrieved documentation.

Save the expected action, not an exact sentence. The wording may improve without changing the decision. The action should remain stable until an owner approves a policy update.

Version the policy like production code

Every moderation decision should include the policy version, classifier version, threshold set, object checked, returned scores, chosen action, and final customer outcome. Keep sensitive text out of broad analytics systems. Reviewers should receive the minimum redacted context needed to judge the case.

Track four operational measures: unsafe pass rate, false-block rate, successful recovery after a limit, and reviewer reversal rate. A rising reversal rate means the written boundary, examples, or threshold no longer match real traffic. Feed reversed cases back into the evaluation set.

Require review when the model, classifier, sources, supported languages, tools, or policy text changes. The chatbot change-management guide provides the wider release process. Moderation should be one named gate inside it, with an owner and rollback condition.

Good chatbot content moderation protects the customer without deleting the customer's reason for asking. Define the boundary in plain language, map it to a small set of actions, test both violations and safe neighbors, and keep a receipt for every intervention. Then a new classifier can improve enforcement without silently rewriting your business policy.

In Agentkit, conversation logs provide cases for policy review, while Q&A pairs can pin reviewed recovery language for recurring sensitive questions.

Build your chatbot for free →

No credit card required.

Gratis aan de slagGeen creditcard nodig
Chatbot Content Moderation: How to Set Safety Rules – Agentkit