LangChain

Middleware for Managed Deep Agents

Sep 16, 2026LangChain
SummaryAI, from the source post

The post introduces and demonstrates middleware for LangChain's Managed Deep Agents. It showcases the use of prebuilt PIIMiddleware to redact sensitive customer data (like emails) before it is processed by an LLM, ensuring privacy. Additionally, it provides a practical example of building a custom logging middleware from scratch using the `wrap_tool_call` decorator, illustrating how to extend agent lifecycles with custom logic for policy enforcement, fault tolerance, and rate limiting.

More from the Agentic PII Detection trail