Introduction to Arcjet Content Moderation
Arcjet content moderation evaluates untrusted text for harmful content before it is stored, displayed, or forwarded to another service. Use it on user messages, tool-call results, and model outputs at the same action boundary as Agent guards.
What is Arcjet?
Arcjet is the runtime security platform that ships with your code. Enforce budgets, stop prompt injection, detect bots, and protect personal information with Arcjet's AI security building blocks.Content moderation is a Guard rule. There is no protect() / HTTP-request
variant. Call it from guard() in JavaScript or Python, or Guard in Go.
When to use content moderation
Section titled “When to use content moderation”Use content moderation when you need a decision on text that is about to leave your control or be shown to a user, for example:
- User-facing chat and support assistants — block harmful messages before they are stored or displayed.
- Agent tool results and model outputs — scan generated text before it is forwarded to another tool, a customer, or a third-party API.
- Moderation at the action boundary — the same
guard()call can combine content moderation with rate limiting or prompt injection detection.
Content moderation answers a different question from prompt injection detection (hostile instructions aimed at the model) and sensitive information detection (PII and other regulated data). Combine them when a single untrusted string needs more than one check.
How Arcjet content moderation works
Section titled “How Arcjet content moderation works”- You configure
moderateContent()(JavaScript),ModerateContent()(Python), orGuardModerateContent(Go) once and reuse the rule. - At the action boundary, bind the untrusted text and submit it with
guard()/Guard. - Arcjet returns
ALLOWorDENY. A denial has reasonMODERATE_CONTENT. - The per-rule result is a binary
detected/Detectedverdict plus optional billing intext_units.
The result shape does not include per-category scores.
SDK availability
Section titled “SDK availability”| SDK | Public API | Notes |
|---|---|---|
| JavaScript / TypeScript | moderateContent() | experimental_moderateContent is a deprecated alias. |
| Python | ModerateContent() | experimental_ModerateContent is a deprecated alias (DeprecationWarning). |
| Go | GuardModerateContent | ExperimentalGuardModerateContent* aliases are deprecated until 1.0. |
Dry run mode
Section titled “Dry run mode”mode: "DRY_RUN" / ModeDryRun evaluates the rule without blocking. Use this
to measure detections before switching to "LIVE".
Pricing
Section titled “Pricing”Content moderation is priced based on usage, measured in text_units when the
service reports billing. See the pricing page for
details.