> For the complete documentation index, see [llms.txt](https://docs.uptiq.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.uptiq.ai/academy/tier-2-core-skills/m03-agent-builder-fundamentals/lab-4-guardrails-for-a-financial-workflow.md). Agents can also search and read this documentation through its [MCP server](https://docs.uptiq.ai/~gitbook/mcp).

# Lab 4: Guardrails for a financial workflow

Hands-on lab for lesson 4 of module M03, guardrails for a financial workflow.

{% @uptiq-training/training-labels content="Module 3 | brand
Lesson 4 of 8 | brand
Lab 4 | success
20 minutes | neutral
Bloom level Apply | neutral" %}

{% @uptiq-training/training-navigator title="M03 Agent Builder Fundamentals — Executor 1.4" content="Lesson 1: Configure agent identity and instructions | soon
Lab 1: Configure agent identity and instructions
Lesson 2: Configure agent behavior, runtime and skills | soon
Lab 2: Configure agent behavior, runtime and skills
Lesson 3: Configure knowledge, triggers, secrets and authentication | soon
Lab 3: Configure knowledge, triggers, secrets and authentication
Lesson 4: Guardrails for a financial workflow | soon
Lab 4: Guardrails for a financial workflow | current
Lesson 5: Knowledge check 1 | soon
Lesson 6: Test, validate and troubleshoot the agent | soon
Lab 6: Test, validate and troubleshoot the agent
Lesson 7: Export the agent bundle and configure access controls | soon
Lab 7: Export the agent bundle and configure access controls
Lesson 8: Apply financial skills to a configured agent | soon
Lab 8: Apply financial skills to a configured agent" %}

## Lab overview

**Exercise title:** Configure and Explain Guardrails for a Financial Workflow

**Difficulty level:** Apply / Analyze

**Estimated hands-on time:** 20 minutes (approximately 14 minutes hands-on configuration, 6 minutes concept and explanation)

**What you will build:** You will configure the Guardrails screen of an agent in Agent Builder for a borrower onboarding use case. Specifically, you will enable and configure Sensitive Data Masking (choosing a masking provider and entity types), enable and configure Tool Execution Approval (requiring approval for the KYC/KYB verification skill), and review the Model Policy guardrail. You will also complete a written explanation prompt that maps each guardrail to the specific failure mode it prevents in a borrower onboarding context.

### Prerequisites

* Lessons 1–3 of this module must be complete. Your agent should already have Basic Details, Instructions, Agent Behavior, Runtime (executor 1.4), Skills & Capabilities, Knowledge Attachment, Triggers, Secrets & Variables, and Authentication configured.
* Your agent must be running executor 1.4. PII tokenization (required for Sensitive Data Masking) is only supported on executor 1.4 and later.
* You must have access to Agent Builder in your sandbox environment.

## Your sandbox environment

**Environment access URL:** `<provided by your instructor>`

### Connection details

| **Field**             | **Where to find it**                                                                                         |
| --------------------- | ------------------------------------------------------------------------------------------------------------ |
| **Agent Builder URL** | Navigate to `<environment URL>/platform/agent-builder/<agentId>` — your instructor will provide the agent ID |
| **Agent name**        | Your borrower onboarding agent from Lessons 1–3                                                              |

### Pre-provisioned resources

You do not need to set these up:

* Your borrower onboarding agent with all prior configuration screens completed (Basic Details through Authentication)
* Executor 1.4 selected in Runtime & Versioning
* The KYC/KYB verification skill attached in Skills & Capabilities
* The borrower onboarding knowledge base attached
* A chat trigger configured

{% hint style="info" %}
If any of the pre-provisioned items above are missing from your agent, notify your instructor before starting. This lab builds directly on the configuration from Lessons 1–3.
{% endhint %}

## Configuration template

Use this template to plan your Guardrails configuration before you begin. Fill in your choices as you work through the concept segments in the steps below.

### Sensitive Data Masking

| **Field**                 | **Your value**                                                          |
| ------------------------- | ----------------------------------------------------------------------- |
| **Status**                | Enabled (turn on)                                                       |
| **Masking provider**      | `<YOUR-CHOICE>` — see Step 3 for guidance on Regex vs. Google Cloud DLP |
| **Entity rule**           | Deny list                                                               |
| **Entity types selected** | `<YOUR-SELECTION>` — minimum: SSN, card numbers, date of birth          |

### Tool Execution Approval

| **Field**                    | **Your value**                          |
| ---------------------------- | --------------------------------------- |
| **Status**                   | Enabled (turn on)                       |
| **Approval scope**           | Per skill (not "Enable for all skills") |
| **Skill requiring approval** | KYC/KYB verification skill              |

### Model Policy

| **Field**                  | **Value**                                               |
| -------------------------- | ------------------------------------------------------- |
| **Status**                 | Always enforced (read-only — set at organization level) |
| **Where it is configured** | AI Gateway — not in this screen                         |

### Explanation Prompt

Complete in Step 12.

| **Guardrail**               | **Failure mode it prevents** | **How it prevents it in borrower onboarding** |
| --------------------------- | ---------------------------- | --------------------------------------------- |
| **Sensitive Data Masking**  | `<YOUR ANSWER>`              | `<YOUR ANSWER>`                               |
| **Tool Execution Approval** | `<YOUR ANSWER>`              | `<YOUR ANSWER>`                               |
| **Model Policy**            | `<YOUR ANSWER>`              | `<YOUR ANSWER>`                               |

## Step-by-step instructions

### Procedure 1 — Navigate to the Guardrails Screen

{% stepper %}
{% step %}
**Open Agent Config and navigate to Guardrails**

In Agent Builder, select Agent Config in the canvas header to open the configuration panel. In the left navigation, scroll to the Cognition & Control section and select Guardrails.

You should see the Guardrails list with three columns: Name, Type, and Status.

{% hint style="info" %}
**Checkpoint:** Confirm you can see at least three rows in the Guardrails list: Sensitive Data Masking, Tool Execution Approval, and a Model Policy row showing "Always enforced" in the Status column. If the list is empty or you see an error, check that you are in the correct agent and that your account has the required capabilities.
{% endhint %}
{% endstep %}

{% step %}
**Review the Guardrails list**

Before configuring anything, read through the list. Notice that some guardrails show a toggle in the Status column (these are per-agent and toggleable), while the Model Policy row shows Always enforced with no toggle.

{% hint style="info" %}
**Concept:** The Guardrails screen has two kinds of controls. Per-agent guardrails (Sensitive Data Masking and Tool Execution Approval) are off by default — you must actively turn them on for each agent that needs them. The Model Policy guardrail is always enforced at the organization level by AI Gateway, regardless of what you configure here.

This distinction matters: leaving a per-agent guardrail off means it provides no protection for this agent, even if other agents in your organization have it enabled.
{% endhint %}
{% endstep %}
{% endstepper %}

### Procedure 2 — Configure Sensitive Data Masking

{% stepper %}
{% step %}
**Understand the failure mode and choose your provider**

**What this guardrail prevents:** Unauthorized data access — specifically, PII reaching the language model in plaintext. In a borrower onboarding workflow, a borrower may submit their Social Security number, date of birth, or account number as part of the conversation. Without Sensitive Data Masking, those values are sent to the LLM unmasked.

With it enabled, the platform detects PII and replaces each value with an opaque token (for example, `[SSN_TOKEN_1]`) before the content reaches the model. The original value stays in the vault; a permitted downstream step can restore it.

**Choosing a masking provider**

| **Provider**             | **Best for**                                                           | **Coverage**     |
| ------------------------ | ---------------------------------------------------------------------- | ---------------- |
| **Regex**                | SSNs and card numbers — structured, predictable formats                | 6 entity types   |
| **Google Cloud DLP**     | Broader coverage including names, addresses, and financial identifiers | 133 entity types |
| **AWS Comprehend**       | Wide catalog, managed ML detection                                     | Broad            |
| **Azure Text Analytics** | EU-specific identifiers                                                | Broad            |
| **Off**                  | No PII flows through the agent                                         | None             |

For this exercise, choose Regex if you want low-latency detection for SSNs and card numbers only, or Google Cloud DLP if you want broader coverage. Either is correct — the important thing is that you can explain your choice.

{% hint style="info" %}
Regex is faster because it uses pattern matching rather than ML inference. For structured values like SSNs (`XXX-XX-XXXX`) and card numbers, Regex is reliable and adds minimal latency. For unstructured PII like names and addresses, you need a managed ML provider.
{% endhint %}
{% endstep %}

{% step %}
**Enable Sensitive Data Masking**

In the Guardrails list, find the Sensitive Data Masking row and turn on its toggle.

{% hint style="info" %}
**Checkpoint:** The toggle should now show as enabled. If the toggle is grayed out or unresponsive, confirm that your agent is running executor 1.4 — PII tokenization requires a compatible executor version.
{% endhint %}
{% endstep %}

{% step %}
**Open the Sensitive Data Masking configuration panel**

Select the gear icon in the Sensitive Data Masking row to open its configuration panel.
{% endstep %}

{% step %}
**Select your masking provider and configure entity types**

1. Select your chosen provider (Regex or Google Cloud DLP) from the provider options.
2. Set the entity rule to **Deny list**. This means the platform will mask only the entity types you select — everything else passes through unmasked.
3. Select the following entity types at minimum: **SSN**, **card numbers**, and **date of birth**.
4. Select **Save**.

{% hint style="warning" %}
Do not leave Sensitive Data Masking off if your agent handles PII. When this guardrail is off, content reaches the model unmasked — SSNs, dates of birth, and account numbers submitted by borrowers will be sent to the LLM in plaintext. This is the primary data exposure risk in a borrower onboarding workflow.
{% endhint %}

{% hint style="info" %}
**Checkpoint:** After saving, confirm that the Sensitive Data Masking row in the Guardrails list shows your chosen provider and that the entity rule is set to Deny list. If the Save button was not available, check that you selected at least one entity type.
{% endhint %}
{% endstep %}
{% endstepper %}

### Procedure 3 — Configure Tool Execution Approval

{% stepper %}
{% step %}
**Understand the failure mode**

**What this guardrail prevents:** Unauthorized tool execution — the agent taking a high-risk action without human approval. In a borrower onboarding workflow, the agent is configured to call an API that pushes verified data into the core banking system. Without Tool Execution Approval, the agent executes this call automatically whenever its planner decides to.

With Tool Execution Approval enabled for that skill, the agent pauses before the call and presents it to the user: **Allow** runs the skill; **Deny** blocks it and the agent continues without it.

{% hint style="info" %}
**Concept:** Not every skill needs approval. Low-risk actions — reading from a knowledge base, generating a summary — can run automatically. High-risk actions — writing to a core system, sending a communication, initiating a financial transaction — should require approval.

The goal is to keep a human in the loop for actions that are difficult or impossible to reverse.
{% endhint %}
{% endstep %}

{% step %}
**Enable Tool Execution Approval**

In the Guardrails list, find the Tool Execution Approval row and turn on its toggle.
{% endstep %}

{% step %}
**Open the Tool Execution Approval configuration panel**

Select the gear icon in the Tool Execution Approval row to open the Edit Tool Permission panel.
{% endstep %}

{% step %}
**Require approval for the KYC/KYB verification skill**

In the Edit Tool Permission panel, find the KYC/KYB verification skill in the list and turn on its approval toggle. Do not select Enable for all skills — you want targeted approval for the high-risk action only, not for every skill the agent uses.

Select Update Tool Permission.

{% hint style="info" %}
**Checkpoint:** After updating, confirm that the Tool Execution Approval row in the Guardrails list shows as enabled. When the agent runs and reaches the KYC/KYB skill, it will pause and display an approval prompt to the user before executing.
{% endhint %}

{% hint style="success" %}
Use "Enable for all skills" only when you are in early development and want to observe every tool call the agent makes. In production, require approval only for skills that take irreversible or high-risk actions.

Requiring approval for low-risk skills (like Knowledge Search) creates unnecessary friction and trains users to click Allow without reading.
{% endhint %}
{% endstep %}
{% endstepper %}

### Procedure 4 — Review the Model Policy Guardrail

{% stepper %}
{% step %}
**Review the Model Policy row**

In the Guardrails list, find the Model Policy row (it may be labeled with the specific policy name your organization has configured). Confirm that its Status column shows Always enforced with no toggle available.

{% hint style="info" %}
**Concept:** The Model Policy guardrail (Allowed LLM Families and Allowed LLM Providers) is enforced by AI Gateway at the organization level. It applies to every model request from every agent in your organization — you cannot turn it off per agent, and you cannot configure it here.

In a borrower onboarding context, your organization may have approved only specific model families that meet data residency or compliance requirements. The model policy guardrail ensures no agent can use an unapproved model, even if the agent builder attempts to configure one. This prevents a policy violation failure mode: an agent using a model that has not been cleared for financial data processing.
{% endhint %}

{% hint style="info" %}
If you need to know which model families and providers are approved for your organization, check with your AI Gateway administrator. The approved families and providers are set there, not in Agent Builder.
{% endhint %}
{% endstep %}
{% endstepper %}

### Procedure 5 — Complete the Explanation Prompt

{% stepper %}
{% step %}
**Write your guardrail explanations**

Return to the Configuration Template in Section 3 of this guide and complete the Explanation Prompt table. For each guardrail, write:

* **One sentence** describing the failure mode it prevents.
* **One sentence** describing how it prevents that failure mode in the borrower onboarding context.

Use your own words. The goal is to demonstrate that you understand the connection between the mechanism and the risk — not to reproduce the descriptions from this guide.

{% hint style="info" %}
A strong explanation names a specific scenario. For example: "Without Sensitive Data Masking, a borrower's SSN submitted in the chat is sent to the LLM in plaintext, where it could be logged, cached, or exposed — Sensitive Data Masking replaces the SSN with a token before the model sees it, keeping the original value in the vault."
{% endhint %}

**A note on hallucination**

You may have heard that guardrails prevent hallucination. This is a common misconception worth addressing directly. The Guardrails screen controls data exposure, tool execution, and model policy — it does not directly prevent hallucination.

Hallucination is addressed through knowledge attachment (grounding the agent in approved documents) and instruction quality (constraining what the agent can claim). The Faithfulness evaluator measures how much of what the agent said is supported by its context, but that is an evaluation tool, not a guardrail.

Do not include hallucination prevention as a function of the Guardrails screen in your explanation.
{% endstep %}
{% endstepper %}

## Troubleshooting

<details>

<summary>Fixes for common problems in this lab</summary>

| **Symptom**                                                                                         | **Cause**                                                                                              | **Fix**                                                                                                                                                                                                                                                                |
| --------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Sensitive Data Masking toggle is grayed out or unresponsive**                                     | Agent is not running executor 1.4; PII tokenization requires a compatible executor version             | Open Agent Config → Runtime & Versioning and confirm executor 1.4 is selected. If not, update the executor version and save, then return to Guardrails.                                                                                                                |
| **Save button in the Sensitive Data Masking panel is not available**                                | No entity types have been selected                                                                     | Select at least one entity type from the list before saving.                                                                                                                                                                                                           |
| **Tool Execution Approval toggle is enabled but the agent does not pause before the KYC/KYB skill** | Approval was not enabled for the specific skill in Edit Tool Permission                                | Open the gear icon on the Tool Execution Approval row, confirm the KYC/KYB skill's approval toggle is on in the Edit Tool Permission panel, and select Update Tool Permission.                                                                                         |
| **Model Policy row shows no toggle**                                                                | Expected behavior — Model Policy is always enforced at the organization level                          | No action needed. This is not a configuration error.                                                                                                                                                                                                                   |
| **After enabling Sensitive Data Masking, PII still appears unmasked in agent responses**            | The masking provider is set to Off, or the entity type for the PII in question is not in the Deny list | Open the gear icon on the Sensitive Data Masking row, confirm the provider is not Off, and confirm the relevant entity type is selected in the Deny list.                                                                                                              |
| **Learner cannot find the KYC/KYB skill in the Edit Tool Permission panel**                         | The skill was not attached in Lessons 1–3, or the skill name differs in your sandbox                   | Notify your instructor. The KYC/KYB verification skill must be attached in Skills & Capabilities before it appears in the Tool Execution Approval panel.                                                                                                               |
| **Explanation prompt — learner claims Guardrails screen prevents hallucination**                    | Common misconception                                                                                   | Hallucination is addressed through knowledge attachment and instruction quality, not the Guardrails screen. The Faithfulness evaluator measures hallucination risk but is an evaluation tool. Revise the explanation to map each guardrail to its actual failure mode. |

</details>

## Checkpoints and validation

### Embedded Checkpoints (Formative)

#### Checkpoint A — Guardrails list visible

Confirm you can see the Guardrails list with Name, Type, and Status columns. Confirm the Model Policy row shows "Always enforced" with no toggle.

If you do not see this, you may be in the wrong section of Agent Config — navigate to Agent Config → Guardrails under Cognition & Control.

#### Checkpoint B — Sensitive Data Masking enabled and configured

Confirm:

* The Sensitive Data Masking toggle is on.
* The gear icon opens a configuration panel showing your chosen provider (not Off).
* The entity rule is set to Deny list.
* SSN, card numbers, and date of birth are all selected.
* You selected Save before closing the panel.

If any of these are missing, reopen the configuration panel and complete the missing items.

#### Checkpoint C — Tool Execution Approval enabled for the KYC/KYB skill

Confirm:

* The Tool Execution Approval toggle is on.
* The gear icon opens the Edit Tool Permission panel.
* The KYC/KYB verification skill has its approval toggle enabled.
* You selected Update Tool Permission.

If the KYC/KYB skill does not appear in the panel, the skill was not attached in a prior lesson. Notify your instructor.

#### Checkpoint D — Explanation prompt complete

Confirm that the Explanation Prompt table in Section 3 has all six cells filled in: one failure-mode sentence and one mechanism sentence for each of the three guardrails.

Confirm that none of the three entries claim the Guardrails screen prevents hallucination.

**Assessment Component:** No summative assessment in this lesson. Formative checks for EO-1 and EO-2 content appear in Lesson 5 (Knowledge Check 1).

## Solution reference

The following shows the complete, correct Guardrails configuration for the borrower onboarding agent at the end of this lesson.

### Sensitive Data Masking — Completed Configuration

| **Field**            | **Correct value**                                                                                  |
| -------------------- | -------------------------------------------------------------------------------------------------- |
| **Status**           | Enabled                                                                                            |
| **Masking provider** | Regex (for SSN and card numbers) **or** Google Cloud DLP (for broader coverage) — both are correct |
| **Entity rule**      | Deny list                                                                                          |
| **Entity types**     | SSN, card numbers, date of birth (minimum)                                                         |

### Tool Execution Approval — Completed Configuration

| **Field**                   | **Correct value**                           |
| --------------------------- | ------------------------------------------- |
| **Status**                  | Enabled                                     |
| **Approval scope**          | Per skill — KYC/KYB verification skill only |
| **"Enable for all skills"** | Off                                         |

### Model Policy — Expected State

| **Field**           | **Expected value**                                         |
| ------------------- | ---------------------------------------------------------- |
| **Status**          | Always enforced (read-only)                                |
| **Action required** | None — this is set at the organization level in AI Gateway |

### Explanation Prompt — Example Correct Responses

The following are example correct responses. Your wording does not need to match exactly — what matters is that each response correctly names the failure mode and the mechanism.

<details>

<summary>Sensitive Data Masking</summary>

* **Failure mode:** Unauthorized data access — PII reaching the language model in plaintext.
* **How it prevents it:** When a borrower submits their SSN or date of birth in the chat, Sensitive Data Masking detects those values and replaces them with opaque tokens before the content reaches the model, so the LLM never sees the original PII.

</details>

<details>

<summary>Tool Execution Approval</summary>

* **Failure mode:** Unauthorized tool execution — the agent taking a high-risk action (pushing data to the core banking system) without human approval.
* **How it prevents it:** When the agent's planner reaches the KYC/KYB verification skill, it pauses and presents an Allow/Deny prompt to the user; the API call to the core banking system does not execute until the user explicitly approves it.

</details>

<details>

<summary>Model Policy</summary>

* **Failure mode:** Policy violation — the agent using a model provider or family that has not been approved for financial data processing.
* **How it prevents it:** AI Gateway enforces the organization's approved model families and providers on every model request, regardless of what the agent builder configures; an agent cannot use an unapproved model even if one is selected in Agent Behavior.

</details>

### What the Completed Lab Environment Looks Like

When all procedures are successfully executed:

1. The Guardrails list shows Sensitive Data Masking with its toggle on and your chosen provider displayed.
2. The Guardrails list shows Tool Execution Approval with its toggle on.
3. The Edit Tool Permission panel, accessible via the gear icon on Tool Execution Approval, shows the KYC/KYB verification skill with its approval toggle enabled.
4. The Model Policy row shows "Always enforced" — no change from the initial state.
5. The Explanation Prompt table in Section 3 is fully completed with accurate failure-mode and mechanism descriptions for all three guardrails.

{% hint style="info" %}
The Guardrails screen does not have a single "Save all" button — each guardrail's configuration is saved individually within its own panel. If you are unsure whether your changes were saved, reopen each gear icon and confirm the values are still set as you configured them.
{% endhint %}

{% hint style="success" %}
**Lab complete.** Confirm every checkpoint above before you move on.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.uptiq.ai/academy/tier-2-core-skills/m03-agent-builder-fundamentals/lab-4-guardrails-for-a-financial-workflow.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
