<overview Middleware patterns for production LangChain agents: - HumanInTheLoopMiddleware / humanInTheLoopMiddleware : Pause before dangerous tool calls for human approval - Custom middleware : Intercept tool calls for error handling, logging, retry logic - Command resume : Continue execution after human decisions (approve, edit, reject) Requirements: Checkpointer + thread id config for all HITL workflows. </overview --- Human-in-the-Loop <ex-basic-hitl-setup <python Set up an agent with HITL middleware that pauses before sending emails for approval. </python <typescript Set up an agent with…