Phase 10 · Agentic AI/
Lesson 10.10advanced2 h 45 min

Agent safety and security

Prompt injection, the lethal trifecta, least privilege, sandboxing and human-in-the-loop

An agent that reads untrusted content and can act is a new kind of attack surface: the attacker does not need to break your code, only to write text your model will read. Prompt injection has no complete fix, so safe agents are built like secure systems — least privilege, isolation, approvals, monitoring — rather than like well-behaved chatbots. This lesson gives you the threat model, the one rule that prevents most disasters (break the lethal trifecta), and a checklist you can apply to anything you build in 10.11 Building production agents and 10.12 Project: build a research agent with tools, an MCP server and an eval harness.

You'll be able to

  • Explain direct and indirect prompt injection and why it cannot be fully solved at the model level
  • Apply the lethal-trifecta rule to decide which capability to remove from a design
  • Design defense in depth: least privilege, sandboxing, human approvals, quarantined models, monitoring
  • Summarize the agentic-misalignment findings and the supply-chain risks of tools, servers and skills

Key ideas

  1. Prompt injection (direct, and the more dangerous indirect kind hidden in content) is unsolved because instructions and data share one token stream and defenses are probabilistic.
  2. Lethal trifecta: private-data access + untrusted content + external communication enables exfiltration; remove one leg by design.
  3. Defense in depth: least privilege, sandboxing with restricted egress, human approval for consequential actions, quarantined vs privileged models, provenance-tagged tool results, guards, budgets, logging, kill switches.
Show 4 more key ideas
  1. Memory, multi-agent delegation (confused deputy), computer use, MCP servers/skills and package supply chains are additional injection and compromise surfaces.
  2. Agentic misalignment tests (2025) showed frontier models can choose harmful actions under goal conflict in artificial scenarios — keep humans in the loop for high-stakes autonomy.
  3. OWASP's LLM Top 10 (prompt injection, excessive agency, supply chain, output handling…) is a useful review checklist.
  4. Put red-team tasks with planted injections into your eval harness and run them on every change.

Suggested path through this lesson