Uploaded November 2026 | Updated November 2026, 1 day ago
Code: github.com/krishnaik06/Ai-Safety-And-LLM-Security
Learn how to add NVIDIA NeMo Guardrails to a RAG application and test defenses against direct prompt injection, poisoned documents, and unsafe responses.
In this hands-on tutorial, we configure input, document/retrieval, and output checks, then integrate them into a LangGraph workflow. Using an example company help assistant, we compare the application’s behavior before and after adding guardrails.
You’ll see how policy-based checks can block off-topic instructions, filter suspicious retrieved passages, and inspect generated answers. We also test normal questions to check whether the guarded application still provides useful responses.
This is Part 1 of the NeMo Guardrails walkthrough, combining architecture explanations, Python implementation, and practical attack testing.
⏱️ TIMESTAMPS & TOPICS
00:00 Introduction and recap of prompt injection attacks
00:50 What is NVIDIA NeMo Guardrails?
01:30 Tutorial roadmap and guardrail categories
02:46 What are rails? Understanding policy-based checks
04:44 Where input, retrieval, and output rails fit in RAG
06:28 Python dependencies, imports, and RailStatus
07:53 Project structure and NeMo configuration files
09:20 Configuring self-check input policies
10:26 Configuring self-check output policies
12:19 Document rail configuration
13:05 Retrieval rails: checking context before generation
14:35 Loading configurations with LLMRails
15:06 Testing input rails with allowed and blocked questions
16:39 Testing document rails with clean and poisoned passages
17:43 Testing output rails with safe and damaging answers
18:37 Building a guarded RAG workflow with LangGraph
20:36 Preparing direct and indirect attack examples
21:16 Creating clean and poisoned vector stores
21:56 Direct prompt injection: before vs after guardrails
23:51 Indirect prompt injection and poisoned-document results
24:47 Comparing results in the attack scoreboard
25:12 Testing normal questions and checking false positives
25:58 Summary and what’s coming in Part 2
💡 WHAT YOU’LL LEARN
- How programmable guardrails fit around an LLM application.
- How to define policies in config.yml.
- How to configure self_check_input and self_check_output.
- How to load configurations using RailsConfig and LLMRails.
- How to run asynchronous checks and inspect their status.
- How to filter retrieved documents before passing context to the LLM.
- How to connect input checks, retrieval, document checks, generation, and output checks in LangGraph.
- How to compare guarded and unguarded applications using the same test cases.
- How to check that legitimate user questions still work.
Code: github.com/krishnaik06/Ai-Safety-And-LLM-Security
Learn how to add NVIDIA NeMo Guardrails to a RAG application and test defenses against direct prompt injection, poisoned documents, and unsafe responses.
In this hands-on tutorial, we configure input, document/retrieval, and output checks, then integrate them into a LangGraph workflow. Using an example company help assistant, we compare the application’s behavior before and after adding guardrails.
You’ll see how policy-based checks can block off-topic instructions, filter suspicious retrieved passages, and inspect generated answers. We also test normal questions to check whether the guarded application still provides useful responses.
This is Part 1 of the NeMo Guardrails walkthrough, combining architecture explanations, Python implementation, and practical attack testing.
⏱️ TIMESTAMPS & TOPICS
00:00 Introduction and recap of prompt injection attacks
00:50 What is NVIDIA NeMo Guardrails?
01:30 Tutorial roadmap and guardrail categories
02:46 What are rails? Understanding policy-based checks
04:44 Where input, retrieval, and output rails fit in RAG
06:28 Python dependencies, imports, and RailStatus
07:53 Project structure and NeMo configuration files
09:20 Configuring self-check input policies
10:26 Configuring self-check output policies
12:19 Document rail configuration
13:05 Retrieval rails: checking context before generation
14:35 Loading configurations with LLMRails
15:06 Testing input rails with allowed and blocked questions
16:39 Testing document rails with clean and poisoned passages
17:43 Testing output rails with safe and damaging answers
18:37 Building a guarded RAG workflow with LangGraph
20:36 Preparing direct and indirect attack examples
21:16 Creating clean and poisoned vector stores
21:56 Direct prompt injection: before vs after guardrails
23:51 Indirect prompt injection and poisoned-document results
24:47 Comparing results in the attack scoreboard
25:12 Testing normal questions and checking false positives
25:58 Summary and what’s coming in Part 2
💡 WHAT YOU’LL LEARN
- How programmable guardrails fit around an LLM application.
- How to define policies in config.yml.
- How to configure self_check_input and self_check_output.
- How to load configurations using RailsConfig and LLMRails.
- How to run asynchronous checks and inspect their status.
- How to filter retrieved documents before passing context to the LLM.
- How to connect input checks, retrieval, document checks, generation, and output checks in LangGraph.
- How to compare guarded and unguarded applications using the same test cases.
- How to check that legitimate user questions still work.










