mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-08-20 14:42:28 +02:00
Renames `operator` → `reducer` and flips arg order to `(reducer, typ=None)`, matching the new batch contract: `reducer(state, list[writes]) -> state`. The reducer receives all writes for a step in one call instead of being folded pairwise, enabling single-pass implementations that avoid O(N²) reprocessing. `typ` is now optional — `_is_field_channel` in `graph/state.py` always overwrites it from the `Annotated[T, ...]` outer type, so users can write `DeltaChannel(my_reducer)` rather than `DeltaChannel(list, my_reducer)`. Adds `_messages_delta_reducer` to `langgraph.graph.message` (experimental): a single-pass bulk reducer for message lists that deduplicates by ID and handles `RemoveMessage` tombstoning without calling `add_messages`, avoiding repeated dedup passes that `add_messages` would incur in a fold. Also fixes the `_delta_write_futs` mypy error in `AsyncPregelLoop` by moving the type annotation to the class body, and unignores `new_pr_desc.md` from the repo via `.gitignore`. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>