Join our Newsletter — 33% off our NHI Course
Home› Guides› AI Security Architecture Reference Guide: Controls Layer by…
Guide LLM & GenAI Security

AI Security Architecture Reference Guide: Controls Layer by Layer

PDF for newsletter subscribers · free to read online

← All guides
By Lalit Choda, NHI Mgmt Group Updated 24 October 2026 15 min read
On this page

Most AI security failures are architecture failures: an exposed training cluster, a model with more tool permissions than any human, an API key in a notebook, or a retrieval index that ignores the source system's access rules. Point controls such as a prompt filter cannot compensate for a design that trusts model output or gives an agent standing credentials. This guide sets out a layered reference architecture for AI systems, from data and the model supply chain through infrastructure, model serving, the application and agent layers, to identity and monitoring, and lists the controls that belong at each layer with their mapping to the OWASP Top 10 for LLM Applications 2025 and MITRE ATLAS. It is for security architects, platform engineers and reviewers who design or approve AI platforms, and it links to the deeper NHI Mgmt Group guides on each layer rather than repeating them.

Key takeaways

  • Treat the model as an untrusted component. Inputs can be attacker-controlled (prompt injection, OWASP LLM01) and outputs must be validated before they reach browsers, shells, databases or tools (LLM05).
  • Enforce authorisation outside the model. Tools, retrieval and data access are decided by deterministic policy using the end user's and the agent's identity, never by the system prompt.
  • Every AI component is a non-human identity. Model services, agents, pipelines and vector stores need owned, short-lived, least-privilege credentials, and stolen keys are a leading AI attack path.
  • Use one layer model across frameworks. Google SAIF's four component areas (data, infrastructure, model, application) and the NCSC-led lifecycle guidelines fit together; pick one model and map every control to it.
  • Log the whole chain. Prompts, retrieved context, tool calls, model versions and outputs must be logged and correlated to an identity, or you cannot detect or investigate AI incidents.

The reference layers

Google's Secure AI Framework (SAIF) groups AI system components into four areas: data (sources, filtering and processing, training data), infrastructure (model frameworks and code; training, tuning and evaluation; data and model storage; model serving), model (the model, input handling, output handling) and application (the application and agents). This guide uses those areas and adds the two layers that cut across them in practice: identity and access, and monitoring and response. Governance sits above all of them.

LayerComponentsMain threatsOWASP LLM 2025MITRE ATLAS examples
DataData sources, pipelines, labelling, training and fine-tuning sets, RAG corporaPoisoning, sensitive data in training, unlicensed dataLLM04 Data and Model Poisoning, LLM02 Sensitive Information DisclosureAML.T0020 Poison Training Data, AML.T0070 RAG Poisoning
Model supply chainBase models, adapters, model hubs, ML libraries, containersMalicious or tampered models, unsafe serialisation, vulnerable packagesLLM03 Supply ChainAML.T0010.003 AI Supply Chain Compromise: Model, AML.T0011.000 Unsafe AI Artifacts
InfrastructureTraining clusters, notebooks, GPU nodes, model and data storage, orchestrationExposed dashboards and APIs, weight theft, lateral movementLLM03, LLM10 Unbounded ConsumptionAML.T0024.002 Extract AI Model, AML.T0055 Unsecured Credentials
Model servingInference endpoints, AI gateway, rate limits, system promptsExtraction, cost abuse, denial of service, system prompt leakageLLM07 System Prompt Leakage, LLM10AML.T0034 Cost Harvesting, AML.T0029 Denial of AI Service, AML.T0056 Extract LLM System Prompt
Application (input and output)Chat UI, APIs, RAG retrieval, output rendering, guardrailsDirect and indirect prompt injection, jailbreaks, unsafe output handling, misinformationLLM01 Prompt Injection, LLM05 Improper Output Handling, LLM08 Vector and Embedding Weaknesses, LLM09 MisinformationAML.T0051.001 LLM Prompt Injection: Indirect, AML.T0054 LLM Jailbreak
Agent and toolsAgent runtime, tool and MCP servers, memory, code execution sandboxesExcessive agency, tool misuse, memory poisoning, exfiltration through toolsLLM06 Excessive AgencyAML.T0053 AI Agent Tool Invocation, AML.T0086 Exfiltration via AI Agent Tool Invocation, AML.T0080.000 AI Agent Context Poisoning: Memory
Identity and accessModel service identities, agent identities, API keys, OAuth tokens, user delegationStolen keys, over-privileged service accounts, credentials in agent configurationLLM06, LLM02AML.T0083 Credentials from AI Agent Configuration, AML.T0055 Unsecured Credentials
Monitoring and responsePrompt and tool logs, SIEM, model behaviour monitoring, kill switchesUndetected abuse, no forensic trail, slow containmentAllAML.T0031 Erode AI Model Integrity (detected only through monitoring)

