Security for AI Engineers
Security for LLM applications means defending against threats that exist because models follow instructions found in untrusted text. These include prompt injection, data leakage, insecure tool use and excessive agent permissions. Defences combine guardrails, least-privilege tool design and red teaming, and they open the advanced safety stage of the AI Engineer path.
Stage: Safety, Security and Governance · Part of the AI Engineer roadmap · Last reviewed 19 November 2026
What to learn in Security
- Distinguish direct prompt injection from indirect injection hidden in retrieved documents
- Limit each tool to minimum permissions and require approval for destructive actions
- Add input and output filters for secrets, personal data and unsafe content
- Run a red-team pass with adversarial prompts and record every failure
- Prevent model output from being executed or rendered as unescaped HTML or SQL
Security interview questions
Why is indirect prompt injection harder to defend against than direct injection?
The malicious instruction arrives inside content the system fetches by itself, such as a web page, email or PDF, so the user never typed it. The model cannot reliably separate data from instructions, so you limit tool permissions, isolate untrusted content and require confirmation for sensitive actions.
Why must LLM output be treated as untrusted input to the rest of your system?
Output can contain injected instructions, malformed JSON, script tags or SQL. Passed unchecked into a shell, database query or browser, it becomes an injection vector. Validate against schemas, escape for the destination, and run generated code only in sandboxes.
Where Security fits in the AI Engineer roadmap
Security belongs to the Safety, Security and Governance stage (advanced level), which takes about 36 hours. Ship responsibly.
Other units in this stage
Back to the full AI Engineer roadmap