mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-08-26 01:22:24 +02:00
See https://github.com/langchain-ai/langgraph/pull/6277 Adds langgraph.types.Overwrite, a deterministic way to bypass a reducer. When encountering a value wrapped with Overwrite, BinaryOperatorAggregate overwrites the channel value. <img width="227" height="329" alt="image" src="https://github.com/user-attachments/assets/f2136117-9aa3-4246-863d-d5df0e7d1df1" /> If either node_b or node_c overwrite (but not both), then at END the channel is equal to the value node_b or node_c wrote. Order of execution doesn't matter because once an Overwrite value is encountered, regular values are ignored (self.operator is not called for the rest of the update) If multiple nodes overwrite in the same superstep then InvalidUpdateError is thrown Usage ```python from langgraph.types import Overwrite def node_b(state:State): return {"messages": Overwrite(["b"])} ``` or ``` python def node_b(state:State): return {"messages": {"__overwrite__": ["b"]}} ```