For threat modelling against these layers, see the AI Agent Threat Modelling Guide and the MITRE ATLAS Guide.

Data and model supply chain layer

  • Data provenance: record source, licence, collection date and transformations for every training, fine-tuning and retrieval data set; accept data only from trusted, verified sources, as the OWASP LLM08 mitigations recommend for knowledge bases.
  • Sensitive data minimisation: scan and redact secrets and personal data before training or indexing; data in model weights cannot be selectively deleted later.
  • Integrity verification: verify cryptographic hashes and signatures on models, adapters and data sets before use, and inspect imported pre-trained models in a separate zone with AI-specific scanners, as the joint NSA AISC, CISA, FBI and Five Eyes guidance "Deploying AI Systems Securely" recommends.
  • Safe formats: prefer non-executable weight formats (such as safetensors) over pickle-based formats that can run code on load.
  • AI-BOM: keep an inventory of models, data sets, libraries and their versions so a compromised component can be traced to every deployment. See the AI Supply Chain and AI-BOM Guide and the AI Data Poisoning and Backdoors Guide.

Infrastructure and model serving layer

  • Segmentation: place training clusters, notebooks and inference services in dedicated network segments with boundary protection and allow-listed egress. Never expose cluster dashboards or job APIs to the internet; the ShadowRay 2024 campaign showed attackers exploiting exposed Ray AI clusters to steal cloud credentials.
  • Hardened runtimes: run models in hardened containers or VMs, patch GPU drivers and ML frameworks promptly, and scan images. See the Container Security Guide.
  • Protect model weights: encrypt at rest with keys held in an HSM or KMS, store weights in a restricted enclave or vault, and require two-person control for access to high-value weights, per the joint deployment guidance. Weights are both intellectual property and an attack accelerator.
  • AI gateway in front of every model: a single control point for authentication, per-identity quotas, token and cost limits, routing to approved models, content policy and logging. See the AI Gateway and LLM Gateway Guide.
  • Limit what the API returns: return only what the application needs (no raw logits or full probability vectors unless required), which makes extraction and inversion harder.
  • Treat system prompts as public: OWASP LLM07 is clear that system prompts should not hold secrets or be relied on for access control.

Model-level hardening, evaluation and weight protection are covered in depth in the AI Model Security Guide.

Application layer: inputs, retrieval and outputs

  • Separate instructions from data: mark and isolate untrusted content (web pages, emails, documents, tool results) and assume any of it can carry indirect prompt injection. No filter is complete, so design so that a successful injection has limited effect. See the Prompt Injection Guide.
  • Permission-aware retrieval: enforce the source system's access rights at query time, partition vector stores by tenant and sensitivity, and filter results by the requesting user's identity before they enter the context window. See the RAG Security Guide.
  • Output handling: encode output for its destination (HTML, Markdown, SQL, shell), block rendering of external images and links that could exfiltrate data, and never pass output to an interpreter without validation, as LLM05 requires.
  • Guardrails as a layer, not the boundary: input and output classifiers catch known jailbreaks, sensitive data and policy violations, but they are probabilistic. See the AI Guardrails and AI Firewalls Guide.
  • Grounding and human review: for misinformation risk (LLM09), require citations to retrieved sources and human review for consequential outputs. The general application controls are in the LLM Security Guide.

Agent and tool layer

Agents add the ability to act, which turns a content risk into an integrity and availability risk. OWASP LLM06 Excessive Agency names the core controls: minimise the extensions an agent can call, minimise each extension's functionality (read-only mailbox access for a summariser), avoid open-ended tools such as unrestricted shell or URL fetch, and require human approval for high-impact actions.

