Prompt injection when agents can act: what changes with tools
Prompt injection changes when AI agents can take actions through tools. What the risk looks like, why filtering alone falls short, and how to limit the damage.
In short
Prompt injection is text that tricks a model into following instructions it should ignore. In a chat it mostly produces a wrong answer. When an agent can act through tools, it can lead to real actions on real data. You can't fully prevent it, so limit what an agent can do and record everything it does.
What prompt injection is
Prompt injection is an attempt to make an AI model follow instructions that did not come from its user. The instructions are hidden in content the model reads: an email, a document, a web page, a code comment, the result of a tool call. See the short definition in our glossary.
Language models read instructions and data in the same way, as text. They have no reliable way to tell “this is what my user asked” from “this is text that happens to look like an instruction”. That is the root of the problem, and it is why there is no complete fix today.
From answers to actions
When a model can only answer, a successful injection mostly produces a bad answer. It might summarise a document wrongly, or include a misleading link. That is a problem, but a person still reads the answer and decides what to do with it. There is a human between the model and the consequence.
Agents are different. Through MCP connectors and APIs, an agent can search systems, read files, send messages, create tickets and change records. Now an injection can lead to an action. A few patterns to recognise:
- Data exfiltration. Hidden text asks the agent to collect sensitive data and send it somewhere, for example in a message or a link.
- Unwanted actions. An instruction in a ticket or email asks the agent to delete, approve or forward something.
- Chained access. An agent with access to several systems is asked to carry data from one system into another where it does not belong.
- Poisoned tool descriptions. A tool’s own description contains instructions that change how the agent behaves.
The common thread: the agent uses access it legitimately has, in a way nobody intended.
Why filtering alone falls short
It is tempting to look for a filter that catches every injection. Filters help, and they are worth having. But injected text can be phrased in endless ways, in any language, hidden in formatting or split across several sources. A filter that catches today’s examples will miss tomorrow’s.
There is a second limit. A filter that is too strict blocks ordinary work: documents that happen to contain the word “ignore”, emails that quote instructions, code that includes example prompts. Teams then look for a way around it, and you are back to AI use you can’t see.
So the more useful question is not only “how do we stop every injection?” but also “if one gets through, what is the worst that can happen?”
Limit the blast radius
The answer is the same discipline you apply to people and service accounts, applied to agents.
- Give agents only the access they need. An agent that only needs to read should not have write tools. An agent acting for a user should never have more access than that user.
- Give every agent its own identity. So you know which agent did what, and can restrict or switch off one agent without affecting the rest. See agent identity.
- Filter data before it leaves. Secrets and sensitive fields that never reach the model can’t be leaked by it. See Prevent data leakage to AI.
- Require confirmation for irreversible actions. Sending, deleting and paying are good candidates for a human check.
- Treat tool results as untrusted. Content returned by a tool is data, not instructions.
- Log every request, allowed and refused. If something does go wrong, you can see what happened and where.
Where a control layer helps
None of these measures needs to live inside the model. They work better outside it, in a layer the model can’t talk its way past. In ContextGuard®, the Control Layer sits between AI tools and agents and your data. It applies identity, permissions and data rules to every request, whatever the model was told, and keeps one log. It does not make injection impossible. It limits what an injected instruction can reach.
For a wider view of the risks and controls, see AI security & governance.