On this page
Sommatic Docs
Open portal

Safety Filter

Evaluates text against safety guidelines to block harmful content.

View as Markdown
Open in
AI Experimental ai.safety.filter Version 1.0.0 Execution: async

Experimental stub. It returns a fixed { message, timestamp } object without evaluating the input and without a port, so the engine routes it to out, which this node does not declare: nothing connected to safe or blocked runs.

Uses a moderation model (e.g., OpenAI Moderation API, Llama Guard) to detect categories like Hate, Harassment, Self-Harm, Sexual, or Violence.

Use Cases:

  • Moderating user input before sending to an LLM.
  • Validating LLM output before showing to user.
  • Ensuring brand safety.

How it works

  1. Resolves the node config: expressions in config keys are evaluated against the run; the incoming item is used as-is.
  2. Returns { message: "Executed ai.safety.filter", timestamp } with no port. The engine routes to out; with no out edges the branch ends here.

In a workflow

The node as it appears in a workflow file (draft_nodes[]), and the envelope of a successful run.

{
  "node_id": "node-safety-filter",
  "label": "Moderate content",
  "operator_slug": "ai.safety.filter",
  "operator_version": "1.0.0",
  "config": {
    "policies": [
      "hate",
      "violence"
    ]
  }
}

Configuration

policies array<string> Optional

List of categories to block (e.g. ["hate", "violence"]). Empty = All.

Its configuration shows the shared execution settings, but this node does not apply retries (retryOnFail, maxTries) yet. continueOnFail is not applied by any node.

Behaviour in the code

What the implementation does with these keys beyond what the schema says.

policies
Declared but ignored.

Output ports

safe default

Never fires.

blocked

Never fires: nothing is blocked.

error

Never emitted by the code.

In expressions

What a later node can read from this node's output with $("Safety Filter").item.json.<path>, as the workflow editor suggests it under Previous Nodes (the output contract).

Expression
$("Safety Filter").item.json.is_safeboolean
$("Safety Filter").item.json.flagged_categoriesarray
$("Safety Filter").item.json.scoresobject

Input contract

text string Required

Creating content to moderate.

Output contract

is_safe boolean Optional
flagged_categories array<string> Optional
scores object Optional

Contracts (JSON Schema)

The definition exactly as the orchestrator declares it. All is the whole *.definition.js; compare it with the sections above to spot differences between the documentation and the schema. Use it to validate a node before you publish.

{
  "slug": "ai.safety.filter",
  "name": "Safety Filter",
  "category": "ai",
  "version": "1.0.0",
  "description": "Evaluates text against safety guidelines to block harmful content.\n\n  Uses a moderation model (e.g., OpenAI Moderation API, Llama Guard) to detect categories like Hate, Harassment, Self-Harm, Sexual, or Violence.\n\n  **Use Cases:**\n  - Moderating user input before sending to an LLM.\n  - Validating LLM output before showing to user.\n  - Ensuring brand safety.",
  "capabilities": [
    "moderation",
    "safety",
    "guardrails"
  ],
  "config_schema": {
    "type": "object",
    "properties": {
      "policies": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "title": "Blocked Categories",
        "description": "List of categories to block (e.g. [\"hate\", \"violence\"]). Empty = All."
      },
      "execution": {
        "type": "object",
        "title": "Execution Settings",
        "properties": {
          "alwaysOutputData": {
            "type": "boolean",
            "title": "Always Output Data",
            "description": "Always output data, even on error (if configured).",
            "default": false
          },
          "retryOnFail": {
            "type": "boolean",
            "title": "Retry On Fail",
            "description": "Retry the execution if it fails.",
            "default": false
          },
          "maxTries": {
            "type": "integer",
            "title": "Max Retries",
            "description": "Number of retries.",
            "default": 3,
            "displayOptions": {
              "show": {
                "retryOnFail": [
                  true
                ]
              }
            }
          },
          "waitBetweenTries": {
            "type": "integer",
            "title": "Wait Between Retries (ms)",
            "default": 1000,
            "displayOptions": {
              "show": {
                "retryOnFail": [
                  true
                ]
              }
            }
          },
          "continueOnFail": {
            "type": "boolean",
            "title": "Continue On Fail",
            "description": "Do not crash workflow on error.",
            "default": false
          },
          "timeout_ms": {
            "type": "integer",
            "title": "Timeout (ms)",
            "description": "Max execution time for this node before it is killed, in milliseconds. Honored by long-running operators (e.g. OCR/extraction, inline code). Default 300000 (5 min).",
            "default": 300000
          }
        }
      }
    }
  },
  "input_contract_schema": {
    "type": "object",
    "properties": {
      "text": {
        "type": "string",
        "description": "Creating content to moderate."
      }
    },
    "required": [
      "text"
    ]
  },
  "output_contract_schema": {
    "type": "object",
    "properties": {
      "is_safe": {
        "type": "boolean"
      },
      "flagged_categories": {
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "scores": {
        "type": "object"
      }
    }
  },
  "ports": [
    {
      "port_id": "safe",
      "label": "Safe",
      "is_default": true,
      "description": "Content passed checks."
    },
    {
      "port_id": "blocked",
      "label": "Blocked",
      "description": "Content violated safety policy."
    },
    {
      "port_id": "error",
      "label": "Error",
      "description": "Moderation service failure."
    }
  ],
  "execution_mode": "async",
  "tags": [
    "safety",
    "moderation",
    "guardrail"
  ],
  "is_stateful": false,
  "publisher": {
    "identity": "org_sommatic_ai",
    "profile": {
      "name": "Sommatic AI",
      "verified": true,
      "url": "https://me.veripass.com/sommatic",
      "logo_url": null
    }
  }
}

Execution

Execution
async
Stateful
No
Retries (retryOnFail)
No
Capabilities
moderationsafetyguardrails
Tags
safetymoderationguardrail

Notes and limits

  • Not implemented: moderation, category scores and blocking. For a working safety check use ai.safety.scan, which routes to pass/fail.

Reviewed against the orchestrator code · 31e874b · 2026-11-26

Install agent tools

Give your coding agent the official Sommatic AI docs: skills, the docs MCP server and Markdown pages, so it never has to scrape the site.

Skills only. They do not update by themselves; run it again to refresh.

npx skills add https://docs.sommatic.ai
How agents read these docs