The OWASP GenAI Security Project published its Top 10 for Agentic Applications in December 2025; see the OWASP Top 10 for Agentic Applications Guide for the agent-specific risk list.

Where identity fits

An AI platform contains more non-human identities than human ones: the inference service calling a model provider, the pipeline writing to storage, the retrieval service reading a document store, each agent, and each tool server. Each needs an owner, a purpose, scoped permissions and a lifecycle.

IdentityTypical credentialPreferred patternCommon failure
Application calling a model APIProvider API keyKey held only by the AI gateway in a secrets manager, per-application keys with quotas, rotationKeys in code, notebooks or front-end bundles, leading to LLMjacking
Training and inference workloadsCloud service account or roleWorkload identity federation with short-lived tokens, separate roles for training and servingOne broad role shared across notebooks, training and serving
AgentOAuth client credentials or delegated user tokensDistinct agent identity, delegated scopes bound to the user, short token lifetimes, sender-constrained tokens where supportedAgent runs with a human admin's token or a static all-powerful key
Tool and MCP serversDownstream API tokensPer-tool least-privilege credentials, never exposed to the model contextCredentials stored in agent configuration files readable by the agent
Vector store and data connectorsDatabase or SaaS connector credentialsRead-only, scoped to indexed sources, with user-level filtering at query timeConnector with admin rights indexing everything it can see

The LLMjacking campaigns of 2024 to 2026 show the result when cloud credentials and model API keys leak: attackers run models at the victim's expense. Detailed patterns are in the Agentic AI Identity Guide, the AI Infrastructure Workload Identity Guide, the LLMjacking Guide and the Secrets Management Guide.

Monitoring, detection and measurement

  • What to log: per request, the calling identity (user and agent), model and version, system prompt version, prompt and retrieved document identifiers, tool calls with parameters and results, guardrail decisions, output, token counts and cost. Store logs in immutable storage, as the joint deployment guidance recommends, and redact sensitive fields.
  • What to alert on: spikes in token use or cost per key, high-frequency repetitive queries (extraction), guardrail block clusters from one identity, tool calls outside the agent's normal pattern, new egress destinations from model hosts, and unauthorised changes to model files or configuration.
  • Integrate with the SOC: SAIF's "detection and response" element is about bringing AI systems into existing threat monitoring and incident response, not building a parallel process. See the AI Agent Observability and Incident Response Guide.

Metrics that show the architecture is working:

  1. Percentage of model traffic passing through the AI gateway (target 100% for production).
  2. Percentage of AI non-human identities with a named owner and credentials under 24 hours lifetime or rotated within policy.
  3. Number of models and data sets in production without verified hash or signature and AI-BOM entry (target zero).
  4. Percentage of agent tools with a documented least-privilege scope and policy enforcement.
  5. Mean time to revoke an agent's or model service's credentials in an exercise.
  6. Red-team findings per release by layer, and time to remediate. See the AI Red Teaming Guide.

How to implement the reference architecture

  1. Inventory first: list every model, endpoint, agent, data set, vector store and AI credential, including shadow use. See the Shadow AI Discovery Guide.
  2. Tier the use cases: apply the full control set to high-risk and agentic systems first. See the AI Use Case Risk Tiering Guide.
  3. Put the gateway and identity controls in place: route all model traffic through a gateway, move keys into a secrets manager, replace static keys with federated short-lived credentials. Start in log-only mode to learn traffic, then enforce.
  4. Close infrastructure exposure: remove public access to clusters, notebooks and storage; segment and restrict egress.
  5. Add application and agent controls: permission-aware retrieval, output encoding, tool policy enforcement and approvals, piloted with one agent in a limited user ring.
  6. Test: threat model each system, red-team against injection, extraction and tool misuse before each release, and re-test after model changes, in line with NIST AI 600-1 action MS-2.7-007.
  7. Plan rollback: keep the previous model version, prompt version and tool policy deployable; maintain immutable backups so you can restore the last known good state; rehearse the kill switch.

