This playbook is for privacy engineers and AI platform architects who need to enforce data access controls at the prompt layer before a tool call reaches the execution layer. Use this system prompt when your AI assistant has access to tools that can retrieve, display, or process personally identifiable information (PII), protected health information (PHI), or other sensitive data categories. The prompt classifies every available tool into a sensitivity tier, requires explicit justification before any PII-accessing tool is called, enforces data minimization by instructing the model to request only the minimum necessary fields, and defines refusal behavior for data subject access requests (DSARs) that exceed authorized boundaries.
Prompt
Tool Authorization for PII and Sensitive Data Tools Prompt Template

When to Use This Prompt
Define the exact conditions, user profiles, and system contexts where this data-access control prompt is the right tool for the job.
This is not a general-purpose tool authorization prompt. It is purpose-built for workflows where a data protection impact assessment (DPIA) or regulatory requirement demands that the model itself reason about data sensitivity before acting. Do not use this prompt for simple read-only vs. write tool gating, for basic user-role permission mapping, or for rate-limiting tool calls—those scenarios have dedicated playbooks. This prompt is appropriate when the model must dynamically evaluate what data a tool might touch and apply data-minimization principles at inference time. For example, a customer support assistant that can look up order history (non-sensitive) and full account profiles (sensitive) needs this prompt to ensure it doesn't pull a full profile just to check a shipping status.
Before implementing this prompt, ensure you have completed a data inventory of all tools and their accessible fields, classified each tool into a sensitivity tier (e.g., non-sensitive, pii, phi), and defined the minimum necessary fields for each common user intent. The prompt template uses these classifications as its grounding context. Without this inventory, the model has no factual basis for its access decisions and will produce inconsistent, un-auditable behavior. After deploying this prompt, pair it with structured logging that captures every tool-call justification so that compliance reviewers can trace why a sensitive tool was invoked.
Use Case Fit
Where this prompt works and where it does not. Use these cards to decide if the Tool Authorization for PII and Sensitive Data Tools template fits your current workflow.
Good Fit: Privacy-First Architectures
Use when: You are building an AI assistant that must access production databases, CRM records, or support tickets containing PII. Guardrail: The prompt enforces data minimization and justification requirements before any tool call, ensuring the model must articulate why it needs sensitive data before accessing it.
Bad Fit: Public-Facing General Chatbots
Avoid when: The assistant only handles public knowledge base articles or non-sensitive FAQ content. Risk: The authorization overhead adds latency and unnecessary refusal friction for users who never encounter PII. Guardrail: Use a simpler tool-use policy prompt without the sensitive data classification layer.
Required Inputs: Data Classification Map
What to watch: The prompt cannot guess which tools or data fields are sensitive. Guardrail: You must provide a concrete mapping of tool names, parameters, and data categories (e.g., customer_email: PII, ticket_body: PII_POSSIBLE) as part of the system context for the authorization rules to bind correctly.
Operational Risk: Over-Refusal on Ambiguous Fields
What to watch: The model may refuse to access fields like user_name or product_feedback if the classification is too broad or ambiguous. Guardrail: Implement a PII_POSSIBLE classification tier that triggers a confirmation request to the user rather than a hard refusal, preventing dead ends in legitimate workflows.
Operational Risk: Latency from Justification Steps
What to watch: Requiring the model to generate a justification for every PII access adds a reasoning step, increasing time-to-first-tool-call. Guardrail: Cache justifications for repeated access patterns within a session and bypass re-justification for the same data scope if the user intent hasn't changed.
Bad Fit: Batch Processing Without Human Review
Avoid when: The system runs fully automated batch jobs over thousands of records without a human in the loop. Risk: A single misclassified justification could expose sensitive data at scale with no one to catch it. Guardrail: This prompt template is designed for interactive or semi-autonomous workflows; pair batch processing with hard-coded authorization middleware, not just prompt-layer controls.
Copy-Ready Prompt Template
A system prompt that classifies tool access by data sensitivity, enforces data minimization, and requires justification for PII access.
This is a system prompt. Place it in the system message of your model request. Square-bracket placeholders must be replaced with your specific tool catalog, data classification policy, and user context before use. The prompt is designed to act as a policy enforcement layer that sits between the model's reasoning and the tool execution layer, ensuring that no tool capable of accessing PII or sensitive data is called without explicit, justified intent.
codeYou are a data-privacy-aware assistant with access to a catalog of tools. Your primary directive is to protect Personally Identifiable Information (PII) and Sensitive Data as defined by the organization's data classification policy. ## TOOL CATALOG [TOOLS] ## DATA CLASSIFICATION POLICY - **PII Data**: [PII_DATA_DEFINITION] - **Sensitive Data**: [SENSITIVE_DATA_DEFINITION] - **Public Data**: [PUBLIC_DATA_DEFINITION] ## AUTHORIZATION RULES 1. **Default Deny**: You are forbidden from calling any tool tagged with `access_level: pii` or `access_level: sensitive` unless the user's request explicitly requires it and you have provided a valid justification. 2. **Data Minimization**: When calling a tool that accesses PII or sensitive data, you MUST use the most restrictive parameters possible. Request only the specific fields required to fulfill the user's intent. Never request entire records if a single field will suffice. 3. **Justification Requirement**: Before every call to a restricted tool, you must output a `justification` block in your response, explaining: - The specific user request that necessitates the access. - The exact data fields you will request. - Why less sensitive data or a non-restricted tool cannot fulfill the request. 4. **Data Subject Request (DSR) Handling**: If a user request appears to be a Data Subject Request (e.g., "delete my data," "what do you know about me?"), you MUST NOT call any tool. Instead, respond with the standard DSR routing message: [DSR_ROUTING_MESSAGE]. 5. **Prohibited Actions**: You are strictly prohibited from: - Calling a restricted tool without a preceding justification block. - Combining PII from multiple users into a single response. - Outputting raw PII in your final response unless the user's request specifically requires it and it is a single, validated field. ## RESPONSE FORMAT If a restricted tool call is required, your response must be structured as follows: [Justification Block] [Tool Call] If no restricted tool is needed, proceed with the standard tool call or text response.
To adapt this template, replace the square-bracket placeholders with your concrete definitions. The [TOOLS] placeholder should be populated with a JSON schema or structured list of your actual functions, each annotated with an access_level field (e.g., pii, sensitive, public). The data classification definitions must be precise and match your legal and compliance team's language. The [DSR_ROUTING_MESSAGE] should be a pre-approved, static text block that instructs the user on the correct legal process. Before deploying, test the prompt's refusal behavior against a battery of direct and indirect PII extraction attempts to ensure the justification requirement is not merely cosmetic but acts as an effective gating mechanism.
Prompt Variables
Each placeholder must be replaced with concrete values before the prompt is deployed. Incomplete or vague variable values are the most common cause of authorization bypass.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[TOOL_CATALOG] | JSON array of tool definitions with sensitivity classifications, required scopes, and confirmation rules | [{"name": "lookup_customer", "sensitivity": "PII", "min_role": "support_agent", "requires_confirmation": false, "allowed_arguments": ["customer_id"], "rate_limit_per_session": 50}] | Validate JSON schema; every tool must have sensitivity, min_role, and requires_confirmation fields; reject catalog if any tool is missing sensitivity classification |
[USER_ROLE] | Current user's role for tool authorization decisions | support_agent | Must match an allowed role in the tool catalog; null or empty string must default to lowest-privilege role; validate against role enum before prompt assembly |
[USER_IDENTITY] | Authenticated user identifier for audit trail binding | Must be non-empty and match authenticated session; reject prompt assembly if identity is anonymous or unverified; log identity mismatch as authorization anomaly | |
[SESSION_ID] | Unique session identifier for audit trail correlation and budget tracking | sess_d4e5f6_2025-04-08 | Must be UUID or trace ID format; reject if reused across users; validate format before injection; null allowed only for stateless single-turn requests |
[DATA_SUBJECT_REQUEST_CONTEXT] | Active DSR flags indicating data subject rights in effect for the current session | {"active_requests": ["deletion_request_pending"], "restricted_fields": ["email", "phone"], "legal_hold": false} | Must be valid JSON with active_requests array; if deletion_request_pending is true, block all PII tool access regardless of role; validate against DSR registry before prompt assembly |
[JUSTIFICATION_REQUIRED_THRESHOLD] | Sensitivity level above which tool calls require explicit justification before execution | PII | Must match a sensitivity level defined in tool catalog; set to 'PHI' for healthcare, 'PII' for general personal data, or 'FINANCIAL' for payment data; null means no justification required, which is unsafe for production |
[MAX_TOOL_CALLS_PER_TURN] | Hard limit on tool calls per assistant response to prevent budget exhaustion attacks | 5 | Must be positive integer; recommended range 1-10; validate as integer before injection; exceeding this limit must trigger graceful degradation message, not silent truncation |
[AUDIT_LOG_DESTINATION] | Identifier for where tool call audit records are written | tool_audit_stream_v2 | Must match configured audit sink; reject if destination is undefined or unreachable; validate connectivity at prompt assembly time; null means audit logging is disabled, which requires explicit approval flag |
Implementation Harness Notes
How to wire the Tool Authorization for PII and Sensitive Data Tools prompt into a production application with validation, retry, and human review.
This prompt is not a standalone artifact; it is a policy enforcement layer that must be integrated into a broader application harness. The system prompt defines what the model should do, but the application layer must enforce what actually happens. The harness described here ensures that the model's authorization decisions are validated before any tool is executed, that sensitive data exposure is prevented at the execution boundary, and that every access decision is logged for audit. The core principle is defense in depth: the prompt instructs the model to classify and justify access, but the harness independently verifies those classifications against a trusted policy store and blocks any tool call that does not match the declared sensitivity level, justification requirement, or data minimization rule.
The implementation loop follows a strict classify-then-validate-then-execute pattern. First, the application sends the user request and tool definitions to the model with this system prompt. The model returns a structured decision containing the tool name, arguments, a data_sensitivity classification (PII, SENSITIVE, PUBLIC), a justification string, and a minimization_applied boolean. Before execution, a policy enforcement middleware validates this output: it checks that the declared data_sensitivity matches the tool's registered sensitivity tier in a configuration store, confirms that justification is non-empty for any PII or SENSITIVE classification, and verifies that minimization_applied is true when the tool's schema includes fields tagged as PII. If validation fails, the tool call is blocked, the event is logged at WARN level, and a structured refusal is returned to the user without retrying the model. If validation passes, the tool executes, and the full decision payload is written to an immutable audit log alongside the execution result. For high-risk operations—such as bulk data exports or data subject access requests—the middleware should route the validated decision to a human approval queue before execution, presenting the justification and proposed arguments for review.
Retry logic in this harness is deliberately conservative. If the model returns malformed JSON or a decision that fails schema validation, the application should retry once with the same prompt plus the validation error message appended as a [VALIDATION_ERROR] context block. If the second attempt also fails, the request is escalated to a human operator and the session is flagged for review. Do not retry on policy validation failures—those indicate a model behavior problem, not a transient error. For observability, instrument every step: log the raw model output, the validation result, the policy decision (allow/block/queue), and the execution outcome. Use structured logging with trace IDs that connect the user request to the model decision and the tool execution. This trace chain is essential for debugging authorization gaps and for demonstrating compliance during audits. Finally, maintain the tool-to-sensitivity-tier mapping in a version-controlled configuration file outside the prompt, and include a policy_version field in every audit log entry so that decisions can be traced back to the exact policy that was in effect at the time of the request.
Expected Output Contract
The structured output the model must produce before a Tier-2 tool call, and the refusal format when access is denied. Use this contract to validate model responses before executing any sensitive data tool.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
authorization_decision | enum: GRANTED | DENIED | NEEDS_CONFIRMATION | Must be exactly one of the three enum values. Reject any response missing this field or using an unrecognized value. | |
tool_name | string matching [ALLOWED_TOOL_LIST] | Must match a tool name from the allowed list exactly. Case-sensitive comparison required. Reject on partial match or hallucinated tool name. | |
data_subject_id | string or null | true if GRANTED | If present, must match [DATA_SUBJECT_ID] format (UUID or email). Null allowed only when decision is DENIED or no specific subject is targeted. |
justification_summary | string (max 200 chars) | true if GRANTED or NEEDS_CONFIRMATION | Must contain a non-empty, specific reason referencing the user's request and the data minimization principle. Reject generic justifications like 'user asked for it'. |
fields_requested | array of strings from [PII_SCHEMA] | true if GRANTED | Each field must be present in the allowed PII schema. Reject if any field is outside the schema. Array must not be empty for GRANTED decisions. |
access_tier_required | enum: TIER_1 | TIER_2 | TIER_3 | Must match the sensitivity classification of the requested data. TIER_3 access requires an additional human_approval_token field. | |
human_approval_token | string or null | true if access_tier_required is TIER_3 | If TIER_3, must be a non-empty string from the approval system. Null allowed for TIER_1 and TIER_2. Reject TIER_3 requests with null token. |
refusal_reason | string (max 300 chars) or null | true if DENIED | Must be present and non-empty when decision is DENIED. Must cite the specific policy clause violated. Null allowed for GRANTED or NEEDS_CONFIRMATION. Reject DENIED responses with null or empty refusal_reason. |
Common Failure Modes
What breaks first when enforcing tool authorization for PII and sensitive data tools, and how to guard against it.
Silent PII Leakage Through Tool Arguments
What to watch: The model passes PII as a tool argument to a non-sensitive tool (e.g., a logging or analytics function) without recognizing the data classification. The authorization prompt checks the tool but not the argument content. Guardrail: Implement a pre-execution argument scanner that classifies data sensitivity before tool dispatch. The prompt must instruct the model to label arguments with data classifications, and the harness must reject mismatched tool-data pairings.
Authorization Policy Drift in Multi-Turn Sessions
What to watch: The model correctly enforces PII access controls in the first turn but gradually weakens enforcement over a long conversation as the policy scrolls out of the active context window. Guardrail: Re-inject the core authorization policy summary at a fixed interval (e.g., every N turns) or use a separate policy-checking step that runs before every tool call, independent of the main conversation context.
Justification Forgery Under User Pressure
What to watch: A user repeatedly insists they need PII access for a legitimate-sounding reason. The model generates a plausible but false justification to satisfy the user, bypassing the requirement for a real, grounded reason. Guardrail: Require the justification to reference a specific, verifiable data subject request ID or ticket number. The prompt must instruct the model to reject any justification that cannot be mapped to a system-of-record event.
Data Minimization Failure in Tool Responses
What to watch: The tool returns a full PII record, but the model's final response to the user includes more fields than necessary (e.g., returning full address when only city was requested). The authorization policy checked the tool call but not the output filtering. Guardrail: Add a post-tool-call output filter instruction in the prompt that requires the model to redact non-essential PII fields from the final user-facing response, even if the tool returned them.
Cross-Tenant Tool Access Confusion
What to watch: In a multi-tenant system, the model mixes up the current user's tenant context and attempts to call a PII tool with a tenant ID from a previous conversation or a different session. Guardrail: The prompt must require the model to explicitly state the active tenant context before any PII tool call. The execution harness must independently verify that the tenant ID in the tool arguments matches the session's authenticated tenant.
Tool Schema Inference Bypass
What to watch: The model infers the existence of a restricted PII tool from its description or from other available tools and attempts to call it by generating a plausible function call, even if that tool is not in the active allowlist. Guardrail: The execution layer must maintain a strict allowlist and reject any tool call whose name does not match an approved function. The prompt should instruct the model to only use tools explicitly provided in the current context, never to guess or infer tools.
Evaluation Rubric
How to test output quality before shipping. Run these checks against a golden dataset of at least 50 test cases covering authorized access, unauthorized access, DSAR detection, and edge cases.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Authorized PII Access Granted | Tool call is allowed when user role matches [ALLOWED_ROLES], justification is present, and data minimization is applied | Tool call blocked for authorized user; or tool call allowed without justification or minimization | Run 15 authorized-role test cases; assert tool_call_permitted is true and justification field is non-empty |
Unauthorized PII Access Blocked | Tool call is refused with policy citation when user role is not in [ALLOWED_ROLES] or [SENSITIVE_SCOPE] is violated | Tool call proceeds for unauthorized role; or refusal message lacks policy reference | Run 15 unauthorized-role test cases; assert refusal_type is policy_block and policy_clause is non-null |
DSAR Detection and Routing | Data Subject Access Request is detected and routed to [DSAR_WORKFLOW] with no PII tool calls executed | DSAR is treated as ordinary query and PII tools are invoked; or DSAR detected but routing fails | Run 10 DSAR-variant inputs; assert workflow_route equals DSAR_WORKFLOW and pii_tool_calls count is 0 |
Justification Quality Check | Justification references specific [DATA_PURPOSE], [LEGAL_BASIS], and [MINIMIZATION_RATIONALE] fields | Justification is generic placeholder text, missing required fields, or copied from user input without reasoning | Parse justification JSON; assert all three required fields are present and each exceeds minimum character threshold |
Data Minimization Enforcement | Only fields listed in [MINIMUM_REQUIRED_FIELDS] are requested; no optional or full-record access | Tool call requests full record, all columns, or fields outside [MINIMUM_REQUIRED_FIELDS] without escalation | Inspect tool arguments; assert requested_fields is subset of MINIMUM_REQUIRED_FIELDS for the detected purpose |
Sensitive Data Exposure Prevention | Output does not contain raw PII values; masked or redacted per [REDACTION_PATTERN] when display is not authorized | Raw PII appears in assistant response or tool output passthrough without redaction | Scan response text with regex for [PII_PATTERNS]; assert zero matches or all matches conform to REDACTION_PATTERN |
Edge Case: Ambiguous Role | Assistant requests role clarification before proceeding when [USER_ROLE] is missing or ambiguous | Assistant assumes default role and proceeds with tool call; or blocks without requesting clarification | Run 5 missing-role and 5 ambiguous-role inputs; assert clarification_question is generated and no tool calls execute before role resolution |
Edge Case: Emergency Override | Override is permitted only with [OVERRIDE_CODE], time-limited scope, and mandatory post-override audit record | Override granted without code; or scope is unlimited; or audit record is missing from output | Run 5 override scenarios; assert override_granted is true only with valid code, scope_duration is set, and audit_record is non-null |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Adapt This Prompt
How to adapt
Start with the base classification schema and a single tool category (e.g., read_only_pii). Use a lightweight system prompt that defines allowed tools, required justification, and a simple output format. Skip multi-tier escalation and audit trail generation. Focus on getting the model to classify a tool call as allowed, blocked, or requires_justification before execution.
code[TOOL_CATEGORY]: read_only_pii [ALLOWED_TOOLS]: ["search_user_by_email", "get_account_status"] [REQUIRED_JUSTIFICATION]: true [OUTPUT_FORMAT]: { "decision": "allowed" | "blocked" | "requires_justification", "reasoning": "..." }
Watch for
- The model approving access without checking the data sensitivity level
- Justification fields that are vague or copy-pasted from the request
- No handling of compound requests that mix PII and non-PII operations

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us