Files
langgraph/libs
Nick Hollon ab1d6980b5 Drain-on-consume streaming with caller-driven async pump
Collapse the eager async pump task into the same caller-driven model
as sync: each cursor's advance drives one graph event through the
mux. Concurrent async consumers serialize through an asyncio.Lock so
each acquisition produces exactly one event, matching sync semantics.

EventLog becomes a single-consumer drainable queue — items pop off
as the cursor advances, a second __iter__ / __aiter__ raises.
Fan-out moves to explicit tee(n) / atee(n) helpers. Retention
windows, BufferOverflowError, and max_events are gone; pre-
subscription pushes are silent no-ops so unsubscribed projections
don't accumulate.

Both run streams gain abort() and context-manager support; the
pump's BaseException catch is narrowed to Exception so
CancelledError propagates per asyncio contract.

TestMemoryBounds locks in the drain-on-consume invariants:
subscribed buffers drop back to empty after each yield, unsubscribed
projections never accumulate, and run.output leaves the values log
untouched.
2026-04-18 12:34:10 -04:00
..