The Instruction-Data Boundary in LLMs: What It Is, Why LLMs Lack One, and What It Means for Enterprise AI Agent Security
The instruction-data boundary is the separation between content a system executes as commands and content it only processes as input. Transformer-based LLMs read system prompts, user messages, and retrieved content as one token sequence, so they do not enforce that separation natively. Untrusted content can therefore influence model behavior. For agents, the practical response is to enforce trust boundaries outside the model, at permissions, tool calls, and runtime policy layers, rather than relying on prompts to hold the line.
What the instruction-data boundary is
The instruction-data boundary is the separation between two kinds of content in a system. Some content is executed as commands. Other content is only processed as input.
- Instructions
- Content the system executes as commands.
- Data
- Content the system only processes as input.
Where a system enforces this separation, untrusted input stays on the data side and cannot act as a command.
Why LLM architectures do not enforce one
Transformer-based LLMs read system prompts, user messages, and retrieved content as one token sequence. The model interprets everything as tokens, so it does not enforce the separation between instructions and data natively.
Key point: the model cannot guarantee which parts of its context it treats as commands. A prompt that asks the model to separate them is still part of the same token sequence.
How the gap enables direct and indirect prompt injection in agents
Because there is no native boundary, untrusted content can influence model behavior. In an agent, untrusted inputs enter the same context as trusted instructions. Typical sources include:
- Documents
- Web pages
- Tool outputs
Content that reaches the agent through these paths, whether supplied directly or retrieved from external sources, can affect what the agent does next, including which tools it calls.
Tradeoffs and where runtime governance fits
The practical response for agents is to enforce trust boundaries outside the model, at permissions, tool calls, and runtime policy layers, rather than relying on prompts to hold the line. Prompts remain part of the model's context, so they cannot serve as the enforcement point.
Compensating controls: enforce outside the model
Deterministic checks decide which tool calls are allowed to proceed. Least-privilege access and logs limit and explain what the agent did. The table shows where each layer sits around an LLM agent.
| Order | Layer | Role |
|---|---|---|
| 1 | Untrusted inputs | Email, documents, web pages, and tool outputs enter the same context as trusted instructions. |
| 2 | Model | Interprets everything as tokens and cannot guarantee which parts it treats as commands. |
| 3 | Runtime policy layer | Deterministic checks decide which tool calls are allowed to proceed. |
| 4 | Permissions and audit | Least-privilege access and logs limit and explain what the agent did. |
Questions to evaluate an agent deployment
Use these questions to check where trust boundaries are enforced in your own agents.
- Which untrusted sources (email, documents, web pages, tool outputs) can reach the agent's context, and is each one labeled and logged?
- Which agent actions are enforced by controls outside the model, and which depend on the model following its prompt?
- Are tool permissions limited to the minimum needed for each task?
- Can every tool call be traced back to the input that triggered it, including externally retrieved content?
- How are third-party integrations, including MCP servers, vetted and constrained at runtime?
- Which high-impact actions require approval before they execute?