Governed agentic RAG that survives an audit.

How an enterprise implements ISO/IEC 42001 and the MAS FEAT principles inside an agentic retrieval pipeline: where the policy engine sits, which checks are deterministic, what the audit log must contain, and how prompt injection is contained rather than merely detected.

1.0 version12 September 2026 prepared16 components mapped

The model reasons and deterministic code decides.

The architecture covers an agent that receives a request, retrieves from enterprise sources, plans, calls tools, and acts on production systems. It is written for the architect who has to build it and the board or auditor who has to be satisfied that it is governed. It is a reference, not a description of one deployment: each design rule is the one that published guidance requires or recommends, assembled into a single pipeline and traced to its source in the basis table below. The organising rule is the one from the Governed Cognitive Layer: the model reasons, deterministic code decides. Every band that can change what reaches a production system is deterministic; the model sits in one band and has no credentials.

Reference architectureA request moves down through ingress, policy, reasoning and egress. The two orange bands are deterministic code. The model lives only in C1 and cannot reach a system, a credential or unscoped data. Every band writes to the audit log on the right.
Governed agentic RAG reference architectureA request passes through four bands in order: ingress (identity, input screening, semantic router), policy and orchestration (deterministic policy engine, task envelope state machine, tool permission registry), reasoning and retrieval (planner, provenance-tagged retrieval, sandboxed tool execution with verification), and egress (deterministic output guardrails, human checkpoint by risk tier, a typed action executor that alone touches production systems). Four cross-cutting controls sit beside every band: an immutable audit log, evaluation and monitoring, a model and prompt registry, and a kill switch with incident response.Requester: a person, an upstream system, or another agent (treated identically)A · IngressA1 · Identity and sessionAuthN, AuthZ, tenant anddata-access scope boundto the requestA2 · Input screeningInjection classifier, PII andsecret detection, canarycheck, size and rate limitsA3 · Semantic routerMeasured threshold; routinerequests take thedeterministic pathB · Policy and orchestration · deterministicB1 · Policy engineDeterministic rules: allowedtools, data classes, risk tier,jurisdiction, spend limitsB2 · Task envelopeTRACE tier, approval state,budget, deadline; eachtransition checked, not inferredB3 · Tool permission registryLeast privilege per task,allowlisted actions,sandbox boundariesC · Reasoning and retrievalC1 · Planner (model)Plans against the envelope;no direct access tosystems or credentialsC2 · RetrievalVersioned index, documentACLs, provenance tags,trust tier per sourceC3 · Tools and verificationSandboxed, idempotent,dry-run for irreversible acts;checked against acceptance criteriaD · Egress · deterministicD1 · Output guardrailsDeterministic checks: policy,disclosure, action scope,data leakage, citations presentD2 · Human checkpoint by tierIrreversible or regulatedactions wait for a namedapprover; the rest are sampledD3 · Action executorThe only component thattouches Layer 7 systems;typed commands, no free textroutine path: no model in the loopE · Cross-cuttingE1 · Audit logAppend-only, hash-chained,WORM retention. Every bandwrites; nothing edits.E2 · MonitoringAlignment, drift, block rate,injection catch rate,escalation latencyE3 · Release registryVersions, approvals, evalresults; change is acontrolled releaseE4 · Kill switchHalt per task, per tool orglobal; incident recordand external reportingLayer 7 systems (ERP, CRM, core banking): reached only through D3, by typed command, after D1 and D2

Every state transition passes a deterministic check.

The task envelope (B2) carries the state. A transition happens only when the deterministic check for that state passes; the planner can propose a transition but cannot make one. This is what "deterministic state checks" means in practice: the model's output is an input to a check, never the check itself.

StateCheck that must pass to enter it
ReceivedPrincipal, tenant and scope resolved (A1). Input screened (A2).
ClassifiedRouter verdict recorded. Routine requests leave the model path here.
EnvelopedTRACE tier, budget, deadline and tool allowlist attached (B1, B2, B3).
PlannedPlan is inside the envelope: no tool outside the allowlist, no data outside scope.
ExecutedEvery tool call idempotent; irreversible calls ran as dry-run first (C3).
VerifiedOutput meets the acceptance criteria set before planning; guardrails passed (D1).
ApprovedRequired for irreversible or regulated tiers; approver named, trace attached (D2).
CommittedTyped command issued to Layer 7 by D3 only. Audit entry sealed (E1).
Escalated / HaltedAny failed check above. Task cannot re-enter the path without a human.

Which component satisfies which control.

An auditor working from ISO/IEC 42001 needs to see which component gives effect to which control, and a MAS-regulated institution needs to show which FEAT principle each design decision serves. The table is the artefact both will ask for. Clause numbers and control titles are cited; the text of the standard is licensed and is not reproduced here.

