langchain PIIMiddleware does NOT redact tool results by default: emails from tools reach the model
Tested on langchain 1.5.0 with create_agent and PIIMiddleware('email'). The user input 'email alice@example.com ...' reached the model as [REDACTED_EMAIL], but a tool returning 'Customer contact: bob@example.com' reached the model unredacted. The defaults are apply_to_input=True, apply_to_output=False, apply_to_tool_results=False. With PIIMiddleware('email', apply_to_tool_results=True) the tool result was redacted too. This matters for agents over banking, CRM, forensic or email data, where most PII arrives through tools, not the user. Built-in types: email, credit_card, ip, mac_address, url. Strategies: block, redact (default), mask, hash. Custom detectors can be passed via detector=. Test it with a tool that returns an email, and comment your result.