Treat prompt, retrieval, tool output, agent handoff, and memory as separate ingress controls, then apply one shared runtime containment model after the context window. That approach prevents teams from overfitting to the user prompt and missing the surfaces that produce the most difficult indirect attacks. The goal is not just filtering text, but limiting what the agent can do once the text is accepted.
Why This Matters for Security Teams
Prompt injection becomes materially harder to manage once an AI system accepts input from more than one surface. A user prompt is only one path. Retrieval content, tool output, memory, and agent handoffs can all carry attacker-controlled instructions that arrive after an initial safety check. That is why current guidance from NIST AI Risk Management Framework and the OWASP Agentic AI Top 10 treats prompt surfaces as a governance problem, not just a filtering problem.
The practical risk is that teams harden the chat box while leaving retrieval pipelines, connector outputs, and agent memory effectively trusted. Once those surfaces are blended into the context window, the model may follow hostile instructions with the same confidence it applies to legitimate ones. That can lead to data disclosure, unsafe tool execution, or policy bypass even when the original user input looked harmless. In agentic systems, the attack often lands indirectly through a document, ticket, webpage, or upstream agent response rather than through an obvious malicious prompt.
In practice, many security teams encounter prompt injection only after an agent has already acted on contaminated context, rather than through intentional testing of every ingress surface.
How It Works in Practice
The safest operating model is to treat each ingress surface as its own trust boundary, then apply a common runtime containment layer after context assembly. That means prompt input, retrieved content, tool output, handoff messages, and long-term memory should each be validated, labeled, and constrained before they reach the model. A useful mental model is that the system should know where text came from, what authority it has, and what actions it may influence. This lines up with the control intent in MITRE ATLAS adversarial AI threat matrix, which emphasizes attack paths across the AI pipeline, not only at the input box.
- Tag every inbound message by source, sensitivity, and trust level.
- Separate untrusted retrieval snippets from system and developer instructions.
- Strip or neutralize instruction-like content in external documents where feasible.
- Restrict tool use with explicit policy, allowlists, and step-up approval for high-impact actions.
- Log which surface influenced each decision so investigators can reconstruct the chain of control.
Agent handoffs need special care because one agent’s output can become another agent’s instruction. Best practice is evolving, but current guidance suggests treating inter-agent messages as machine-readable data first and executable intent only where explicitly authorized. Memory should also be partitioned. Persistent memory is valuable for workflow continuity, yet it should not inherit full instruction authority simply because it is stored. Teams should also validate outputs before they are used to trigger tools, not after. The lessons in the Anthropic report on an AI-orchestrated cyber espionage campaign reinforce how quickly tool-enabled systems can be steered once hidden instructions reach an agent.
These controls tend to break down when connectors, plugins, and memory stores are treated as low-risk convenience layers because they are outside the main chat interface.
Common Variations and Edge Cases
Tighter containment often increases latency and workflow friction, requiring organisations to balance prompt robustness against user experience and automation speed. Not every agent needs the same controls, and there is no universal standard for how aggressively to sanitize all instruction-like text.
For low-impact assistants, a lighter pattern may be acceptable: surface-level filtering, strong output validation, and narrow tool scopes. For higher-risk systems that can send email, modify records, or query sensitive data, current guidance suggests stronger separation between trusted policy and untrusted content, plus human approval for sensitive actions. This is where the CSA MAESTRO agentic AI threat modeling framework is useful, because it helps teams map which workflows justify deeper containment.
Edge cases often appear when retrieval content is partly trusted. For example, an internal knowledge base can still contain injected instructions if an attacker has edited a source document or if a synced external source is compromised. Similarly, structured tool output may look safe while carrying adversarial tokens in a field that the model interprets as instruction-bearing text. The practical answer is not to assume “internal” equals “safe,” but to classify which surfaces can influence behavior and then test them separately. That approach aligns with the control discipline in NIST AI Risk Management Framework and the newer agentic guidance in OWASP Top 10 for Agentic Applications 2026.
In mixed environments, the hardest failures usually come from legacy middleware that was never designed to preserve source attribution across multiple hops.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP Agentic AI Top 10, MITRE ATLAS and CSA MAESTRO address the attack and risk surface, while NIST AI RMF and NIST AI 600-1 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP Agentic AI Top 10 | LLM01 | Prompt injection across agent surfaces is a core agentic AI attack pattern. |
| NIST AI RMF | GOVERN | Governance is needed to define trust boundaries and escalation rules across surfaces. |
| MITRE ATLAS | AML.TA0002 | Adversarial inputs can manipulate the model through indirect attack paths. |
| CSA MAESTRO | Agentic systems need threat modeling across tools, memory, and handoffs. | |
| NIST AI 600-1 | GenAI profiles emphasize input handling, output controls, and misuse resistance. |
Classify every ingress path and block instruction hijacking before context reaches the agent.
Related resources from NHI Mgmt Group
Deepen Your Knowledge
Reviewed and updated by the NHIMG editorial team on August 18, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org