Every LangChain application you ship is processing natural language that is simultaneously data and instruction - and nothing in the LLM stack enforces a boundary between the two. That gap is not theoretical. It is the exact mechanism behind the Samsung ChatGPT data leak, the Chevrolet chatbot that agreed to sell a Tahoe for one dollar, the Bing Chat "Sydney" system prompt extraction, the Slack AI indirect injection disclosed by PromptArmor, and the Freysa AI agent jailbreak that took an attacker 482 attempts and $47,000 in fees to land. Defensive AI Engineering is the hands-on Python guide to closing that gap. Built around DAES, a five-layer Defensive AI Engineering Stack covering Threat Modeling, Injection Detection, RAG Hardening, Agent Containment, and Monitoring, this book gives you working, tested code for every layer, not abstract security theory. You will build pattern-based and model-based injection scanners for direct, indirect, and stored attacks. You will harden a RAG pipeline from ingestion through the vector store, defending against embedding inversion and PoisonedRAG-style poisoning. You will design least-privilege LangChain tool schemas with human-in-the-loop confirmation gates, secure LangGraph agents with trust-zone validators and rollback, and sign inter-agent messages to stop a single compromised sub-agent from controlling an entire pipeline. You will wire a red-team test suite into CI/CD as a deployment-blocking gate, add LLM-specific structured monitoring that standard APM tools cannot see, and write a machine-readable acceptable use policy that lives in your codebase instead of a legal filing cabinet. Every defense in this book traces back to a documented, named incident, and ships with the actual Python you need to close that exact gap in your own LangChain or LangGraph application, this week.
ThriftBooks sells millions of used books at the lowest everyday prices. We personally assess every book's quality and offer rare, out-of-print treasures. We deliver the joy of reading in recyclable packaging with free standard shipping on US orders over $20. ThriftBooks.com. Read more. Spend less.