[PR #1371] [CLOSED] feat(langchain): document interrupts in middleware #1507

Closed
opened 2026-02-17 17:22:26 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/docs/pull/1371
Author: @christian-bromann
Created: 11/10/2025
Status: Closed

Base: mainHead: cb/interrupts-in-middleware


📝 Commits (1)

  • 5667942 feat(langchain): document interrupts in middleware

📊 Changes

1 file changed (+177 additions, -0 deletions)

View changed files

📝 src/oss/langchain/middleware.mdx (+177 -0)

📄 Description

We received the following feedback from @casparb

There should be mention in the middleware docs of which middleware you can and cannot raise interrupts in. E.g. I've seen a few cases where people reading the docs think it makes sense to raise an interrupt in @wrap_tool_call to validate a tool message before it's sent to the model. But you can't raise an interrupt here, because on resume you'd re-execute ToolNode.
Maybe more generally HITL middleware should be expanded to have an interrupt_after param. I don't really know what the alternative to this looks like? look at the last message in the messages list and inspect the tool call name in a before_model middleware?

This patch adds a section speaking about how to use interrupts in middleware.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langchain-ai/docs/pull/1371 **Author:** [@christian-bromann](https://github.com/christian-bromann) **Created:** 11/10/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `cb/interrupts-in-middleware` --- ### 📝 Commits (1) - [`5667942`](https://github.com/langchain-ai/docs/commit/56679421d4dd4ca2365164667063159ada23173f) feat(langchain): document interrupts in middleware ### 📊 Changes **1 file changed** (+177 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `src/oss/langchain/middleware.mdx` (+177 -0) </details> ### 📄 Description We received the following feedback from @casparb > There should be mention in the middleware docs of which middleware you can and cannot raise interrupts in. E.g. I've seen a few cases where people reading the docs think it makes sense to raise an interrupt in @wrap_tool_call to validate a tool message before it's sent to the model. But you can't raise an interrupt here, because on resume you'd re-execute ToolNode. Maybe more generally HITL middleware should be expanded to have an interrupt_after param. I don't really know what the alternative to this looks like? look at the last message in the messages list and inspect the tool call name in a before_model middleware? This patch adds a section speaking about how to use interrupts in middleware. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-17 17:22:26 -05:00
yindo closed this issue 2026-02-17 17:22:26 -05:00
yindo changed title from [PR #1371] feat(langchain): document interrupts in middleware to [PR #1371] [CLOSED] feat(langchain): document interrupts in middleware 2026-06-05 18:13:01 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/docs#1507