diff --git a/libs/langgraph/langgraph/pregel/debug.py b/libs/langgraph/langgraph/pregel/debug.py index a5bbab669..f70a6e8c4 100644 --- a/libs/langgraph/langgraph/pregel/debug.py +++ b/libs/langgraph/langgraph/pregel/debug.py @@ -29,7 +29,7 @@ from langgraph.constants import ( NS_SEP, TAG_HIDDEN, ) -from langgraph.pregel.io import map_output_updates, read_channels, single +from langgraph.pregel.io import read_channels from langgraph.pregel.utils import find_subgraph_pregel from langgraph.types import PregelExecutableTask, PregelTask, StateSnapshot diff --git a/libs/langgraph/langgraph/pregel/io.py b/libs/langgraph/langgraph/pregel/io.py index 88112259a..2a1f629cb 100644 --- a/libs/langgraph/langgraph/pregel/io.py +++ b/libs/langgraph/langgraph/pregel/io.py @@ -5,7 +5,7 @@ from langchain_core.runnables.utils import AddableDict from langgraph.channels.base import BaseChannel, EmptyChannelError from langgraph.constants import EMPTY_SEQ, ERROR, INTERRUPT, TAG_HIDDEN from langgraph.pregel.log import logger -from langgraph.types import PregelExecutableTask, PregelTask +from langgraph.types import PregelExecutableTask def read_channel( @@ -99,20 +99,14 @@ class AddableUpdatesDict(AddableDict): def map_output_updates( output_channels: Union[str, Sequence[str]], - tasks: list[ - tuple[Union[PregelTask, PregelExecutableTask], Sequence[tuple[str, Any]]] - ], + tasks: list[tuple[PregelExecutableTask, Sequence[tuple[str, Any]]]], cached: bool = False, ) -> Iterator[dict[str, Union[Any, dict[str, Any]]]]: """Map pending writes (a sequence of tuples (channel, value)) to output chunk.""" output_tasks = [ (t, ww) for t, ww in tasks - if ( - not hasattr(t, "config") - or not t.config - or TAG_HIDDEN not in t.config.get("tags", EMPTY_SEQ) - ) + if (not t.config or TAG_HIDDEN not in t.config.get("tags", EMPTY_SEQ)) and ww[0][0] != ERROR and ww[0][0] != INTERRUPT ] diff --git a/libs/langgraph/langgraph/pregel/remote.py b/libs/langgraph/langgraph/pregel/remote.py index f96060a5a..54db4ad60 100644 --- a/libs/langgraph/langgraph/pregel/remote.py +++ b/libs/langgraph/langgraph/pregel/remote.py @@ -154,6 +154,8 @@ class RemoteGraph(PregelProtocol, Runnable): interrupts=tuple(interrupts), state=self._create_state_snapshot(task["state"]) if task["state"] + else {"configurable": task["checkpoint"]} + if task["checkpoint"] else None, result=task.get("result"), )