
“This course contains the use of artificial intelligence.”
AI agent security is a boundary problem. Once a language model can call tools, read files, send requests and remember what it saw, prompt injection and over-privileged tools stop being theory. This hands-on course shows you how to secure AI agents and MCP servers layer by layer, on a local lab bench you build yourself. No GPU and no paid AI API are needed: the labs run on CPU with a small open model.
What you will build and test
You start by building that bench: Ollama in a container bound to localhost, a small tool-calling model chosen for size, speed and licence, and a minimal agent loop in Python that logs every step. From the first tool call you see how the model chooses arguments, including invented ones, and why validation has to start at the tool boundary.
Next you read the Model Context Protocol from the defender's seat. You write your own MCP server with the Python SDK, list exactly what the model will see, learn why tool annotations are hints rather than controls, and validate both tool inputs and structured results. Least privilege follows: an open-ended shell tool is replaced by narrow functions, file paths are confined correctly, and read and write access are split across separate servers.
Every tool call then passes through one decision point. You run OPA, write Rego policies with argument-level rules for paths, hosts and row limits, and test the policies before they ship. Tools run in hardened containers with a read-only filesystem, all capabilities dropped, no network by default and resource limits, and agent-written code runs in throwaway containers.
Identity gets its own section: whose authority the agent uses, MCP servers as OAuth resource servers, audience-bound tokens, why token passthrough is forbidden and how scoped credentials keep secrets out of prompts. Prompt injection, direct and indirect, is treated as a boundary problem rather than a filtering problem: untrusted content is marked and kept out of instructions, plans are fixed before untrusted data is read, a guard model screens inputs on CPU, and a policy blocks the injected action even when the model follows it.
The final sections cover the operational controls: human approval gates bound to one request, per-user memory isolation, retrieval that filters before it retrieves, redaction of secrets and personal data, step and token budgets, rate limits, structured audit logs, OpenTelemetry spans and detection rules. You pin MCP servers and audit client configuration as code, threat model the agent with MAESTRO, and finish with a kill-switch drill and a full control check of the finished bench.
47 of the 80 content lectures are hands-on labs. Twelve downloadable documents come with the course, including an MCP hardening checklist, a Rego policy guide, a sandbox checklist, a human approval policy, an audit log schema with detection rules and an incident response runbook, plus the complete agent bench as a ZIP.