AI apps add a new attack surface on top of the old ones. This is the map: the threats unique to LLMs and agents, and the controls that actually contain them.
Shipping an LLM or agent feature adds a new attack surface on top of every classic one. The model takes untrusted natural-language input, calls tools, reads private data, and generates code and actions, which means the old "don't trust input" rule now applies to prose, tool output, and retrieved documents, not just form fields. This guide is the map: the threats that are specific to AI apps, and the controls that actually contain them, so you can ship without opening a hole.
The mental model that keeps you sane: the model is a powerful, gullible intern. It will do what a cleverly worded input tells it to, so security lives in the boundaries around it (input handling, tool permissions, output validation), not in the model's good intentions.
Two adjacent risks ride along with AI development: the model's code output is often insecure (a large share of AI-generated code carries flaws), covered in securing AI-generated code; and the dependencies your AI stack pulls in are a supply-chain target, covered in software supply chain attacks. AI security is not separate from application security; it's a new layer on it.
Treat every input crossing into the model as attacker-controlled, give agents the least agency that still does the job, validate and encode every output, and red-team the whole thing before users do. Add guardrails at the input and output boundaries, not deep in the model, and keep humans in the loop for high-stakes actions. The models will keep changing; these boundary controls won't. Each linked guide goes deep on one layer; start from prompt injection and tool scoping, then make it testable.
Get the latest tutorials, guides, and insights on AI, DevOps, Cloud, and Infrastructure delivered directly to your inbox.
Explore more articles in this category
You cannot prove an LLM app is safe by reading its prompt. Here is how to adversarially test it before attackers do.
Autonomous agents take real actions, so a single injected instruction can cause real damage. Here is how to contain them.
AI coding assistants ship fast but frequently introduce security flaws, so treat their output as untrusted and gate it before merge.
Evergreen posts worth revisiting.