ComponentWhat it doesISO/IEC 42001:2023MAS FEAT (2018)
A1 Identity and sessionBinds every request to a principal, a tenant and a data-access scope before anything is retrieved or planned.A.9.4 intended use of the AI system; A.3.2 AI roles and responsibilities. Access control itself is an ISO/IEC 27001 control, referenced not duplicatedP7 internal authorisation for AIDA-driven decisions; P8 firm remains responsible for the model
A2 Input screeningClassifies the request for injection patterns, strips or flags PII and secrets, checks canaries, enforces size and rate limits.A.6.2.6 AI system operation and monitoring; 6.1.2 AI risk assessmentP4 models function as intended; P6 AIDA decisions held to the same ethical standard as human ones
A3 Semantic routerRoutes routine requests to the deterministic path so the model handles only what needs reasoning. Threshold measured on a labelled sample.A.6.2.2 AI system requirements and specification; A.6.2.4 AI system verification and validationP7 authorised use of AIDA to drive a decision; P4 functioning as intended
B1 Policy engineDeterministic rules on allowed tools, data classes, risk tier, jurisdiction and spend, evaluated before and after reasoning. Rules are versioned code, not prompts.A.2.2 AI policy; A.9.2 processes for responsible use of AI systemsP5 alignment with the firm’s ethical standards and codes of conduct; P7 internal authorisation
B2 Task envelope and state machineEach task carries a TRACE risk tier, an approval state, a budget and a deadline. Transitions are checked against the envelope, never inferred from model output.A.5.2 AI system impact assessment process; 8.4 AI system impact assessmentP7 internal authorisation by materiality; P9 board and management awareness of AIDA use
B3 Tool permission registryPer-task allowlist of actions with least privilege; sandbox boundaries; credentials never visible to the planner.A.4.4 tooling resources; A.10.2 allocating responsibilities with third partiesP7 internal authorisation; P8 responsibility for internally and externally sourced models
C1 PlannerProduces a plan and candidate actions inside the envelope. Has no direct access to systems, credentials or unscoped data. Working context is session-scoped and isolated from long-term memory, and memory writes are validated (OWASP Agentic T1).A.6.2.3 documentation of AI system design and development; A.6.2.7 AI system technical documentationP6 same ethical standard as human decisions; P8 firm responsible for the model’s decisions
C2 RetrievalVersioned index; document-level ACLs enforced at query time; every passage carries source, version and trust tier; retrieved text is data, never instruction.A.7.2 data for development and enhancement of AI system; A.7.5 data provenance; A.7.4 quality of data for AI systemsP2 justified use of personal attributes as inputs; P3 data accuracy and relevance; P13 data used is explainable on request
C3 Tool execution and verificationSandboxed, idempotent calls under a per-task allowlist; results checked against pre-agreed acceptance criteria before egress. Where the target system offers a simulation or dry-run mode, irreversible actions use it first; where it does not, the action waits at D2 regardless.A.6.2.4 AI system verification and validation; A.6.2.5 AI system deploymentP3 validation for accuracy; P4 models function as intended
D1 Output guardrailsDeterministic checks on the proposed output: policy compliance, disclosure of AI involvement, action scope, data leakage, citations present.A.6.2.6 AI system operation and monitoring; A.8.2 system documentation and information for usersP1 no unjustified systematic disadvantage; P6 same ethical standard; P12 disclosure of AIDA use
D2 Human checkpoint by tierIrreversible, financial or regulated actions wait for a named approver with the reasoning trace attached (mandatory, OWASP LLM06). Lower tiers are reviewed after the fact on a defined sample rate, and the approver queue length is monitored so oversight is not overwhelmed (OWASP Agentic T10).A.3.2 AI roles and responsibilities; A.9.2 processes for responsible use of AI systemsP7 internal authorisation; P10 data subjects can enquire, appeal and request review; P11 supplementary data considered on review
D3 Action executorThe only component with credentials for production systems. Accepts typed commands only; free text never reaches Layer 7.A.4.5 system and computing resources; A.6.2.5 AI system deploymentP8 firm responsible for the AIDA-driven action
E1 Immutable audit logAppend-only, hash-chained record of inputs, retrieved sources and versions, policy verdicts, tool calls, model version, approvals and outputs.A.6.2.8 AI system recording of event logs; 9.1 monitoring, measurement, analysis and evaluationP8 responsibility demonstrable; P11 review evidence; P13 and P14 explanations of data and consequences on request
E2 Evaluation and monitoringAlignment to policy ground truth, drift, block rate, injection catch rate, escalation latency; reviewed on a defined cadence.9.1 monitoring, measurement, analysis and evaluation; A.6.2.6 AI system operation and monitoring; 10.1 continual improvementP3 regular review for accuracy and unintentional bias; P4 functioning as intended; P9 management awareness
E3 Model and prompt registryModel, prompt and policy versions with approval and evaluation results; a change is a controlled release, not an edit.A.6.2.7 AI system technical documentation; 8.1 operational planning and control; 6.3 planning of changesP8 responsibility for sourced and internal models; P4 functioning as intended after change
E4 Kill switch and incident responseHalt per task, per tool or globally; incident record; external reporting where a regulator or data subject must be told.A.8.4 communication of incidents; A.8.3 external reporting; 10.2 nonconformity and corrective actionP9 board and management awareness; P10 channel for affected data subjects

MAS FEAT principles: P1 to P4 Fairness (P1 and P2 justifiability of AIDA-driven decisions, P3 and P4 accuracy and ongoing review); P5 and P6 Ethics; P7 to P9 internal Accountability (authorisation, responsibility for models, board awareness); P10 and P11 external Accountability (enquiry, appeal and review by data subjects); P12 to P14 Transparency (proactive disclosure, explanation of data used and of consequences). AIDA is MAS's term for artificial intelligence and data analytics.

What the audit log records.

A log that says "the agent approved the refund" is not evidence. The log has to let a reviewer reconstruct the decision: the request as received, the identity and scope, the router verdict, the envelope, every retrieved passage with its source and version, the model and prompt versions, every tool call with arguments and result, every policy verdict, the approver if any, and the final command. The record is integrity-protected (a hash chain or an equivalent tamper-evident mechanism, NIST SP 800-53 AU-9), storage is write-once, and retention follows the record-keeping rule of the regulated activity, not the convenience of the platform. Nothing in the pipeline has permission to edit or delete an entry, including the operator, which is what makes the record usable for non-repudiation (AU-10) and for the explanations MAS FEAT P13 and P14 require on request.

An injection that reaches the planner cannot act.

No classifier catches every injection, so the design assumes some will reach the planner and makes that harmless. The controls stack so that a successful injection can influence the plan but cannot widen permissions, reach a credential, touch a system outside the allowlist, or pass the output checks with leaked data.

LayerControls
Before the modelInput classifier tuned on known injection patterns; canary tokens in system context that must never appear in output; strict separation of instruction channel and data channel in the prompt template.
In retrievalEvery retrieved passage is tagged with a trust tier. Untrusted tiers are rendered as quoted data with an explicit "not instructions" wrapper, and content from them can never raise the task’s tool permissions.
Around toolsAllowlist per task (B3), least privilege, sandboxed execution, no credentials visible to the planner, human approval before any irreversible action. A successful injection that reaches the planner still cannot reach a system it was not already allowed to touch.
After the modelDeterministic output checks (D1): scope, leakage, disclosure, citation presence. Canary detection. Human gate for the highest tier (D2).
Over timeInjection attempts are logged (E1) and the catch rate is a monitored metric (E2). Red-team prompts are part of every model or prompt release (E3).

Residual risk after controls.

RiskLikelihoodImpactControlsResidual
Prompt injection via a retrieved document (OWASP LLM01)HighHighA2, C2 trust tiers, B3, D1Low: an injected instruction cannot widen permissions or bypass D1
Data leakage across tenants or ACLs (OWASP LLM02, LLM08)MediumHighA1, C2 query-time ACLs, D1 leakage checkLow
Irreversible action on a wrong plan (OWASP LLM06, Agentic T2)MediumHighB2 tiering, C3 sandbox and dry-run where available, D2 mandatory approval, D3 typed commandsLow
Silent quality drift after a model update (NIST AI RMF MEASURE)HighMediumE3 controlled release, E2 alignment and drift metricsMedium: depends on evaluation set coverage
Unreconstructable decision at audit (Agentic T8, NIST AU-10)MediumHighE1 integrity-protected log with versions of every inputLow
Cost or latency runaway (OWASP LLM10, Agentic T4)MediumMediumA3 routing, B2 budget and deadline, E4 haltLow
Approvers overwhelmed into rubber-stamping (Agentic T10)MediumHighB2 tiering keeps mandatory approvals rare; E2 escalation latency and queue length; sampling for lower tiersLow, if the tiering is revisited when latency rises
Agent-to-agent escalation (Agentic T3, T9, T13)LowHighZero-trust at A1 for every requester; envelopes do not inherit permissions; E2 watches cross-agent trafficMedium: multi-agent visibility is the least mature control

Six metrics to review every month.

MetricWhat it tells you
Policy block rateHow often D1 or B1 stop an output. Rising means the model or the prompt drifted, or the policy changed.
Injection catch rateDetected attempts at A2 and D1 against a seeded red-team set. Falling means the classifier needs retraining.
Provenance coverageShare of outputs whose every claim cites a retrieved passage with a source and version. Target is 100 per cent.
Escalation latencyTime from D2 request to human decision. Long tails mean the approver is a bottleneck or the tiering is wrong.
Alignment scoreStatistical closeness of outputs to a policy ground-truth set, tracked per model version.
Routine path shareShare of requests A3 keeps off the model. Falling share is a cost and latency warning.

