@@ -43,12 +43,13 @@ def dumps(self, obj: Any) -> bytes:
4343 try :
4444 # Check if this is an Interrupt object that needs special handling
4545 from langgraph .types import Interrupt
46+
4647 if isinstance (obj , Interrupt ):
4748 # Serialize Interrupt as a constructor format for proper deserialization
4849 return super ().dumps (obj )
4950 except ImportError :
5051 pass
51-
52+
5253 try :
5354 # Fast path: Use orjson for JSON-serializable objects
5455 return orjson .dumps (obj )
@@ -75,7 +76,7 @@ def _revive_if_needed(self, obj: Any) -> Any:
7576 reconstructed. Without this, messages would remain as dictionaries with
7677 'lc', 'type', and 'constructor' fields, causing errors when the application
7778 expects actual message objects with 'role' and 'content' attributes.
78-
79+
7980 This also handles Interrupt objects that may be stored as plain dictionaries
8081 with 'value' and 'id' keys, reconstructing them as proper Interrupt instances
8182 to prevent AttributeError when accessing the 'id' attribute.
@@ -93,7 +94,7 @@ def _revive_if_needed(self, obj: Any) -> Any:
9394 # This converts {'lc': 1, 'type': 'constructor', ...} back to
9495 # the actual LangChain object (e.g., HumanMessage, AIMessage)
9596 return self ._reviver (obj )
96-
97+
9798 # Check if this looks like an Interrupt object stored as a plain dict
9899 # Interrupt objects have 'value' and 'id' keys, and possibly nothing else
99100 # We need to be careful not to accidentally convert other dicts
@@ -106,11 +107,12 @@ def _revive_if_needed(self, obj: Any) -> Any:
106107 # Try to reconstruct as an Interrupt object
107108 try :
108109 from langgraph .types import Interrupt
109- return Interrupt (value = obj ["value" ], id = obj ["id" ])
110+
111+ return Interrupt (value = obj ["value" ], id = obj ["id" ]) # type: ignore[call-arg]
110112 except (ImportError , TypeError , ValueError ):
111113 # If we can't import or construct Interrupt, fall through
112114 pass
113-
115+
114116 # Recursively process nested dicts
115117 return {k : self ._revive_if_needed (v ) for k , v in obj .items ()}
116118 elif isinstance (obj , list ):
0 commit comments