Gws Modelarmor

Google Model Armor: Filter user-generated content for safety

What Is This?

Overview

Google Model Armor is a content safety filtering service available through the Google Workspace CLI (gws). It provides developers and platform administrators with programmatic tools to evaluate user-generated content against configurable safety templates, helping ensure that text inputs and outputs meet defined content policies before they reach end users or downstream systems.

The service operates through a resource-and-method command structure, where you define floor settings, create reusable templates, and sanitize content by running it through those templates. This approach separates policy configuration from runtime enforcement, making it straightforward to update safety rules without modifying application code.

Model Armor integrates into automated pipelines, moderation workflows, and interactive applications alike. Because it runs as a CLI command, it fits naturally into shell scripts, CI/CD jobs, and backend services that already use the gws toolchain for Google Workspace automation.

Who Should Use This

  • Backend developers building applications that accept user-submitted text and need automated pre-screening before storage or display
  • Platform trust and safety teams who need a scriptable interface to configure and audit content moderation policies
  • DevOps engineers integrating content safety checks into deployment pipelines or automated testing workflows
  • Product managers overseeing compliance requirements who need consistent, auditable filtering across multiple services
  • Data engineers processing large batches of text data who require scalable, policy-driven content evaluation
  • Security engineers responsible for reducing exposure to prompt injection, harmful content, or policy-violating inputs in AI-assisted applications

Why Use It?

Problems It Solves

  • Manual content review does not scale. Model Armor automates the evaluation of text against defined safety criteria, removing the bottleneck of human moderation for high-volume inputs.
  • Inconsistent policy enforcement across services creates compliance gaps. Centralized templates ensure the same rules apply regardless of which application or pipeline submits content for review.
  • Hardcoded filtering logic in application code is fragile and difficult to update. Model Armor separates policy from implementation, allowing rule changes without redeployment.
  • Prompt injection and adversarial inputs pose risks in AI-assisted workflows. Model Armor provides a dedicated sanitization layer before content reaches language models or other sensitive systems.
  • Audit trails for content decisions are difficult to maintain without a dedicated service. Model Armor provides a structured interface that can be logged and monitored consistently.

Core Highlights

  • Resource-and-method command structure for clear, predictable CLI usage
  • Reusable safety templates that decouple policy configuration from runtime calls
  • Floor settings that establish baseline safety thresholds across all templates
  • Content sanitization commands that return structured results suitable for automated decision-making
  • Integration with the broader gws CLI ecosystem, sharing authentication and global flag conventions
  • Suitable for both interactive use and scripted batch processing
  • Configurable per project or environment, supporting staging and production policy separation

How to Use It?

Basic Usage

All Model Armor commands follow this pattern:

gws modelarmor <resource> <method> [flags]

To view available resources and methods:

gws modelarmor --help

To sanitize a piece of user-submitted text against an existing template:

gws modelarmor projects.locations.templates sanitizeUserPrompt \
  --template "projects/my-project/locations/us-central1/templates/my-template" \
  --userPromptData "Tell me how to bypass security controls"

Specific Scenarios

Scenario 1: Creating a safety template

Before sanitizing content, define a template that specifies which safety categories to enforce and at what thresholds:

gws modelarmor projects.locations.templates create \
  --parent "projects/my-project/locations/us-central1" \
  --templateId "standard-policy" \
  --filterConfig '{"raiSettings":{"raiFilters":[{"filterType":"HATE","confidenceLevel":"HIGH"}]}}'

Scenario 2: Batch content evaluation in a shell script

while IFS= read -r line; do
  gws modelarmor projects.locations.templates sanitizeUserPrompt \
    --template "projects/my-project/locations/us-central1/templates/standard-policy" \
    --userPromptData "$line"
done < user_submissions.txt

Real-World Examples

  • A community forum runs all new post submissions through Model Armor before writing them to the database, blocking policy-violating content at the point of entry.
  • A company using an internal AI assistant sanitizes employee prompts through Model Armor before forwarding them to a language model, reducing prompt injection risk.

When to Use It?

Use Cases

  • Pre-screening user-generated content before storage or publication
  • Sanitizing inputs to AI models in automated pipelines
  • Enforcing content policies across multiple applications from a single configuration
  • Auditing historical content against updated safety templates
  • Validating content in staging environments before production deployment
  • Blocking adversarial prompt injection attempts in AI-assisted tools
  • Supporting compliance documentation with structured, logged filter decisions

Important Notes

Requirements

  • The gws CLI must be installed and available in the system path
  • Valid Google Workspace or Google Cloud authentication must be configured before running any Model Armor commands
  • The target Google Cloud project must have the Model Armor API enabled

FAQ

Q: How does the Gws Modelarmor skill filter user-generated content?

The Gws Modelarmor skill uses Google's Model Armor technology to analyze and filter user-generated content for safety and compliance. This helps ensure that content shared via Happycapy Skills remains secure and appropriate.

Q: Can I use Gws Modelarmor with other Happycapy Skills?

Yes, Gws Modelarmor is designed to work alongside other Skills within the Happycapy platform, allowing you to enhance safety across multiple AI agent workflows.

Q: Is Gws Modelarmor compatible with all types of AI agent content?

Gws Modelarmor can filter a wide range of user-generated content processed by AI agents, but its effectiveness depends on the content type and integration within the Skills ecosystem.

Q: How do I set up Gws Modelarmor in my Happycapy environment?

To set up Gws Modelarmor, follow the instructions provided in the Skills section of your Happycapy dashboard. You may need to configure permissions and connect your Google Workspace account.

Q: What are the benefits of using Gws Modelarmor with AI agent-powered Skills?

Using Gws Modelarmor with AI agent-powered Skills helps protect your users by automatically filtering unsafe or inappropriate content. This integration supports a safer and more reliable Happycapy experience.