CaMeL (Capabilities for Machine Learning) stops indirect prompt injections by enforcing control-flow integrity and capability-based access control outside the language model, solving 77.3% of benign AgentDojo tasks on OpenAI o3 (high reasoning) compared with 84.5% for native tool calling while cutting unauthorized tool attacks to zero. Instead of training or prompting an LLM to ignore malicious instructions mixed into emails or web pages, Edoardo Debenedetti and colleagues at Google, Google DeepMind, and ETH Zurich treat prompt injection as a systems security boundary problem.
- Zero policy-violating tool attacks: Across 949 AgentDojo injection scenarios, CaMeL drops successful attacks from 11 to 0 on
o3(high), from 163 to 0 onGemini 2.5 Pro, and from 276 to 0 onGPT-4o Mini(which runs OpenAI’s instruction hierarchy by default). - Small utility tax on strong models: Benign task completion drops by 3.1 points on
o4 Mini(high) (79.4% to 76.3%) and 7.2 points ono3(high) (84.5% to 77.3%), though weaker or poorly documented API cases drop further. - 2.82x input and 2.73x output tokens: On
Claude 3.5 Sonnetunder attack, retries to fix generated Python code and dialect instructions raise median token usage nearly threefold versus native tool calling. - Cheap data parsing: Replacing
Claude 4 SonnetwithClaude 3.5 Haikufor the quarantined parser cuts median task cost by roughly 12% with only a 1% utility drop.
How CaMeL separates control flow from untrusted data
Standard defenses such as delimiter spotlighting, prompt sandwiching, or instruction-hierarchy fine-tuning ask the model itself to separate instructions from data inside one shared context window. CaMeL enforces that boundary architecturally by extending Simon Willison’s Dual-LLM pattern with an interpreter that tracks data provenance.
Willison’s Dual-LLM isolation alone is not enough, because prompt injections inside untrusted files can still poison data flow without changing control flow. For instance, if a user asks an agent to find Bob’s email and requested document in shared meeting notes and send it, a hidden injection in the notes can trick the Q-LLM into returning "confidential.txt" and "attacker@gmail.com". The P-LLM’s plan runs faithfully, yet private data leaks. CaMeL blocks that exfiltration because confidential.txt carries capability metadata restricting its readers, and attacker@gmail.com lacks read permission and did not originate from the trusted user.
Key findings on AgentDojo
Evaluated across AgentDojo’s Workspace, Banking, Slack, and Travel suites, CaMeL outperforms heuristic prompt and filtering defenses while surfacing clear engineering tradeoffs.
On newer models (Table 2 and Table 4), CaMeL closes most of that utility gap while preserving security. Claude 4 Sonnet scores 74.2% overall (down 12.4 points from 86.6% native), o3 (high) scores 77.3% (vs. 84.5%), and o4 Mini (high) scores 76.3% (vs. 79.4%). On the Travel suite alone, where poorly documented tool schemas previously crippled parsing, Claude Sonnet utility climbed from 25% (3.5) to 55% (3.7) to 75% (4.0) with zero changes to CaMeL itself, because newer models learned to route unknown JSON blobs through the Q-LLM.
Without security policies (CaMeL (no policies)), one Banking injection still succeeds because a document instructs the agent to initiate a transfer. Enabling policies drops Banking, Slack, and Workspace attacks to 0 across every model tested. The only remaining flagged Travel “attacks” (such as 11 instances on Claude 4 Sonnet) happen when the user explicitly asks to view hotel reviews and the model prints an injected recommendation string to the screen, a text-to-text output outside CaMeL’s tool-security threat model.
Caveats and builder takeaway
CaMeL’s deterministic guarantees stop at the edge of its threat model and capability engineering:
- “Data requires action” tasks fail by design: Queries like “follow the TODOs in this email” require untrusted text to dictate control flow, which CaMeL forbids.
- Side channels need
STRICTmode: Control-flow loops orQ-LLM-triggered exceptions can leak private bits indirectly;STRICTmode taints downstream statements inside branches and afterQ-LLMcalls, raising benign policy-confirmation prompts from 33.87% to 53.23% across solved tasks (Table 8). - Policy design and confirmation fatigue: Real deployments must annotate data sources and tune policies carefully, or frequent user approval prompts will desensitize users, echoing AI control and resampling-based agent defenses.
- Text-only manipulation stays unaddressed: CaMeL stops unauthorized tool calls and data exfiltration, not phishing links or misleading summaries printed directly to the user (though provenance tags can warn users in the UI).
For engineers building enterprise workspace agents with well-typed internal APIs, CaMeL offers a practical blueprint: keep untrusted content out of the planning model’s context, attach source/reader capabilities to every retrieved value, and enforce authorization in deterministic code rather than hoping the LLM resists adversarial text.


