You can configure sensitive data redaction in CX Agent Studio to automatically
detect and remove sensitive information---such as payment card numbers,
Social Security numbers, and contact details---before conversation data is written
to storage.

Redaction is powered by
[Sensitive Data Protection](https://docs.cloud.google.com/sensitive-data-protection/docs.md.txt) and applies
across logging and storage surfaces, including conversation history,
Cloud Logging, BigQuery exports, and audio recordings.

## Configure redaction and DLP templates

You configure redaction settings at the agent application level and manage
reusable DLP templates at the
[project location level](https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/redaction.md.txt#project-templates).

To enable and configure redaction in the CX Agent Studio console:

1. Open your agent application and click **Agent settings** in the left navigation bar.
2. Select the **Advanced** tab, and locate the **Logging** section.
3. Turn on **Enable redaction** . The **Set up redaction** panel opens automatically. If redaction is already enabled, click the arrow button next to **Enable redaction** to reopen **Set up redaction**.
4. Under **Data loss prevention (DLP) templates (optional)**, configure the
   following fields:

   - **Inspect template**: Tells the agent what sensitive data to look for.
   - **Deidentify template**: Tells the agent how to redact what it finds.

   If you select **None (use defaults)**, CX Agent Studio uses its default redaction
   configuration.
5. Click **Done** to apply your template selections.

### Available template options and presets

The **Inspect template** and **Deidentify template** dropdowns list templates
from your agent application's project in the matching
Sensitive Data Protection location (`europe` for `eu`,
`australia-southeast1` for `au`, or the same location ID as the agent
application):

1. **None (use defaults)**: Uses CX Agent Studio default redaction behavior.
2. **CX Agent Studio default templates**: Existing default templates managed by CX Agent Studio in your project.
3. **Built-in presets** (labeled with a **Preset** chip): Curated starting configurations tailored to common compliance profiles:
   - **General / Standard Redaction** : Protects financial identifiers, personal identification, contact information, and authentication secrets (`CREDIT_CARD_NUMBER`, `CVV_NUMBER`, `FINANCIAL_ACCOUNT_NUMBER`, `US_BANK_ROUTING_MICR`, `US_SOCIAL_SECURITY_NUMBER`, `DATE_OF_BIRTH`, `PERSON_NAME`, `PHONE_NUMBER`, `EMAIL_ADDRESS`, `AUTH_TOKEN`, `PASSWORD`).
   - **PCI / Financial**: Protects payment card numbers, track numbers, expiration dates, CVVs, bank account and routing numbers, IBAN/SWIFT codes, SSNs, and spoken digits, with context exclusions for phone numbers, dates of birth, currency amounts, and numeric JSON fields.
   - **Healthcare (US)**: Protects financial and SSN identifiers, with context exclusions for dates, currency amounts, percentages, ISO timestamps, phone numbers, and member IDs.
4. **Project templates**: Existing Sensitive Data Protection inspect and deidentify templates already created in your project and compatible location.

> [!NOTE]
> **Note:** Selecting a **Preset** does not create a template in Sensitive Data Protection automatically, and **Done** remains disabled while any field has an unsaved preset selected. To use a preset with your agent application, open [**Test redaction**](https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/redaction.md.txt#test-redaction), click **Save as** to create a project template from each selected preset, then click **Exit test** and **Done** to apply it to your agent application.

You can also configure `enable_redaction`, `inspect_template`, and
`deidentify_template` programmatically using
[`RedactionConfig`](https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rpc/google.cloud.ces.v1.md.txt#google.cloud.ces.v1.RedactionConfig).

## Manage project DLP redaction templates

You can create, search, and edit reusable
Sensitive Data Protection inspect and deidentify templates for a
project and location in **Project settings**:

1. In the left navigation bar, click **Project and region settings** and select **Project settings**.
2. Locate the **DLP redaction templates** section to search, sort, and paginate existing **Inspect** and **Deidentify** templates in your project and location.
3. To create a template, click **+ Add** \> **Create from starter** , enter a **Name** , choose **Inspect** or **Deidentify** , select a **Starter preset** (or enter the template configuration JSON directly), and click **Create**.
4. To manage an existing materialized template, open its **More actions** menu:
   - **Open in Cloud console**: View the template in the Google Cloud console.
   - **Edit template** : Modify the template **Name** or JSON configuration (with **Copy** , **Undo** , and **Redo** controls) and click **Save** :
     - Unused templates save in place.
     - For CX Agent Studio-managed templates used by agent applications, the **Overwrite template?** dialog warns that overwriting cannot be undone and lists the affected agent applications that will receive your changes immediately. Click **Continue** to overwrite, or click **Discard** to close the dialog without saving (preserving your edits in the editor).
     - For other templates used by agent applications, the **Save as a new
       version?** dialog prompts for a **Display name** and saves your edits as a new template without changing the original template or existing applications. Click **Continue** to save, or click **Discard** to close the dialog without saving.

## Test and edit redaction templates

You can inspect template JSON, test edits inline as drafts, and verify how
sample text or real conversation turns are redacted before updating your agent
application. Nothing run in **Test redaction** is saved or logged.

To open the redaction test tool:

1. In the **Set up redaction** panel, click **Test redaction** in the panel header.
2. When you are finished testing, click **Exit test** to return to the template selection form.

### Inspect, edit, and save templates

The **Templates** column displays the currently selected templates:

1. Switch between **Inspect** and **Deidentify** to view each template's JSON definition.
2. Edit the JSON directly in the editor to test changes inline. Unsaved changes are marked `(unsaved)` and are used immediately when you run a test, without modifying the saved template.
3. Use the editor actions to manage your changes:
   - **Discard**: Reverts unsaved edits in the JSON editor.
   - **Save as** : Saves a preset or edited template as a new template in Sensitive Data Protection. Enter a unique **Display name** and click **Save** . The new template is selected in **Set up redaction** ; click **Exit test** and then **Done** to apply it to your agent application.
   - **Save** : Available when you edit an existing template (for example, in [**Project settings**](https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/redaction.md.txt#project-templates)), opening the **Overwrite
     template?** or **Save as a new version?** confirmation dialog with **Continue** and **Discard** options if agent applications already use the template.

### Run redaction tests

In the **Test redaction** column, choose one of three input sources:

- **Custom text** : Enter sample text in **Text to redact** (pre-populated with synthetic contact information).
- **Golden** : Select a **Golden evaluation** from your agent application to load its turns. You can edit text fields in the loaded turns before running the test.
- **Conversation history** : Select a recorded **Conversation** from your agent application to load and optionally edit its turns before running the test.

Click **Run** to execute redaction with the templates shown in the **Templates**
column.

The **Output** section displays:

- The redacted output text (for **Custom text** ) or a turn-by-turn **Before:** and **After:** comparison per role (for **Golden** and **Conversation
  history** ). Click the copy icon to **Copy output**.
- The redaction status:
  - **Status: OK**: Redaction succeeded.
  - **Status: partly failed closed** or **Status: failed closed** : Sensitive Data Protection failed, so some or all text was replaced with `[REDACTED]`.
  - **Status: partly failed open** or **Status: failed open**: Sensitive Data Protection failed, so some or all text was kept unredacted.
- Detected info types and match counts (`Found: ...`), any findings not transformed because the deidentify template has no matching transformation, and any Sensitive Data Protection error code.

## Monitor and evaluate redaction

- **Monitor production redaction** : View turn-level redaction outcomes, fail-open counts, and info type breakdowns in the [Redaction health](https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/monitor.md.txt#redaction-health) tab of the monitoring dashboard.
- **Automate regression testing** : Define expected sensitive and preserved values on golden test cases and run automated [Redaction evaluations](https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/evaluation.md.txt#redaction-evaluation).