CaMeL

Also known as: CApabilities for MachinE Learning · CaMeL defense

On this page 7

CaMeL, short for CApabilities for MachinE Learning, is a system-level defense against prompt injection in tool-using large language model agents. In AI security, it is notable because it does not try to make the model resist malicious text; instead, it separates control flow from data flow so that untrusted content can never decide which actions the agent takes, and it checks every tool call against explicit security policies.

CaMeL was proposed in 2025 by researchers from Google DeepMind and ETH Zurich in work titled after the goal of defeating prompt injections by design. It extends the earlier Dual LLM pattern with a custom interpreter and capability metadata, ideas borrowed from classic software security such as information flow control and capability systems. The approach is also called the CaMeL defense.

How CaMeL separates control and data

CaMeL splits an agent into components with strictly different privileges. Only the trusted user request shapes the plan, while untrusted inputs such as emails, web pages or documents are processed in isolation and returned as plain data values.

ComponentSees untrusted dataRole
Privileged LLMNoTranslates the user request into a program
Quarantined LLMYesExtracts structured values, cannot call tools
CaMeL interpreterYes, as tagged valuesExecutes the program and tracks data flow
Security policiesMetadata onlyAllow, block or request approval for tool calls
ToolsReceive checked argumentsSend email, read files, query APIs
Components of the CaMeL architecture

The privileged LLM writes a short program in a restricted Python subset before any external data is read. When the program needs information from an untrusted source, it calls the quarantined LLM, which parses the content into a value with a fixed schema. Because the program already exists, injected instructions in that content cannot add, remove or reorder steps.

Capabilities and security policies

Separating control flow alone is not enough, because an attacker can still manipulate data that flows into tool arguments, for example by replacing a recipient address. CaMeL addresses this with capabilities: metadata attached to every value that records where it came from and who may read it.

The interpreter propagates capabilities through every operation. A string derived from an untrusted email inherits that email’s provenance, and a value combining several sources carries all of them. Before a tool executes, the relevant policy inspects the capabilities of its arguments.

Tool actionPolicy conditionOutcome when violated
Send emailRecipient must come from the user or a trusted contact listBlock or ask the user
Share documentDocument readers must include the new recipientBlock the share
Transfer moneyAmount and payee must not depend on untrusted textRequire explicit approval
Post a messageContent from private files may not reach public channelsBlock the post
Examples of capability-based policies

This design gives deterministic guarantees for covered flows. The defense does not depend on a classifier detecting malicious wording, so novel phrasing or encoding tricks do not bypass a policy that forbids the data flow itself.

CaMeL compared with other prompt injection defenses

Most prompt injection defenses are probabilistic: they make attacks less likely but cannot rule them out. CaMeL belongs to the smaller group of architectural defenses that constrain what an injected instruction can achieve.

DefenseMechanismGuarantee level
SpotlightingMarks untrusted text with delimiters or encodingHeuristic, model-dependent
Instruction hierarchy trainingTeaches the model to prioritize system instructionsProbabilistic
LLM firewall or safety classifierFilters inputs and outputs for attack patternsProbabilistic, bypassable
Dual LLM patternQuarantines untrusted text in a separate modelProtects control flow only
CaMeLDual models plus interpreter, capabilities and policiesEnforced for control and covered data flows
CaMeL and neighboring defense approaches

CaMeL is a structured answer to the lethal trifecta, the combination of private data access, exposure to untrusted content and an external communication channel. Instead of removing one leg of the trifecta, it lets policies decide which flows between them are permitted.

Evaluation results and practical deployment

The authors evaluated CaMeL on AgentDojo, a benchmark of realistic agent tasks with embedded injection attacks across workspace, banking, travel and messaging environments. CaMeL completed a clear majority of benign tasks while preventing the attacks covered by its policies, at the cost of a moderate drop in utility compared with an undefended agent.

The utility loss has identifiable causes. Some tasks require the agent to act on instructions found inside data, which CaMeL forbids by design, and some programs fail because the privileged model writes code that the restricted interpreter rejects. Token usage also rises, often several times higher than a single-model agent, because planning and parsing are separate calls.

FactorEffectMitigation
Policy authoringRequires security expertise per toolStart with high-risk tools such as email and payments
User approval promptsFrequent prompts cause approval fatigueUse trusted contact lists and narrow policies
Latency and costMore model calls per taskUse a smaller model for quarantined parsing
Interpreter restrictionsSome generated programs failProvide retry with error feedback to the planner
Deployment considerations

Limitations and residual risks

CaMeL is a research design, not a turnkey product, and its guarantees hold only for what its policies cover. The authors themselves describe several remaining risks that practitioners must address.

  • Text-only manipulation: injected content can still bias a summary the user reads, without any tool call.
  • Side channels: timing, exceptions or loop counts can leak information about private values.
  • Incomplete policies: a permissive rule silently allows the flow it was meant to stop.
  • Compromised user intent: if the user request itself is malicious, the plan is malicious too.
  • Data-driven workflows: tasks that genuinely need instructions from documents conflict with the model.

The idea in brief

An AI assistant that reads email can be tricked. A message may hide a command such as forward all invoices to this address. CaMeL stops this in a simple way. The plan is written before the assistant reads anything risky.

Think of a bank clerk with a checklist from the manager. Customers can hand over forms, but the forms cannot change the checklist. Each piece of information also carries a label saying where it came from. Rules check those labels before money moves or a message goes out.

A practical scenario

An operations manager asks an email agent to find the latest meeting notes from a colleague and send them to the attendees of tomorrow’s planning meeting. The privileged model writes a four-step program: search email, extract the notes, look up the calendar attendees, and send the message.

One retrieved email contains hidden text instructing the assistant to also send the notes to an external address. The quarantined model extracts only the notes field, so the extra instruction never becomes a step. A second attack hides an outside address in the attendee list of a forged invitation. The email policy sees that this recipient comes from untrusted content rather than the user’s directory, blocks the send and asks the manager to confirm. The manager removes the unknown address, and the notes reach only the legitimate attendees.