diff --git a/libs/langgraph/langgraph/pregel/remote.py b/libs/langgraph/langgraph/pregel/remote.py index 837efa364..6cc51b908 100644 --- a/libs/langgraph/langgraph/pregel/remote.py +++ b/libs/langgraph/langgraph/pregel/remote.py @@ -41,7 +41,7 @@ from langgraph._internal._constants import ( NS_SEP, ) from langgraph.checkpoint.base import CheckpointMetadata -from langgraph.errors import GraphInterrupt +from langgraph.errors import GraphInterrupt, ParentCommand from langgraph.pregel.protocol import PregelProtocol, StreamProtocol from langgraph.types import ( All, @@ -680,6 +680,9 @@ class RemoteGraph(PregelProtocol): ns = tuple(ns_.split(NS_SEP)) else: mode, ns = chunk.event, () + # raise ParentCommand exception for command events + if mode == "command" and chunk.data.get("graph") == Command.PARENT: + raise ParentCommand(Command(**chunk.data)) # prepend caller ns (as it is not passed to remote graph) if caller_ns := (config or {}).get(CONF, {}).get(CONFIG_KEY_CHECKPOINT_NS): caller_ns = tuple(caller_ns.split(NS_SEP)) @@ -779,6 +782,9 @@ class RemoteGraph(PregelProtocol): ns = tuple(ns_.split(NS_SEP)) else: mode, ns = chunk.event, () + # raise ParentCommand exception for command events + if mode == "command" and chunk.data.get("graph") == Command.PARENT: + raise ParentCommand(Command(**chunk.data)) # prepend caller ns (as it is not passed to remote graph) if caller_ns := (config or {}).get(CONF, {}).get(CONFIG_KEY_CHECKPOINT_NS): caller_ns = tuple(caller_ns.split(NS_SEP)) diff --git a/libs/langgraph/tests/test_large_cases.py b/libs/langgraph/tests/test_large_cases.py index 562cdc256..4f7845bba 100644 --- a/libs/langgraph/tests/test_large_cases.py +++ b/libs/langgraph/tests/test_large_cases.py @@ -6958,4 +6958,4 @@ def test_subgraph_to_end_does_not_warn() -> None: graph = builder.compile() response = graph.invoke({"x": "hello"}) - print(response) + assert response == {"x": "hello!"} diff --git a/libs/langgraph/uv.lock b/libs/langgraph/uv.lock index 2b70d004e..49c7906c1 100644 --- a/libs/langgraph/uv.lock +++ b/libs/langgraph/uv.lock @@ -1481,7 +1481,7 @@ wheels = [ [[package]] name = "langgraph-sdk" -version = "0.1.73" +version = "0.1.74" source = { editable = "../sdk-py" } dependencies = [ { name = "httpx" }, diff --git a/libs/prebuilt/uv.lock b/libs/prebuilt/uv.lock index 339723d41..1d39ba961 100644 --- a/libs/prebuilt/uv.lock +++ b/libs/prebuilt/uv.lock @@ -507,7 +507,7 @@ dev = [ [[package]] name = "langgraph-sdk" -version = "0.1.73" +version = "0.1.74" source = { editable = "../sdk-py" } dependencies = [ { name = "httpx" }, diff --git a/libs/sdk-py/langgraph_sdk/schema.py b/libs/sdk-py/langgraph_sdk/schema.py index d68bf6439..ee3e74d95 100644 --- a/libs/sdk-py/langgraph_sdk/schema.py +++ b/libs/sdk-py/langgraph_sdk/schema.py @@ -247,7 +247,7 @@ class Thread(TypedDict): values: Json """The current state of the thread.""" interrupts: dict[str, list[Interrupt]] - """Interrupts which were thrown in this thread""" + """Mapping of task ids to interrupts that were raised in that task.""" class ThreadTask(TypedDict): diff --git a/libs/sdk-py/pyproject.toml b/libs/sdk-py/pyproject.toml index 7a33a33d8..68ef541a1 100644 --- a/libs/sdk-py/pyproject.toml +++ b/libs/sdk-py/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "langgraph-sdk" -version = "0.1.73" +version = "0.1.74" description = "SDK for interacting with LangGraph API" authors = [] requires-python = ">=3.9" diff --git a/libs/sdk-py/uv.lock b/libs/sdk-py/uv.lock index ad6e10698..246dc37ba 100644 --- a/libs/sdk-py/uv.lock +++ b/libs/sdk-py/uv.lock @@ -119,7 +119,7 @@ wheels = [ [[package]] name = "langgraph-sdk" -version = "0.1.73" +version = "0.1.74" source = { editable = "." } dependencies = [ { name = "httpx" },