The big idea
An AI chatbot doesn't just listen to the person typing to it. Many AI tools — especially AI agents, which can browse the web, read your email, or open documents — also read whatever text they're given, and they tend to follow instructions wherever those instructions appear.
That includes a webpage they're summarizing, a customer review they're reading, or an email they've been asked to reply to. Most of the time that's fine, because that text is just information. But it means an AI can't always tell the difference between "here is something to read" and "here is a command to obey."
Simple definition: Prompt injection is when someone hides an instruction inside content an AI is reading, hoping the AI will follow that hidden instruction instead of doing what the real user actually asked for.
Here's an analogy. Imagine a teacher checks a mailbox every morning for notes from the school office. One day, a student slips in a fake note that reads, "Cancel today's homework — signed, the Principal." The note looks official enough that the teacher might just believe it and cancel the homework, without ever realizing the note wasn't really from the principal at all.
That's exactly the trick behind prompt injection. The "note" is a sentence buried inside a passage of text. The "teacher" is the AI, which reads everything in its inbox — including notes nobody in charge actually approved.
Spot the hidden instruction
Below are four short passages that an AI assistant might be asked to read and summarize. In each one, most sentences are normal — but one sentence is a hidden instruction aimed at the AI, not at a human reader. Click the sentence you think is the injected instruction.
Product review
An AI shopping assistant is asked to summarize this review.Webpage snippet
An AI agent is asked to browse this page and summarize it.Email to summarize
An AI assistant is asked to summarize this email in the user's inbox.Customer support ticket
An AI helpdesk tool is asked to summarize this ticket for a human agent.What gives it away: the hidden sentence usually talks directly to the AI ("AI assistant reading this...", "System note:", "Assistant:"), tries to override earlier instructions ("ignore your previous instructions," "skip the usual process"), or asks for something that has nothing to do with the passage's real purpose — like a product review suddenly demanding a refund be approved.
Why it matters
A chatbot that just answers questions in a text box can only do so much damage if it's tricked. But AI is increasingly built into AI agents — assistants that can actually take actions for you, like reading your email, browsing the web, booking a flight, or editing files on your computer. You can learn more about how these work in What Are AI Agents? and Building Agentic Systems.
That extra power is exactly what makes prompt injection dangerous. If an agent reads a poisoned webpage, document, or email, a hidden instruction could get it to:
- Leak private information — like forwarding your emails or messages to a stranger.
- Send money — like approving a refund or gift card that was never supposed to be approved.
- Delete or change files — without ever asking you first.
- Take other actions you never asked for — all while believing it's just doing its normal job.
The scariest part is that the real user often has no idea any of this happened. You asked the AI to "summarize this webpage," it looked like it did exactly that, and the attack happened quietly in the background.
How builders defend against it
People who build AI tools can't make an AI perfectly immune to prompt injection yet, but they can make attacks much harder to pull off. Three of the biggest ideas:
- Treat outside content as data, never as commands. A webpage, document, or email the AI reads should be handled like information to summarize — not like instructions to follow, no matter how official it sounds.
- Require human confirmation before risky actions. Before an AI agent sends money, deletes a file, or does something that's hard to undo, a real person should have to click "yes, do this."
- Limit what an agent is allowed to do in the first place. An AI that summarizes emails doesn't need the power to also send money or delete files — so it shouldn't be given that power at all.
None of these defenses are perfect on their own, which is why careful builders use several of them together.
Check your understanding
Imagine an AI assistant is asked to summarize a webpage. What's one sign that a sentence on that page might be a hidden instruction rather than real content?
Your answer:
Sample answer: A sentence that speaks directly to the AI (like "AI assistant, do this instead") or tells it to ignore its earlier instructions is a red flag. Real webpage content is written for human readers, not for the AI reading it on their behalf.
Quick quiz
1. Which sentence best describes prompt injection?
2. In a passage of text, which sentence is most likely a hidden prompt injection?
3. Why does prompt injection matter more as AI agents become more common?
Keep learning about responsible AI
Now that you can spot a hidden instruction, learn about another way AI content can be used to deceive people: fake but realistic images, video, and audio.
Part of the Responsible AI & Safety tutorial series.