PII Masking Node
Using the PII Masking Node
The PII Masking node finds personal information in text and masks it, or restores masked values back to their originals. One node handles both jobs, selected by its Operation option: mask hides the personal information, and unmask restores it. It's typically used to hide personal data before sending a customer inquiry to an external LLM, then restore the original values in the LLM's response.
In this tutorial, you'll build an Ability workflow that masks a customer inquiry containing a phone number and a resident registration number, sends it through an LLM for analysis, and restores the original values. Along the way, you'll see the actual test results and how the two operations work together.
Before You Begin
Before starting this tutorial, you need to create an Ability in your project and enter the Canvas. For instructions on entering the Canvas, see the 🔗3-Step Core Guide.
After completing this tutorial, you will be able to:
Mask personal information in text with the
maskoperation of the PII Masking node.Send masked text to an LLM and restore the LLM's response with the
unmaskoperation.Understand the difference between the
Masking MethodandLLM Detectionoptions and set them for your use case.Check the test results to see which personal information was detected and how it was restored.
Workflow Overview

The core of this tutorial is the PII Masking node.
With the mask operation, the PII Masking node replaces personal information in the input text with placeholders such as [PHONE_NUMBER_1], and outputs detected_entities (the list of what was detected) and mask_fingerprint. With the unmask operation, it restores the placeholders in the LLM's response to their original values. It takes the original text and the fingerprint as inputs, which prevents restoring values from the wrong source.
The node that appears alongside it works as follows:
LLM node: receives the masked text and analyzes the customer inquiry. For detailed settings, see the 🔗LLM Node document.
PII Masking Node Basic Info
The PII Masking node provides the following inputs and options.
Option | Required | Description |
|---|---|---|
| Required |
|
| Required | With |
| Optional | Choose |
| Optional | When on, the model connected through the |
| Optional | With |
| Optional | The fingerprint output by |
Its outputs are result_text (the processed text), detected_entities (the list of detected personal information), mask_fingerprint (the fingerprint), masked_count (how many items were masked), and unresolved_count (how many could not be restored).
In this tutorial, you'll set Operation, Text, and Masking Method on the mask node, and connect Original Text and Original Fingerprint on the unmask node. LLM Detection stays off.
Step 1: Configure the Start Node

Double-click Start Node to enter the Node Editor. Add a String input variable named user_text. The customer inquiry the user types will be stored in this variable.
Step 2: Add and Configure the PII Masking Node (mask)

Click +Add Node → add a PII Masking node from the Security / Privacy category, then double-click it to open the Node Editor.
Enter
maskforOperation. This hides the original text.Drag and drop
user_textfrom the Start Node ontoText.Keep
Masking Methodasplaceholder. It replaces values with placeholders that keep their form, such as[KR_RRN_1], so you can restore them later.
Note — When turning on
LLM Detection
Step 3: Add and Connect the LLM Node

Click +Add Node to place an LLM node on the canvas, and connect it after the masking node from Step 2.
For
System Prompt, write the role and instructions: "You are an expert in analyzing customer inquiry content. Please summarize the key points of the input text concisely and identify the main requests. The text may contain placeholders such as[KR_PHONE_1]or[EMAIL_1], which indicate masked personal information. Please keep the placeholders as-is in your response." The key part is telling the model not to alter the placeholders.For
User Prompt, enter "Please analyze the following customer inquiry:" and, on the line below, drag and dropresult_textfrom the masking node in Step 2. This way, the LLM only receives the text with placeholders, not the original personal information.Select a model that fits your needs. This tutorial uses
Anthropic-claude-4.5-sonnet V1.
Step 4: Add and Configure the Restore Node (unmask)

Add another PII Masking node and connect it after the LLM node. This node performs the unmask operation.
Enter
unmaskforOperation.Drag and drop the LLM node's
outputontoText. The placeholders in the LLM's response are restored here.Drag and drop
user_textfrom the Start Node ontoOriginal Text (unmask only). Providing the original text used for masking lets the node recalculate the mapping between placeholders and original values.Drag and drop
mask_fingerprintfrom the masking node in Step 2 ontoOriginal Fingerprint (unmask only).
Step 5: Configure the End Node

Double-click End Node to enter the Node Editor. Add the output variables you want to check, and bind each one by drag and drop.
masked_text:result_textfrom the masking node in Step 2llm_response_masked:outputfrom the LLM nodefinal_text:result_textfrom the restore node in Step 4detected_entities:detected_entitiesfrom the masking node in Step 2masked_count:masked_countfrom the masking node in Step 2
Step 6: Run the Test
Click RUN TEST and enter the sample sentence below into user_text. The phone number and resident registration number are example data, not real values.
Press Cmd + Enter to run it.
Step 7: Check the Results

When the run finishes, check the following values in the End Node's output.
Output | Result |
|---|---|
| Hello, my name is John Smith and my phone number is |
|
|
| 2 |
| The customer inquiry summary the LLM produced while the placeholders were still in place |
| The LLM response with its placeholders restored to the original values — |
Notice that the name John Smith was not masked. Because LLM Detection is off, only the phone number and resident registration number, which can be found with patterns, were detected. To mask personal information without a fixed format, such as names, you need to turn on LLM Detection and connect an LLM node as described above. Keep in mind that doing so makes unmask impossible, so choose based on your goal.
Next Steps
🎉 Congratulations! You've successfully built the "PII Masking" workflow using Agentria.
Whenever a workflow sends data to an external LLM, you can place this node before and after the LLM to protect personal information. Apply the same pattern to customer support, document summarization, or before and after agent tool calls.
Agentria is a place where ideas become reality—your workflow can expand infinitely with your creativity.
For more node examples, visit the 🔗Node Usage page.
Frequently Asked Questions
What does the PII Masking node do?
It provides two operations in one node: mask, which finds personal information such as phone numbers and resident registration numbers in text and hides it, and unmask, which restores the hidden values to their originals. It's used to keep personal information from being passed to an external LLM as-is.
Can masked values be restored depending on the Masking Method?
placeholder (for example, [KR_RRN_1]) can be restored to the original value with unmask. partial (keeps only the leading characters) and hash (pseudonymizes with a hash) are one-way and cannot be restored.
Why wasn't the name masked?
Because LLM Detection is off by default. With this option off, the node only detects personal information with a fixed format, such as phone numbers and resident registration numbers. To detect personal information without a fixed format, such as names or addresses, turn on LLM Detection and connect a model with the LLM Model edge. Be aware that turning this option on makes unmask impossible.
Do I always need to use the masking node and the restore node together?
If your only goal is to keep personal information from reaching the LLM, you can use just the mask operation. To restore the placeholders in the LLM's response back to the original values in the final result, use the unmask operation as well. In that case, connect both the original text and the fingerprint that mask produced to unmask.