Why Guardrails Are Needed in AI
AI systems, especially those based on natural language, introduce new types of risks. Unlike traditional applications, AI interprets user input dynamically, generates responses that are not always deterministic, and can be influenced by how instructions are phrased.
This means risks can arise from:
- harmful or unsafe inputs (for example, prompt injection attempts)
- unintended or incorrect outputs
- use of sensitive data in prompts or responses
To address this, SAP applies guardrails and control mechanisms across the AI interaction flow.
Layered Guardrails Across the AI Flow
SAP does not rely on a single control. Instead, guardrails are applied as a layered system across different stages of the AI process. These controls are applied at different stages of the AI interaction flow, particularly through orchestration layers such as the SAP Generative AI Hub, which govern how requests are handled before and after model interaction.
SAP’s orchestration framework enables secure-by-design AI workflows that integrate multiple layers of protection. These modular components work together to ensure that every AI interaction is controlled, compliant, and trustworthy. This approach ensures data privacy, reduces AI risks, and enables secure, governed workflows across models and tenants.
Input Controls: Filtering and Prompt Management
Before a request reaches an AI model, SAP applies controls to help ensure that the input is safe and structured. These include:
- Content filtering and malicious prompt detection
- Helps detect and filter unsafe, malicious, or policy-violating inputs, including prompt injection attempts (for example, through mechanisms such as Prompt Shield).
- Prompt templating
- Standardizes how prompts are constructed, reducing the risk of uncontrolled or manipulated input.
- Data masking
- Sensitive data (such as personal information) can be anonymized or minimized before being included in a request.
These controls help ensure that input is validated and aligned with defined policies before processing.
Processing Controls: Grounding and Context Management
During processing, SAP applies additional mechanisms to guide AI behavior. These help ensure that the model uses controlled context, follows defined policies, and generates responses based on relevant enterprise data.
SAP enhances AI reliability through document grounding and retrieval-augmented generation (RAG). These two key capabilities ensure outputs are based on verified business data rather than generic model knowledge. Document grounding automatically enriches prompts with relevant business context, reducing hallucinations and improving transparency. This enables explainable AI responses that users can trust.
Retrieval-Augmented Generation (RAG) grounds AI responses in relevant and authorized enterprise data retrieved from controlled sources, such as the SAP HANA Cloud vector engine. This process involves indexing and embedding data in the vector engine, matching queries to relevant content before generation, and injecting those data chunks into prompts.
This approach helps to:
- reduce hallucination risk
- improve accuracy and contextual relevance
- ensure responses are based on relevant business context

Output Controls: Validation and Filtering
After the AI model generates a response, additional controls can be applied before returning it to the user. These include:
- Output filtering: screens responses for unsafe, non-compliant, or sensitive content.
- Response validation: applies business rules or checks to help assess whether outputs meet defined criteria.
- Activity logging: records interactions for monitoring, compliance, and traceability.
These controls help ensure that outputs are filtered, validated, and logged before being returned to the user.

Reducing Key AI Risks
SAP’s guardrails are designed to help reduce several key risks through layered controls:
- Prompt injection
- Mitigated through input filtering, prompt control, and orchestration policies.
- Hallucination
- Reduced through grounding techniques such as RAG and controlled context retrieval.
- Sensitive data exposure
- Minimized through data masking, filtering, and policy enforcement.
- Unsafe or inappropriate outputs
- Addressed through output filtering and validation mechanisms.
These risks are managed to reduce their likelihood and impact rather than eliminating them entirely.
Hint
Lesson Summary
SAP applies guardrails and content safety mechanisms across the AI interaction flow to help ensure safe and governed usage. This includes:
- input controls such as filtering, prompt templating, blocking malicious prompts, and data masking
- processing controls such as grounding through Retrieval-Augmented Generation
- output controls such as filtering, validation, and traceability and logging
- layered approaches to reduce risks such as prompt injection, hallucination, and data exposure
Together, these controls help ensure that AI interactions remain structured, governed, and aligned with enterprise policies.