A guardrail is an execution policy that constrains an AI system’s inputs, actions, and outputs. Content filters address what a model says; execution policies also enforce organization-specific rules, such as requiring a referral before booking a specialist visit. A shared Guardrails Service lets teams define policies once and apply them across applications rather than relying on prompt instructions alone. section 6.6 section 1.4
A service interface can register named policies, validate input, filter output, check proposed actions against context, and report violations. Keeping policy definitions separate from application logic lets compliance teams change constraints while developers handle violations. section 6.6 section 6.9
Apply guardrails at five inspection points across a request:
- Input validation checks incoming messages for prompt injection, inappropriate topics, or other policy violations before the model processes them. section 6.7.1
- Pre-tool checks evaluate proposed actions against session permissions, business rules, rate limits, and approval requirements. section 6.7.3
- Argument validation checks tool parameters against schemas and domain constraints, such as future appointment dates and patient identity. section 6.7.1
- External response filtering sanitizes sensitive data and handles errors returned by tools before they enter the model’s context. section 6.6
- Output filtering checks the assembled response before delivery, including PII redaction, hallucination detection, and factual grounding. section 6.9
Figure 6.10 The five-point inspection model establishes a defense-in-depth architecture for AI interactions. This multi-layered approach ensures comprehensive policy enforcement at every stage of the request lifecycle:(1) Input Validation intercepts malicious prompt injections or off-topic user messages before they reach the model. (2) Pre-Execution Policy evaluates the model's intended tool calls against session state and business rules (e.g., verifying prerequisites are met before booking). (3) Argument Validation ensures the specific parameters sent to external APIs strictly adhere to domain constraints and schemas.(4) External Response Filtering sanitizes sensitive raw data or handles errors returning from external systems before they are incorporated into the AI's context. (5) Output Filtering serves as the final, holistic gate to catch hallucinations, redact PII, and enforce brand safety before the assembled response is delivered to the user.

The five-point model locates each policy check in the request and response flow. section 6.6
Layers compensate for imperfect individual checks. For example, pattern matching can catch obvious prompt injections, while a classifier catches subtler variants; output checks provide another opportunity to intercept an unsafe response. A policy can block or redirect a request, transform content, or pause an action for approval. section 6.7.1 section 6.7.3 section 6.8.2
Patient appointment booking
Before booking, validate that the requested date is in range and that the patient ID matches the authenticated user. Check permissions and prior actions before executing the tool. A surgical procedure request can instead be queued for a coordinator’s approval, with an acknowledgment to the patient and a configured timeout or escalation. section 6.7.1 section 6.7.3
Listing 6.25 Human approval gate configuration
platform.guardrails.add_policy(
name="high-stakes-approval",
type="human_gate",
rules=[
{
"tool": "healthcare.clinical.record_diagnosis",
"approval_role": "physician", #A
"timeout_hours": 24,
"on_timeout": "expire_and_notify_user"
},
{
"tool": "healthcare.billing.process_refund",
"condition": "amount > 500", #B
"approval_role": "billing_supervisor",
"timeout_hours": 48
},
{
"tool": "healthcare.scheduling.book_procedure",
"condition": "procedure_category == 'surgical'",
"approval_role": "scheduling_coordinator",
"timeout_hours": 4,
"on_timeout": "escalate_to_manager" #C
}
]
)The approval-gate configuration specifies approver roles, conditions, timeouts, and escalation behavior. section 6.7.3
Record every evaluation, including passes, blocks, and silent modifications. Capture the inspection point, policies checked, decision, and classifier confidence where applicable; use content hashes for correlation without logging sensitive content. For transformations, retain original content encrypted with restricted access. Use metrics and audit records to investigate false positives and tune policies; introduce changes through shadow evaluation and canary enforcement with rollback. section 6.8.2 section 6.9






















