high88%
HumanInTheLoopMiddleware async agent ainvoke fails with RuntimeError: Called get_config outside of a runnable context
When using HumanInTheLoopMiddleware with an async agent (agent.ainvoke), the middleware's aafter_model method delegates to synchronous after_model, which calls interrupt(). In the async execution path, the LangGraph config context variable is not set, causing get_config() to raise RuntimeError, breaking the approval flow.
