Retrieval is a read operation against data that may be sensitive, regulated, tenant-scoped, or operationally dangerous.
Treating the search index as a convenience layer outside authorization turns retrieval into an authorization bypass: a caller denied access to a source system can still ask an agent to find and summarize it. Permission-aware retrieval must be designed as a security boundary, not attached after relevance ranking.
For resource-level authorization without implicit network trust, see https://csrc.nist.gov/pubs/sp/800/207/final.
The request carries a principal, tenant or scope, action, purpose, environment, resource attributes, and policy version. The policy decision is allow or deny; ambiguity denies by default. The decision happens before candidate content is released to a reranker, model, cache, log stream, or prompt. Post-filtering leaks through score counts, timing, snippets, and model-visible candidate text.
Attribute-based access control is a useful model because a decision can consider properties of the user, resource, action, and environment. The reference runtime uses a deliberately small contract: a reader has a scope and permitted classifications, and a record has a scope and classification. Production deployments can connect the same interface to a policy engine, a document repository, or row-level database controls, but adapters must preserve the pre-release decision boundary.
Authorization is not relevance. A highly relevant document remains unavailable if the principal lacks a grant. Conversely, authorization does not make a document relevant. The pipeline therefore first establishes that a record may be considered, then ranks only the permitted candidates. The result manifest reports exclusion counts and policy version without recording titles or text from denied records.
Permission propagation is essential for derived material. A summary, embedding, cache entry, chunk, and citation inherit the most restrictive applicable classification and scope from their parents. A model-generated answer cannot lower those controls. When sources with different permissions are combined, the output is governed by the strictest source unless an authorized declassification process explicitly produces a separate artifact.
Time matters. Permissions can expire during a long run, and a policy update can revoke a grant after retrieval but before a tool effect. The runtime evaluates authorization at each sensitive boundary, records the decision timestamp, and limits cache lifetime. A packet assembled under one identity is never reused for another identity merely because the query text matches.
The laboratory uses two tenant records of equal relevance, a public runbook, and a restricted incident note. It asserts that an agent from tenant A cannot see tenant B material at any stage, that a classification denial is counted but not described, and that a context packet contains only allowed parent records. These tests guard the architecture even when an optional search backend is introduced.
Continue with the book
Explore the full treatment, worked examples, and exercises in Building Production-Grade AI Agents.
Companion article for Building Production-Grade AI Agents, published by Choral Software. Article text and original examples © 2026 Choral Software. All rights reserved.
