diff --git a/libs/langgraph/langgraph/types.py b/libs/langgraph/langgraph/types.py index 53dc6bd57..5f2394bc6 100644 --- a/libs/langgraph/langgraph/types.py +++ b/libs/langgraph/langgraph/types.py @@ -19,6 +19,8 @@ cast, ) +from pydantic import BaseModel + from langchain_core.runnables import Runnable, RunnableConfig from typing_extensions import Self @@ -287,6 +289,8 @@ def __repr__(self) -> str: def _update_as_tuples(self) -> Sequence[tuple[str, Any]]: if isinstance(self.update, dict): return list(self.update.items()) + elif isinstance(self.update, BaseModel): + return list(self.update.model_dump().items()) elif isinstance(self.update, (list, tuple)) and all( isinstance(t, tuple) and len(t) == 2 and isinstance(t[0], str) for t in self.update