Skip to content
RED SAGSkills
hardAI Engineer (LLM & Generative AI) interview question

How would you protect an LLM application that reads emails and can take actions, against prompt injection and data leaks?

What the interviewer wants to hear

  • Treat all external content as untrusted data
  • Least privilege tools and scoped credentials
  • Human confirmation or policy checks for sensitive actions
  • Input and output filtering, PII and secret detection
  • Logging, monitoring, red teaming

Model answer

I assume prompt injection will happen, because any email can contain instructions written for the model. So the design must stay safe even if the model is fooled. First, untrusted content is clearly separated from instructions and treated as data. Second, least privilege: the agent only gets tools it needs, with scoped credentials, for example read-only access by default and sending only to allowlisted domains. Third, sensitive actions such as sending email, deleting data or making payments go through code-level policy checks and user confirmation that shows exactly what will happen. Fourth, I block common exfiltration routes, like rendering external image links containing data, and scan outputs for secrets and personal data. Finally I log every tool call, monitor for unusual patterns, and run regular red-team tests with known injection attacks in my eval suite.

Can you answer it under time pressure?

Take a timed hard round and get scored on every answer.

Start mock interview

More hard AI Engineer (LLM & Generative AI) questions