Where each design rule comes from.

Nothing in the pipeline is novel, and that is the point. A reviewer should be able to trace every rule to a source they already trust. Where a source recommends rather than requires, the rule above says "where available" or "on a defined sample" rather than "always".

Design rulePublished basis
Every requester is authenticated and authorised on every request, whether a person, an upstream system or another agent.NIST SP 800-207, Zero Trust Architecture: no implicit trust by network location or requester type. OWASP Agentic AI Threats T9 Identity Spoofing and T3 Privilege Compromise. Source →
Retrieved content is data, never instruction; the model has no direct access to systems or credentials; tools run under least privilege from a per-task allowlist.OWASP Top 10 for LLM Applications 2025: LLM01 Prompt Injection, LLM06 Excessive Agency (minimise extensions, permissions and autonomy), LLM08 Vector and Embedding Weaknesses. OWASP Agentic T2 Tool Misuse. Source →
Irreversible, financial or regulated actions require explicit human approval before execution; lower-risk actions are reviewed after the fact on a defined sample.OWASP LLM06 mitigation: require human approval for high-impact actions. NIST AI RMF 1.0, MANAGE function, and the Generative AI Profile (NIST AI 600-1) on human oversight proportionate to risk. ISO/IEC 42001 A.9.2 and A.6.2.6. Source →
Short-term working context is isolated from long-term memory; memory writes are validated and session-scoped.OWASP Agentic AI Threats and Mitigations v1.0 (Feb 2025), T1 Memory Poisoning: session isolation, memory segmentation, content validation. Source →
Every action is logged to an append-only, integrity-protected record that the operator cannot alter, with enough detail to reconstruct the decision.NIST SP 800-53 Rev. 5 AU-9 Protection of Audit Information and AU-10 Non-repudiation. ISO/IEC 27001:2022 Annex A 8.15 Logging. ISO/IEC 42001 A.6.2.8. OWASP Agentic T8 Repudiation and Untraceability. Source →
Deterministic output checks and a kill switch sit between the model and any production effect; failures are blocked or escalated, never retried silently.OWASP LLM05 Improper Output Handling; NIST AI 600-1 on output validation and incident response; ISO/IEC 42001 A.8.4 and 10.2. Source →
Model, prompt and policy changes are controlled releases with evaluation results, and drift is monitored on a defined cadence.NIST AI RMF MEASURE and MANAGE; ISO/IEC 42001 6.3, 8.1, 9.1 and A.6.2.7. MAS Artificial Intelligence Model Risk Management information paper (Dec 2024) on model change and monitoring. Source →
Human oversight is protected from overload: escalation volume is a monitored metric and the tiering is adjusted when approvers become the bottleneck.OWASP Agentic T10 Overwhelming Human in the Loop. NIST AI 600-1 on human-AI configuration. Source →
Singapore deployments map the same controls to the local instruments.IMDA Model AI Governance Framework for Generative AI (May 2024); CSA Guidelines and Companion Guide on Securing AI Systems (Oct 2024); MAS FEAT Principles (2018). Source →

When to use this architecture.

It belongs wherever an agent can act on a regulated record, move money, change a customer's position or commit the organisation. It is too heavy for a read-only assistant that summarises documents for a single user, and the semantic router exists precisely so that traffic which does not need governance does not pay for it. The pipeline adds latency at B, D1 and D2; the placement rule from Layer 8 applies: decision support and consequential action, not real-time transaction paths.

Version 1.0, published 12 September 2026. ISO/IEC 42001 references checked against the Annex A control table of SS ISO/IEC 42001:2024; MAS FEAT cited by principle number. Licensed CC BY-NC 4.0. Deposited on Zenodo, DOI 10.5281/zenodo.22727449. Download the PDF. Machine-readable control set, task lifecycle, risk register and task-envelope JSON Schema: ai-governance-toolkit on GitHub (CC BY 4.0). Related: Governed Cognitive Layer (Layer 8), TRACE Framework, Four-Question AI Governance Baseline, Agentic pattern catalogue.

This is a personal site. The views, frameworks and publications here are my own analysis. They do not speak for Orion Five Engineering or any past employer or client, and they do not draw on the confidential information, data or proprietary methods of any of them.

Terence Kok
Before You Go

Most of the architecture diagrams I am shown for agentic systems have one box labelled guardrails and an arrow from the model to the database. This page is what has to be inside that box before I would put my name to it in front of an audit committee, and none of it is my invention. Every rule here is one that NIST, OWASP, ISO or MAS has already written down; what I have done is put them in one pipeline in the order a request moves. The discipline is refusing to let the model touch anything a deterministic check has not already approved, every single time, even when it is slower.

Terence Kok