CaMeL is a prompt injection defense that doesn't try to make the model resist attacks. Instead it wraps the model in a system that tracks where every piece of data came from and blocks actions that untrusted data shouldn't be able to trigger.
It comes from the paper Defeating Prompt Injections by Design, first submitted on March 24, 2025, by researchers at Google, Google DeepMind and ETH Zurich. Simon Willison called it "the first credible prompt injection mitigation I've seen that doesn't just throw more AI at the problem" in his write-up.
The problem CaMeL fixes
CaMeL builds on the dual LLM pattern, where a privileged model plans and a quarantined model reads untrusted text. The paper argues that pattern protects the plan but not the data.
Its motivating example: a user asks an agent to send Bob the document he asked for in their last meeting. Bob's address and the document name live in the meeting notes. If an attacker can edit those notes, they can redirect the flow so the agent sends a confidential file to an address the attacker chose. The plan never changed. Only the arguments did. The authors compare this to SQL injection, where the attacker changes parameters rather than the query's structure.
How the CaMeL prompt injection defense works
There are four moving parts.
A privileged LLM (P-LLM) sees only the user's request. It writes a plan as code in a restricted, Python-like language. It never reads emails, web pages or tool results.
A quarantined LLM (Q-LLM) parses untrusted data, like pulling an address out of an email. It has no tool access and returns output in a fixed schema.
A custom interpreter runs the P-LLM's code step by step. Because ordinary code controls execution, it can enforce rules a model can't.
Capabilities are tags on every value. The paper describes each tag as recording where the value came from (the user, a specific tool, or a transformation) and who may read it. The interpreter tracks which values were derived from which, so anything computed from untrusted input stays marked as untrusted.
Before any tool runs, security policies check those tags. Policies are written as Python functions that return allowed or denied. A denied call stops, or asks the user to confirm.
In Willison's walkthrough, a policy lets the agent read email freely but only send to trusted recipients. An address extracted from an email is untrusted, so sending to it needs the user's approval. An injection can still trick the Q-LLM into returning the wrong address, but it can't make the agent quietly use it.
Results and cost
The paper evaluates CaMeL on AgentDojo, a benchmark of agent tasks with injection attacks. According to the abstract, CaMeL solves 77% of tasks with provable security, compared with 84% for an undefended system. So you lose some usefulness in exchange for guarantees.
It also costs more. For the median task, the paper reports CaMeL using roughly 2.8 times the input tokens and 2.7 times the output tokens of normal tool calling. The authors note the Q-LLM can be a smaller, cheaper model, and Willison points out a privacy bonus: the P-LLM's provider never sees your tool outputs.
Limitations
The authors and Willison are both upfront about what CaMeL doesn't solve:
- Someone has to write policies. Users or developers must define and maintain them, which is real work.
- Approval fatigue. Too many confirmation prompts and people start approving everything.
- Side channels. The paper discusses ways a small amount of private data could still leak, such as through exceptions, and says its strict mode reduces but doesn't close every channel.
- Tool support. Enforcement works best when tools carry capability information. Third-party tools that don't can reduce what the agent can do.
- Out of scope. Attacks that only change the text the user reads, and injection-driven phishing, aren't what CaMeL tries to stop.
The paper itself says prompt injection isn't fully solved.
What you can take from it today
You probably won't build CaMeL from scratch, but its ideas transfer:
- Keep the model that plans away from untrusted text.
- Treat any value pulled from untrusted content as tainted, and carry that label through your code.
- Check sensitive actions, like who an email goes to, with ordinary code rules rather than a prompt.
- Ask the user only when a tainted value is about to do something consequential, so prompts stay rare.
For the broader set of approaches CaMeL belongs to, read Design Patterns for Securing LLM Agents. For why this matters most when an agent can read private data and talk to the outside world, see the lethal trifecta.
Next step: plant a harmless canary payload in a document your agent reads and check whether any value from it reaches a tool call.