Prompt injection cannot be fully prevented by a better system prompt. Once an agent can call tools, read inboxes, open pull requests, or move money, security becomes an action problem: who is acting, with what authority, under what limits, and with what evidence. This book shows you how to build that control layer in Python.
Most AI-security books describe risks. This one assumes the model is already hostile. You will test your agent against a deliberately compromised model and verify invariants that must hold regardless of what the model says: no unapproved high-risk action, no credential escape, no silent data egress, and a complete audit trail.
18 chapters in 5 parts, 41 figures, 43 tables, and 118 code listings8 appendices: production-readiness checklist, MCP security checklist, threat-modelling worksheet, testing matrix, policy library, incident runbook, framework adapters, and version matrixControls mapped to the OWASP Top 10 for Agentic Applications (2026) and the OWASP Top 10 for LLM Applications (2025)Every pattern is implemented in Wardgate, an open-source reference control layer on GitHub (Python 3.12-3.14, MCP Python SDK 2.2, container sandbox, CI security gates, and an evidence pack you can adapt for your own review).
Ship agents your security team can approve. Scroll up and get your copy.