Defending AI Agents
עברית Join waitlist
Menu

Module 00 · Lesson 10

One gateway, built a module at a time: the course map

Most modules after this one add a part to one small piece of software that sits between an agent and its tools. This lesson shows the order, and why.

Five parts

Part Modules Question it answers
I. Foundations 0-3 What is an agent, what can attack it, and where do you stand to stop it?
II. Attacks 4-6 How do injection, poisoning and privacy attacks actually work?
III. Measurement 7-10 How good is a detector, on which population, against which attacker?
IV. Enforcement 11-15 How do design, identity, policy and supply-chain controls turn evidence into decisions?
V. Operations 16-21 How do you prove what happened, change policy safely, respond, satisfy an auditor, find every agent, and keep the gateway up?

Attacks come before measurement so that the statistics always has an adversary to measure. Design (Module 11) comes after red-teaming (Module 9) so that you arrive having watched an adaptive attacker beat your detectors.

Each module is flagged theoretical (its value is a way of reasoning, and its build exists to measure it) or applied (its value is a component of the gateway you build, measure and keep). The flag says where the value lies, not how large the build is.

The decision words (allow, flag, hold, deny, and "refused") and the other terms that recur across modules are defined once, with the module that teaches each, in the glossary.

The gateway

You do not use a security product in this course. You build a small one.

flowchart TD
  A["toy agent<br/>(local model)"] -->|tool call| G
  subgraph G["gateway"]
    direction TB
    G1["normalise"] --> G2["detect"] --> G3["decide"] --> G4["log"]
  end
  G -->|allowed call| T["stand-in tools in a container:<br/>mail, files, web, shell, MCP server"]
  G --> L["audit log, approval queue, reports"]
Module You add
1 The toy agent and its tools, and the attack that breaks it
2 A threat model of the lab agent, checked against the running lab
3 The interceptor: every call becomes one normalised record; a hook and a spool for the laptop; tokens bound to one server
4 Injection detectors
5 Provenance on everything the agent stores
7-8 Thresholds with confidence bounds; an evaluation harness
9 A red-team harness and an adaptive attacker
10 Behavioural detectors
11 Taint tracking; the agent rebuilt so injected text cannot act
12 Scoped credentials, a sandbox, a kill switch, a quota
13 A policy engine, an approval queue and a policy linter
14-15 Signed manifests; PII redaction and erasure
16 A tamper-evident log, replay, off-policy estimates
17-18 A policy learner; an incident runbook
19 An evidence report for an auditor
20 An inventory of the agents, linked across sources, with an estimate of how many it misses
21 Load tests, failure modes per error class, burn-rate alerts, a verified restore

Module 6 adds no gateway part: it trains models privately and attacks them, for graduate outcome 7.

Each module from Module 1 on ends with make check-N, which tests your implementation's behaviour, and with an At scale section that takes your laptop measurements to fifty million calls a day.

Module 9's make redteam-study runs a fixed attack set and a benign set through your detectors and prints the four-bucket report with intervals. It is not rerun as a scoreboard in later modules; each module's check and study measure what that module adds. In the capstone, make gauntlet runs a three-phase red team (Module 9's detector cases, Module 11's call traces, Module 13's policy traces) against your finished gateway, as often as you like, and the grader runs a hidden version with a seed you never see and more cases.

What you will be able to do

The course ends at ten graduate outcomes, O1 to O10: threat modelling, design, detection, policy, red-teaming, offline evaluation, the supply chain and model leakage, incident response and evidence, operating at scale, and finding the agents. Every module's "You will be able to" list tags each item with its tier, the outcome it builds and the check or problem that assesses it. The map lays the outcomes against the modules, draws the prerequisites, and gives three paths: the full course (266 hours), a detection path (110) and a platform and operations path (180).

What you need

  • Python, probability, and some machine learning. No security background.
  • A laptop on macOS, Linux, or Windows with WSL 2. No GPU. The lab is sized for 8 GB of memory by Module 1's model-size arithmetic, and 8 GB is untested: every recorded run is on a 32 GB Apple M5 (Module 1, Tested on).
  • About 266 hours, the capstone's 26 included: reading, the build and a third of the problems, timed for a 16 GB laptop without a GPU (an 8 GB one is slower on the live-model steps, by Module 1's estimate). At 8 hours a week, about eight months.

Check yourself

  1. Which module would you expect to stop incident 1 from lesson 2 most cheaply? Which would catch it if that failed?
  2. Which row of the "You add" table would stop EchoLeak (lesson 2, incident 4)? If none would, what would have to be added, and where would it sit?
Answers
  1. Module 11: its rule that, after an untrusted read, no external send may carry a CRM value removes the path whatever the e-mail says, at the cost of holding replies that quote customer data. If that failed, Module 4's injection detectors might flag the e-mail, and Module 10's behavioural detectors the unusual full export to an outside address.
  2. None: EchoLeak's data left through the client's automatic fetch of an image address in the rendered answer, not through a tool call, so every row of the table sits on a path it never used. The missing control is an output filter that strips or allow-lists addresses in model output, placed between the model's answer and the client that renders it (lesson 1).