Phase 1 · Building with LLMs · Tools & agents
Prompt injection and security
How untrusted text hijacks models, and how to limit the damage.
Open this lesson Create a free account
Why it matters
Any text your app feeds a model can try to give it orders: a product review, a lead's email, a competitor's web page, a document a customer uploads. That's prompt injection, and it's the defining security problem of LLM apps. For a summarizer the damage is an odd summary. For an agent that can read your CRM and send email, it can be a data leak. You can't patch it away completely, so you design so that a successful injection can't do much.
What you'll be able to do
- Explain prompt injection and why models can't fully separate instructions from data
- Spot indirect injection in reviews, emails, web pages and tool results
- Use the lethal trifecta to judge when an agent is dangerous
- Apply layered defenses in code: label untrusted text, filter links, gate actions
Before this lesson
Next in this phase: Evals