Files
langgraph/libs
Nick Hollon 0f2f66fc8f refactor(langgraph): scope on_stream_event to StreamMessagesHandlerV2
Moves `on_stream_event` off the v1 `StreamMessagesHandler` base and
onto the v2 subclass. Content-block events are a v2-only concept, so
forwarding them only when the v2 handler is attached keeps the
messages channel's shape predictable for v1 callers: plain
`graph.stream(stream_mode="messages")` now ignores `on_stream_event`
entirely, even if a node explicitly calls `model.stream_v2()` on a
v1-flagged run. Dedupe of the returned AIMessage still works in that
case via `_find_and_emit_messages` / `on_chain_end`.

Also makes the v2 handler's `on_llm_new_token` override an explicit
pass-through with a comment rather than `return None`, so it reads as
an intentional no-op instead of a missing return value.
2026-04-17 16:22:50 -04:00
..