AI Agent Security: How to Secure AI Agent Systems

AI agent security is the work of protecting a system in which a model can interpret instructions, retrieve context, use credentials, call tools, retain memory, communicate with other agents, and produce consequential output. The security boundary therefore includes more than the model: it includes the agent host, identities, MCP or A2A connections, browser sessions, data stores, approval flows, telemetry, and recovery controls.

This page is about securing the AI-agent system itself. If your goal is to use an AI coding agent to fix a conventional dependency, CVE, container, SAST, secret, or repository-configuration finding, use How to Remediate Vulnerabilities with AI Agents. Those are related workstreams, but they answer different questions and require different evidence.

Last updated July 23, 2026. Stephen M Abbott maintains this guide with Security Recipes contributors in the public source and revision history. See the review methodology and corrections policy. The source framework below separates voluntary risk guidance, protocol requirements, community threat guidance, and deployment-specific decisions instead of presenting them as one compliance checklist.

Choose the right security intent

Intent System being secured Typical finding Expected output
AI vulnerability remediation Traditional software, dependencies, containers, source, and repository configuration A CVE, SCA alert, SAST result, exposed secret, or vulnerable artifact A bounded patch or triage note with tests, source evidence, rollback, and human review
AI agent security The agent, model boundary, tools, connectors, identities, memory, context, browser, and control plane Prompt or context injection, excessive authority, unsafe tool use, cross-agent trust, data egress, or missing recovery evidence A threat model, control change, policy, evaluation, evidence pack, or incident action with an accountable owner

Do not close an AI-agent security finding merely because the application code passed unit tests. The evidence must exercise the relevant trust boundary: for example, a denied tool call, a rejected token audience, a contained browser session, a poisoned-context fixture, a revoked delegation, or a replayed incident scenario.

Threat-model the whole agent system

Start with a concrete deployment and trace data and authority across it. A generic list of AI risks is not a substitute for knowing which component can act, what identity it uses, and what happens when untrusted content influences the run.

Boundary Questions to answer Minimum evidence
Instructions and retrieved context Which text is trusted policy, user input, repository content, web content, tool output, or memory? Can lower-trust text change tool behavior? Source labels, precedence rules, context filtering, and adversarial fixtures
Identity and delegation Which human, workload, agent, or connector identity is acting? What was delegated, for how long, and by whom? Identity inventory, scoped grant, expiry or revocation path, and approval receipt
Tools and connectors Which operation can read, write, execute, deploy, send, purchase, or expose data? Does authorization bind the token to the intended resource? Tool inventory, allowed operation set, token audience validation, and denied-action tests
Runtime and browser Where does code execute, what network and filesystem access exists, and can authenticated state cross workspaces or tenants? Isolation configuration, egress policy, session boundary, and escape or exfiltration tests
Memory and handoffs What persists across runs, and what claims are trusted when one agent delegates to another? Retention policy, provenance, handoff contract, and stale-state deletion or revocation test
Human control Which actions require approval, and can a request be confused with approval? Named approver, action-specific receipt, separation of duties, and fail-closed behavior
Telemetry and recovery Can responders reconstruct the input, identity, tool call, decision, output, and resulting state without logging secrets? Integrity-bound events, incident playbook, containment action, and recovery rehearsal

Establish a production baseline

Apply controls in an order that produces verifiable boundaries rather than a large policy document with no enforcement:

  1. Inventory the system. Record models, agent hosts, tools, connectors, identities, memory stores, data classes, providers, and owners.
  2. Reduce standing authority. Start read-only, bind credentials to the intended resource, separate human and workload identities, and add short-lived escalation only for a named action.
  3. Separate context from commands. Preserve provenance and trust labels; do not let retrieved text silently become executable policy.
  4. Contain execution and egress. Isolate filesystem, browser, network, and secret access according to the run’s actual needs.
  5. Evaluate the boundary. Replay hostile context, denied actions, expired grants, protocol errors, handoff failures, and recovery paths with versioned fixtures and explicit pass criteria.
  6. Prepare to revoke and recover. Name the owner, containment action, evidence source, rollback or restore path, communication route, and condition for returning the agent to service.

The correct control depends on the action and deployment. A read-only research agent does not need the same gate as an agent that can change production, operate an authenticated browser, or delegate work across organizations.

Start with the scenario you operate

Control directory for securing AI agent systems

Use this directory after the system and its owners are known. Each control page defines a narrower artifact or decision; it does not grant authority to deploy, rotate credentials, change production, or accept residual risk.

Agent identity, delegated authority, and trust

Governance, posture, and risk routing

Authorization, exposure, and runtime boundaries

Protocols, connectors, and system inventory

Evidence, evaluation, and incident readiness

Secure-context provenance and enterprise assurance

Evidence required before calling the system secure

A control description is not proof that a deployed agent obeys it. Preserve a reviewable evidence set that includes:

  • the deployed system inventory and versioned configuration;
  • the identity, delegation, allowed-tool, and data-access boundaries;
  • the source and trust classification of instructions, context, and memory;
  • negative tests that prove prohibited actions fail closed;
  • integrity-bound tool, approval, handoff, and egress events;
  • adversarial evaluations tied to the deployed model, policy, and connector versions;
  • incident containment, credential revocation, rollback, and restore evidence;
  • named owners for the system, each consequential action, and residual risk.

Separate observed evidence from operator assertions and analyst inference. If the test environment, identity provider, connector implementation, or model version differs from production, record that gap instead of treating the test as production proof.

Primary sources and interpretation boundaries

Use the source that is authoritative for the claim being made:

  • NIST AI Risk Management Framework is a voluntary risk-management framework. NIST notes that AI RMF 1.0 is being revised; preserve the version used in every assessment.
  • NIST AI RMF Generative AI Profile adapts the AI RMF to generative-AI risks. It is not a product configuration guide or automatic certification.
  • NIST AI Agent Standards Initiative tracks emerging work on agent standards, protocols, identity, security, and evaluation. Its initiatives, RFIs, concept papers, and drafts must be labeled by publication status rather than presented as final requirements.
  • OWASP Agentic Security Initiative provides community threat and control work for agentic systems. Validate its guidance against the deployed product and current source material.
  • MCP authorization and MCP security best practices govern MCP-specific boundaries such as authorization, token audience, and confused-deputy risks; they do not secure the rest of the agent application.
  • A2A Protocol Specification and enterprise guidance define protocol and implementation considerations for agent-to-agent communication. Pin the version evaluated because the protocol can evolve.
  • MITRE ATLAS is a knowledge base for adversary tactics and techniques involving AI-enabled systems. Use it to structure scenarios, not as evidence that a control is operating.
  • NIST SP 800-61 Rev. 3 supplies general incident-response guidance; the agent-specific containment and evidence plan still has to be designed and exercised for the deployment.

No single source above proves that an AI agent system is secure. Product documentation is authoritative for supported configuration, protocol specifications are authoritative only within their protocol boundary, and the deployment’s own tests and evidence must prove the controls that operators rely on.