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 on Gemini 2.5 Pro, and from 276 to 0 on GPT-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 on o3 (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 Sonnet under 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 Sonnet with Claude 3.5 Haiku for 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.

How CaMeL isolates planning, parsing, and tool authorization
1. Privileged LLM (P-LLM)
Sees only the trusted user query and tool signatures.

Emits restricted Python code defining the full control flow and explicit Pydantic schemas for any unstructured parsing. Never reads tool return values.

2. Quarantined LLM (Q-LLM)
Has zero tool access; parses untrusted text.

Extracts structured fields from emails, notes, or web pages. Returns only typed schema fields plus a have_enough_information flag (never free-form text back to P-LLM).

3. Interpreter + Policies
Tracks provenance and checks Python security rules.

Tags every value with sources and allowed readers along a runtime data-flow graph. Before any side-effecting tool runs, a Python policy returns Allowed or Denied (triggering user confirmation).

Source: Architecture from Debenedetti et al. (2025), Section 5.

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.

Prompt-injection defenses on AgentDojo (Claude 3.5 Sonnet)

Benign task utility (higher is better) vs. successful attacks out of 949 total (lower is better).

Undefended model90.7% utility · 44 attacks
Spotlighting92.8% utility · 5 attacks
Prompt Sandwiching89.7% utility · 24 attacks
Tool Filter73.2% utility · 8 attacks
CaMeL (with policies)63.9% utility · 0 attacks

Source: Debenedetti et al. (2025), Tables 5 and 7.

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 STRICT mode: Control-flow loops or Q-LLM-triggered exceptions can leak private bits indirectly; STRICT mode taints downstream statements inside branches and after Q-LLM calls, 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.