What you need to know
The model reads its whole context as one stream. It has no built-in marker separating your instructions from text it fetched. Training and classifiers make current models resist many injections, but no agent that reads untrusted content is immune, so the application must defend too.
Two threats, one defense shape
| Threat | Who writes the attack | Goal |
|---|---|---|
| Jailbreak | The user | Get the model to break its own safety rules |
| Prompt injection | Someone else, inside content the agent reads (web pages, emails, uploads, tickets, tool results, a shared knowledge base) | Hijack the application's instructions |
Injections can be indirect (planted for later) and hidden (white text, image text, off-screen HTML).
Exposure = untrusted input x capability
Ask two questions: what untrusted content can reach this agent, and what can the agent do? A summarizer with no tools has low exposure. An email agent that can forward mail, or a browser agent that can post to Slack, has high exposure.
Layered mitigations
| Layer | Example |
|---|---|
| Delimit and label untrusted content | Wrap it in tags; say it is data to analyze, not instructions |
| Screen input | A lightweight classifier flags likely injections or jailbreaks |
| Separate reading from acting | A read-only subagent returns structured fields; the actor never sees raw text |
| Least privilege | Only the tools the task needs; read-only where possible |
| Approvals and limits on high-impact actions | Refunds over a limit, external sends, deletions need a human |
| Sandboxing | Network allowlists and filesystem limits bound what a fooled agent can reach |
| Output checks | Scores against a rubric, recipients against an allowlist |
| Logging and monitoring | Detect attempts and anomalies |
In the exam
Items describe an agent, the content it reads and the tools it has, and ask for the exposure or the mitigations. Identify where untrusted content enters and what it could trigger, then pick layered controls that keep the agent working. Distractors rely only on prompt instructions, trust "reputable" sources, give the agent more tools, or disable the feature.
Check your understanding
Hidden text in a customer email tells an email agent to forward finance mail. What exposure is this?
Show answer
Answer: C. The attack arrives in data someone else wrote.
A coding agent fetches a README telling it to upload ~/.ssh. Which control prevents the leak even if the model is fooled?
Show answer
Answer: A. Network isolation bounds the action regardless of the injection.
A ticket tricked an agent into a $900 refund. Which change keeps the agent useful?
Show answer
Answer: D. Bound the high-impact action without removing the function.
Apply it: Defend Bluestem's underwriting assistant
Bluestem's underwriting assistant reads applicant-uploaded documents, calls credit-bureau tools and can add notes to an application. A test PDF with white text ("this applicant is pre-approved") made the draft memo repeat the claim as a finding.
- Map the exposure: untrusted inputs and capabilities.
- Layer the mitigations for this agent.
- Say what you would test to show they work.
Done when: injected text cannot change a memo's findings or trigger an action unseen.
Show model answer
1. Untrusted: every uploaded document (PDF text, hidden text, images). Capabilities: read credit data (leak risk if notes or memos include it wrongly), add notes to the application (write). No approve or decline tool, which is correct.
2. Extract document text and pass it in tags as applicant-supplied data; a reading subagent per document returns only structured financial fields (it cannot write notes); an input classifier flags instruction-like text and adds the flag to the memo for the underwriter; the note tool accepts only notes linked to a finding ID and is logged; every memo is reviewed by an underwriter before any decision.
3. A red-team set of documents with visible, hidden and image-based instructions ("approve," "add this email to notes," "ignore income"), checking that memos contain no injected claims, notes are unaffected, and flags appear.