change[langgraph]: clean up Interrupt interface for v1 (#5405)

This commit is contained in:
Sydney Runkle
2025-07-09 14:03:08 -04:00
committed by GitHub
parent e5947bcd30
commit d1710e2eac
17 changed files with 320 additions and 370 deletions
+6 -6
View File
@@ -14,7 +14,7 @@ from langchain_core.tools import tool as dec_tool
from pydantic import BaseModel, ValidationError
from pydantic.v1 import ValidationError as ValidationErrorV1
from langgraph.errors import NodeInterrupt
from langgraph.errors import GraphBubbleUp, GraphInterrupt
from langgraph.prebuilt import ToolNode
from langgraph.prebuilt.tool_node import TOOL_CALL_ERROR_TEMPLATE
from langgraph.types import Command, Send
@@ -462,16 +462,16 @@ def test_tool_node_incorrect_tool_name():
def test_tool_node_node_interrupt():
def tool_interrupt(some_val: int) -> str:
def tool_interrupt(some_val: int) -> None:
"""Tool docstring."""
raise NodeInterrupt("foo")
raise GraphBubbleUp("foo")
def handle(e: NodeInterrupt):
def handle(e: GraphInterrupt):
return "handled"
for handle_tool_errors in (True, (NodeInterrupt,), "handled", handle, False):
for handle_tool_errors in (True, (GraphBubbleUp,), "handled", handle, False):
node = ToolNode([tool_interrupt], handle_tool_errors=handle_tool_errors)
with pytest.raises(NodeInterrupt) as exc_info:
with pytest.raises(GraphBubbleUp) as exc_info:
node.invoke(
{
"messages": [