An enterprise AI agent rarely receives instructions from a single source. A typical deployment combines a system prompt written by the platform team, developer-defined configuration and permissions, output returned from connected tools and APIs, content pulled from retrieved documents, and direct input from an end user. Each of these sources can, intentionally or not, contain instructions that conflict with one another. Instruction hierarchy is the rule set that determines which source wins when that happens.
OpenAI has published explicit work describing an instruction hierarchy in which system prompts are trained to take precedence over user messages, which in turn take precedence over third-party or tool content. This represents a training-time approach: the model itself is fine-tuned to weight instructions differently depending on their declared source. Anthropic's documentation similarly describes system-level instructions as intended to take precedence over user turns, though without detailing a formally enforced runtime mechanism separate from model behavior. Across vendors, there is no single, cross-provider technical standard specifying how precedence should be encoded, transmitted, or verified.
Why Training-Time Precedence Is Not Enough
Training a model to prefer certain instruction sources over others reduces susceptibility to some attacks, but it does not eliminate the underlying risk. OpenAI's own reporting on its instruction hierarchy work notes that training-based enforcement reduced success rates for certain injection attacks in evaluation benchmarks without eliminating all bypass techniques. This matters because models remain probabilistic systems: a sufficiently crafted input, whether from a user or from injected content in a retrieved document, can still shift model behavior in ways the declared hierarchy was meant to prevent.
OWASP's Top 10 for Large Language Model Applications lists prompt injection as a top-ranked risk and distinguishes direct injection, where a user attempts to override instructions, from indirect injection, where malicious instructions are embedded in tool outputs or retrieved content the agent processes automatically. OWASP guidance is explicit that prompt injection cannot be fully prevented through model-level controls alone, and recommends application-layer mitigations such as privilege control, output filtering, and human approval for sensitive actions. NIST's Generative AI Profile reaches a similar conclusion, framing indirect prompt injection as a risk requiring monitoring, access control, and content provenance safeguards that sit outside the model itself.
Where Enforcement Needs to Live
Because instruction-following in a trained model is a statistical property rather than a guarantee, enterprises that need reliable precedence enforcement typically add architectural layers between the model and the systems it can affect.
Treating Tool Output and Retrieved Content as Untrusted
A recurring theme across OWASP, NIST, and Microsoft guidance is that content entering an agent's reasoning loop from tools, APIs, or retrieved documents should be treated as untrusted by default. OWASP notes directly that indirect prompt injection via tool outputs or retrieved documents can override intended system instructions if the application does not enforce trust boundaries between content sources. This is a structural application design problem, not something solved by improving the system prompt's wording.
Microsoft's guidance on securing AI applications recommends techniques such as spotlighting or delimiting untrusted content, restricting tool permissions, and applying content filtering classifiers at runtime, rather than relying solely on how the system prompt is phrased. NIST's Generative AI Profile adds that maintaining provenance and access-control metadata for ingested content supports the ability to differentiate trusted from untrusted instruction sources at runtime, which is a prerequisite for any enforcement layer that acts on that distinction.
Implementation Decisions for Security Teams
Translating instruction hierarchy from a concept into an enforced control involves several concrete decisions.
Governance Considerations
NIST's AI Risk Management Framework Generative AI Profile frames instruction manipulation and prompt injection as risks requiring documented organizational risk management processes, not solely technical fixes. OWASP's LLM Top 10 functions as a widely referenced baseline risk taxonomy for security teams, though it is not a formal regulatory standard, and no binding regulatory requirement specifically mandating instruction hierarchy enforcement was identified in current guidance.
In practice, this means enterprises deploying agents should document their trust boundaries and precedence assumptions as part of standard AI system risk assessments. This documentation should specify which sources are trusted, how that trust is established and revoked, and what runtime controls exist independent of the model to enforce the stated hierarchy. This is the kind of artifact security and compliance reviewers will reasonably expect before approving agent deployments with tool access or sensitive data exposure.