Prompt injection and tool security
Notebook· 04.05· 150–180 min· Lesson 37 of 129
The notebook opens in your lab, in a new tab. If your server is stopped, it starts first (a few seconds).
By the end you can
- Demonstrate direct and indirect prompt injection, including a poisoned email that makes an agent misuse a tool.
- Name the lethal trifecta (private data + untrusted content + a way out) and write a three-question threat model for an agent.
- Apply layered defences: least-privilege tools, allow-lists, fencing untrusted text, input classification (Llama Prompt Guard 2), checks on proposed tool calls, and human approval for side effects.
- Measure a detector on a labelled set (attacks caught, false alarms) instead of trusting one example.
- Redact traces before they leave your machine (LangSmith anonymizer,
LANGSMITH_HIDE_INPUTS,TracePolicy).
Before you start
Lessons 04.01–04.04.
