Safety, Security & Responsible AI·Question 36 of 70AdvancedAI-75

Design a secure architecture for an agent that reads untrusted web/email content AND has access to a user's private data. How do you defeat prompt injection by construction?

Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.

Model answer: the part to lead with

The goal is prompt-injection resistance that doesn't depend on the model refusing to be fooled - because it will be. The tool for that is the lethal trifecta decomposition plus a dual-LLM / plan-then-execute architecture.

Full worked answer with diagram

The goal is prompt-injection resistance that doesn't depend on the model refusing to be fooled - because it will be. The tool for that is the lethal trifecta decomposition plus a dual-LLM / plan-then-execute architecture.

Core idea: separate the privileged control flow from the untrusted content, so injected instructions never reach the component that holds authority.

  • A privileged planner LLM sees only the trusted user request and a catalogue of tools. It produces a plan (ideally as code or a structured DAG) before any untrusted data is fetched, so the plan can't be steered by content the attacker controls.
  • A quarantined LLM handles untrusted content (the web page, the email body). It only extracts/summarises into typed, symbolic variables ($sender_email: Email, $summary: string). Crucially, its output is data, never instructions the planner executes - the planner references $summary as an opaque value.
  • An orchestrator / interpreter runs the plan, passing symbolic references between steps. This is the CaMeL (DeepMind, 2025) refinement: the interpreter enforces capability/data-flow policies - e.g., "data derived from untrusted content may not be used as the recipient of send_email" - so even if the quarantined LLM is fully compromised, it can't cause a disallowed flow.

Wrap that with the standard layers: least-privilege tools (read-only defaults, per-tenant creds), egress control (no arbitrary outbound; allowlist), human approval on any consequential action showing the concrete effect, output validation (schemas), and audit logging.

The trade-off is honest: this sacrifices flexibility - the plan is fixed before the data is seen, so the agent can't adapt to what the content says (which is sometimes the whole point), and it's real engineering effort. So you apply the strong isolation to the high-risk path (untrusted content + private data + actions) and allow looser, monitored designs where a successful injection can't hurt (no private data, or no exfil). The headline: injection defence is an architecture decision, not a prompt.

Worth sketching. The one arrow that never exists, untrusted prose reaching the planner, is easier to point at than to describe.

flowchart TD
    A["User request, trusted"] --> B["Privileged planner<br/>sees tools, never content"]
    B --> C["Plan fixed before anything is fetched"]
    C --> D["Orchestrator executes the plan"]
    F["Untrusted page or email"] --> E["Quarantined LLM, no tools"]
    D --> E
    E -->|"typed values only, never prose"| D
    D -->|"policy: tainted value cannot be a recipient"| G["Tool call"]

What a good answer covers

  • The goal is prompt-injection resistance that doesn't depend on the model refusing to be fooled - because…
  • The tool for that is the lethal trifecta decomposition plus a dual-LLM / plan-then-execute architecture
  • Core idea: separate the privileged control flow from the untrusted content, so injected instructions…
  • A privileged planner LLM sees only the trusted user request and a catalogue of tools
  • A quarantined LLM handles untrusted content (the web page, the email body)

Key terms: lethal trifecta · dual-LLM / plan-then-execute · Core idea · privileged planner · quarantined · typed, symbolic variables · orchestrator / interpreter · capability/data-flow policies · least-privilege tools · egress control

Interviewer follow-ups to expect

  1. What does the quarantined LLM return, and why can't its output steer the planner?

  2. What flow policy specifically stops exfiltration in CaMeL?

  3. What flexibility do you give up, and when is that cost unacceptable?

Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep