docs/en/enterprise/features/pii-trace-redactions.mdx
PII Redaction is a CrewAI AMP feature that automatically detects and masks Personally Identifiable Information (PII) in your crew and flow execution traces. This ensures sensitive data like credit card numbers, social security numbers, email addresses, and names are not exposed in your CrewAI AMP traces. You can also create custom recognizers to protect organization-specific data.
<Info> PII Redaction is available on the Enterprise plan. Deployment must be version 1.8.0 or higher. </Info> <Frame>  </Frame>When running AI agents in production, sensitive information often flows through your crews:
Without proper redaction, this data appears in traces, making compliance with regulations like GDPR, HIPAA, and PCI-DSS challenging. PII Redaction solves this by automatically masking sensitive data before it's stored in traces.
Original: "Contact [email protected] or call 555-123-4567"
Redacted: "Contact <EMAIL_ADDRESS> or call <PHONE_NUMBER>"
<Info>
You need to manually enable PII Redaction for each deployment.
</Info>
<Frame>

</Frame>
<Frame>

</Frame>
CrewAI supports the following PII entity types, organized by category.
| Entity | Description | Example |
|---|---|---|
CREDIT_CARD | Credit/debit card numbers | "4111-1111-1111-1111" |
CRYPTO | Cryptocurrency wallet addresses | "bc1qxy2kgd..." |
DATE_TIME | Dates and times | "January 15, 2024" |
EMAIL_ADDRESS | Email addresses | "[email protected]" |
IBAN_CODE | International bank account numbers | "DE89 3704 0044 0532 0130 00" |
IP_ADDRESS | IPv4 and IPv6 addresses | "192.168.1.1" |
LOCATION | Geographic locations | "New York City" |
MEDICAL_LICENSE | Medical license numbers | "MD12345" |
NRP | Nationalities, religious, or political groups | - |
PERSON | Personal names | "John Doe" |
PHONE_NUMBER | Phone numbers in various formats | "+1 (555) 123-4567" |
URL | Web URLs | "https://example.com" |
| Entity | Description | Example |
|---|---|---|
US_BANK_NUMBER | US Bank account numbers | "1234567890" |
US_DRIVER_LICENSE | US Driver's license numbers | "D1234567" |
US_ITIN | Individual Taxpayer ID | "900-70-0000" |
US_PASSPORT | US Passport numbers | "123456789" |
US_SSN | Social Security Numbers | "123-45-6789" |
For each enabled entity, you can configure how the data is redacted:
| Action | Description | Example Output |
|---|---|---|
mask | Replace with the entity type label | <CREDIT_CARD> |
redact | Completely remove the text | (empty) |
In addition to built-in entities, you can create custom recognizers to detect organization-specific PII patterns.
<Frame>  </Frame>You have two options for custom recognizers:
| Type | Best For | Example Use Case |
|---|---|---|
| Pattern-based (Regex) | Structured data with predictable formats | Salary amounts, employee IDs, project codes |
| Deny-list | Exact string matches | Company names, internal codenames, specific terms |
Configure the following fields:
- **Name**: A descriptive name for the recognizer
- **Entity Type**: The entity label that will appear in redacted output (e.g., `EMPLOYEE_ID`, `SALARY`)
- **Type**: Choose between Regex Pattern or Deny List
- **Pattern/Values**: Regex pattern or list of strings to match
- **Confidence Threshold**: Minimum score (0.0-1.0) required for a match to trigger redaction. Higher values (e.g., 0.8) reduce false positives but may miss some matches. Lower values (e.g., 0.5) catch more matches but may over-redact. Default is 0.8.
- **Context Words** (optional): Words that increase detection confidence when found nearby
The Entity Type determines how matched content appears in redacted traces:
Entity Type: SALARY
Pattern: salary:\s*\$\s*\d+
Input: "Employee salary: $50,000"
Output: "Employee <SALARY>"
Context words improve accuracy by increasing confidence when specific terms appear near the matched pattern:
Context Words: "project", "code", "internal"
Entity Type: PROJECT_CODE
Pattern: PRJ-\d{4}
When "project" or "code" appears near "PRJ-1234", the recognizer has higher confidence it's a true match, reducing false positives.
Once PII redaction is enabled, your traces will show redacted values in place of sensitive data:
Task Output: "Customer <PERSON> placed order #12345.
Contact email: <EMAIL_ADDRESS>, phone: <PHONE_NUMBER>.
Payment processed for card ending in <CREDIT_CARD>."
Redacted values are clearly marked with angle brackets and the entity type label (e.g., <EMAIL_ADDRESS>), making it easy to understand what data was protected while still allowing you to debug and monitor crew behavior.
Solutions:
Solutions:
Solutions:
This example demonstrates how to create a custom recognizer to detect and mask salary information in your traces.
Your crew processes employee or financial data that includes salary information in formats like:
salary: $50,000salary: $125,000.00salary:$1,500.50You want to automatically mask these values to protect sensitive compensation data.
| Field | Value |
|---|---|
| Name | SALARY |
| Entity Type | SALARY |
| Type | Regex Pattern |
| Regex Pattern | salary:\s*\$\s*\d{1,3}(,\d{3})*(\.\d{2})? |
| Action | Mask |
| Confidence Threshold | 0.8 |
| Context Words | salary, compensation, pay, wage, income |
| Pattern Component | Meaning |
|---|---|
salary: | Matches the literal text "salary:" |
\s* | Matches zero or more whitespace characters |
\$ | Matches the dollar sign (escaped) |
\s* | Matches zero or more whitespace characters after $ |
\d{1,3} | Matches 1-3 digits (e.g., "1", "50", "125") |
(,\d{3})* | Matches comma-separated thousands (e.g., ",000", ",500,000") |
(\.\d{2})? | Optionally matches cents (e.g., ".00", ".50") |
Original: "Employee record shows salary: $125,000.00 annually"
Redacted: "Employee record shows <SALARY> annually"
Original: "Base salary:$50,000 with bonus potential"
Redacted: "Base <SALARY> with bonus potential"
After creating your custom recognizer, enable it for each deployment:
<Steps> <Step title="Navigate to Your Deployment"> Go to your deployment/automation and open **Settings** → **PII Protection**. </Step> <Step title="Select Custom Recognizers"> Under **Mask Recognizers**, you'll see your organization-defined recognizers. Check the box next to the recognizers you want to enable.<Frame>

</Frame>