From the LangGraph: inside the agent runtime architecture map
Pregel is a single 3,700-line class with every sync path hand-duplicated for async
The Pregel class (main.py:449-4190) is the sole entry point into the runtime: all 16 outbound calls it makes reach the checkpoint mapper, channel I/O helpers, task planner, loop and runner — nothing else in the file has a way out. That concentration comes with a duplication cost: bulk_update_state and abulk_update_state are each about 470 hand-kept lines, as are the stream/astream pairs, so a fix has to land twice, as the recent nested checkpoint_ns regression did.
Impact: Every bug fix or behavior change to checkpointing, I/O shaping, task planning or execution has to be applied once for the sync path and once for the async path inside this class, with no shared implementation to catch a missed side.
Recommendation (medium effort): Extract the shared logic behind bulk_update_state/abulk_update_state and the stream/astream pairs into one implementation, so a fix like the checkpoint_ns one lands once, without giving up the single entry point into the runtime.
The trail
- Pregel
- Checkpoint Store Mapper
- Checkpoint Store Mapper
- Channel I/O Helpers
- Channel I/O Helpers
- Task Planner (_algo)
- Task Planner (_algo)
- Pregel Loop
- Pregel Loop
- Pregel Runner
- Pregel Runner