Conversation
Pegasystems Inc.
CA
Last activity: 3 Dec 2025 20:39 EST
Protect While You Build: Pega GenAI Prompt Redaction
Protect what matters while you innovate. Pega GenAI lets you automatically mask sensitive data in request prompts so your teams can harness AI with confidence. This article explains how Pega Platform applies masking by default, what gets detected, how the process works end to end, and how to tailor the configuration to your organization’s needs.
Which rule is applied by default
- When you enable sensitive data masking for a GenAI Connect rule, Pega applies the default configuration of the pyGenAIPIIdetector rule to the request prompt.
- pyGenAIPIIdetector is a text analyzer rule with a scope of @baseclass. For background, see Building text analyzers.
How masking works After the default pyGenAIPIIdetector configuration is applied to your prompt, the system:
- Detects entities such as email addresses, account numbers, names, and phone numbers.
- Replaces each detected entity with a mask using angle brackets and the entity type, plus a numeric suffix when multiple instances occur (for example, <Email1>).

- Sends the masked prompt to Pega GenAI.
- Receives the AI response and restores the original values in place of the masks before writing results to your target fields.
Demo: Learn how to enable PII masking and, step by step, configure custom entity detection for data masking using the pyGenAIPIIdetector rule.
Change the default masking configuration
- To mask only specific entity types (or expand what’s masked), specialize pyGenAIPIIdetector in the class where you define your GenAI rules.
- This specialization applies to all GenAI Connect rules that have masking enabled within that class.
Best practices
- Minimize sensitive data in prompts; pass only what is necessary for the AI task.
- Use clear, structured prompts so masking performs consistently.
- Validate masked/unmasked behavior in lower environments before production.
- Pair masking with role-based access controls and audit logging.
Constellation 101 Series
Enjoyed this article? See more similar articles in Constellation 101 series.
Interested in more Gen AI series - Visit Pega Gen AI Series