Intermediate level · Module 8: Retrieval-Augmented Generation for Agents · Lesson 3 of 3
Access Control, Citations and Grounding Checks
Learners filter retrieval by the user's access level, require citations for every claim and check automatically that citations point to retrieved passages that support the claim.
In this lesson you will
- Enforce access control in retrieval
- Check grounding and citations automatically
Key concepts
access-level filteringsecure retrievalcitationgrounding checkuntrusted retrieved text
The lesson
Retrieval must respect permissions: filter passages by the user's access level before they reach the model, never after. A model cannot reliably 'keep a secret' it has already been shown.
Require a citation (document ID and passage) for every claim, and check that each cited passage was actually retrieved in this task. Simple checks, such as whether key numbers in the claim appear in the cited passage, catch many unsupported claims.
Treat retrieved text as information, not instructions. If a document contains text such as 'ignore previous instructions', the agent must not follow it. This is a common route for indirect prompt injection.
Step by step
- Add access levels to chunks and filter by user level before retrieval results are returned.
- Add citation checks to the report validator.
- Add a number-matching grounding check.
- Test with a restricted document and a document containing injected instructions.
Practice activity
Add access control, citation and grounding checks to the project retrieval.
Expected result: Restricted passages never reach unauthorised users, unsupported claims are caught and injected text is not obeyed.
Check your understanding
-
Why filter by access level before the model sees passages?
Show answer
A model cannot reliably keep secret information it has been given.
-
How should an agent treat instructions found inside retrieved documents?
Show answer
As information, never as instructions to follow.
Further learning
Taught live by an instructor — online or in person. Free course lessons are for self-study and do not lead to a certificate — see registration options.