Decision guidance

  • Hosted API versus self-hosted model: hosted APIs shift infrastructure and weight protection to the provider but put more weight on key management, data residency and contract terms (see the AI Procurement Checklist). Self-hosting gives control of data and weights but makes you responsible for the whole infrastructure layer.
  • Central gateway versus per-team integration: a central gateway gives consistent policy and logging; per-team integrations are faster but usually leave keys scattered and logs missing. Most organisations above a handful of AI applications benefit from the gateway.
  • Agent autonomy: start read-only with human approval for writes, and widen only with evidence from monitoring. See the AI Agent Autonomy Levels Framework.
  • Small organisations: focus on hosted models through one gateway or account, secrets management, permission-aware retrieval and logging. Large organisations need a platform team owning shared controls, an AI-BOM, model risk management (see the AI Model Risk Management Guide (SR 11-7)) and red-team capacity.

Framework mapping

SourceHow it structures AI securityWhere it fits this architecture
NCSC, CISA and partners: Guidelines for secure AI system developmentFour lifecycle areas: secure design, secure development, secure deployment, secure operation and maintenanceLifecycle view across all layers: threat modelling, supply chain, documentation, infrastructure protection, incident management, logging and update management
ETSI EN 304 223 V2.1.113 principles across secure design, development, deployment, maintenance and end of lifeBaseline requirements, including asset tracking, documenting data, models and prompts, and proper disposal
Google SAIFSix core elements and four component areasThe layer model used in this guide
NIST AI 600-112 generative AI risks, including information security and value chain and component integration, with suggested actionsRisk register and test planning (MS-2.7-001 threat assessment, MS-2.7-007 red-teaming, GV-6.1-005 supplier risk). See the NIST AI 600-1 Generative AI Profile Guide
NIST AI 100-2 E2025Taxonomy of adversarial machine learning attacks and mitigationsCommon vocabulary for model-layer threats
NIST CSF 2.0ID.AM-08 lifecycle management, PR.AA-05 least privilege, PR.DS-01 data at rest, DE.CM-09 runtime monitoring, GV.SC-07 supplier riskEnterprise control objectives for each layer
NIST SP 800-53 Rev. 5AC-6 Least Privilege, IA-5 Authenticator Management, SC-28 Protection of Information at Rest, SR-3 Supply Chain Controls and Processes, SI-4 System Monitoring, AU-2 Event Logging, SA-11 Developer Testing and EvaluationControl catalogue for assessments
MITRE ATT&CK v20T1078.004 Valid Accounts: Cloud Accounts, T1552.001 Unsecured Credentials: Credentials In Files, T1190 Exploit Public-Facing ApplicationConventional attack paths into AI infrastructure

Common failure patterns

  • Exposed ML infrastructure: dashboards, notebooks and job APIs reachable from the internet without authentication, as in ShadowRay.
  • Authorisation in the prompt: "only answer questions about the user's own account" in a system prompt is not access control; injection bypasses it.
  • Retrieval that ignores permissions: a connector with broad rights indexes HR and finance documents and any user can retrieve them through the assistant.
  • Static, shared model keys: one provider key copied across teams and repositories, with no quota or owner, so a leak is both costly and hard to trace.
  • Agent with human admin rights: an agent running under its creator's privileged token, with no separate identity, so its actions cannot be scoped, attributed or revoked independently.
  • No prompt or tool logging: logs stop at the HTTP request, so investigators cannot see what was injected or which tools ran.

Practitioner checklist

  • Inventory models, endpoints, agents, data sets, vector stores and AI credentials, and record owners.
  • Map every AI system to the layers in this guide and record the controls in place at each.
  • Route all production model traffic through an AI gateway with authentication, quotas and logging.
  • Store model API keys in a secrets manager and replace static cloud keys with short-lived federated credentials.
  • Verify hashes and signatures on models and data sets, prefer safe weight formats, and maintain an AI-BOM.
  • Remove public exposure of training and inference infrastructure and restrict egress.
  • Enforce retrieval permissions and tool authorisation outside the model, with approvals for high-impact actions.
  • Encode and validate model output for its destination before rendering or execution.
  • Log prompts, context, tool calls and outputs against identities in immutable storage and feed the SOC.
  • Red-team each release and rehearse credential revocation and model rollback.

Standards and references

Related NHI Mgmt Group resources: AI Security Posture Management (AI-SPM) Guide · Agentic AI Security Guide · OWASP Top 10 for LLM Applications Guide · AI Security Maturity Model

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Written and reviewed by Lalit Choda, NHI Mgmt Group. Last updated 24 October 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick the PDF box to continue.