langgraph 0.2.6
Summary of Changes
- Added structured graph interruption mechanism with timing information (before/during/after) in PR #1354
- Added a new
NodeInterruptexception for nodes to signal interruption during execution - Improved handling of interrupts with full context of when they occurred
- Added task ID tracking in the configuration system
- Fixed several bugs related to checkpoint and interrupt handling
Detailed Changes
langgraph.constants.Interrupt
- Added new
Interruptdataclass to represent structured interruption events with awhenfield ("before", "during", "after") and an optionalvalue - Added
CONFIG_KEY_TASK_IDconstant for tracking task identifiers
langgraph.errors.GraphInterrupt
- Enhanced to store a list of
Interruptobjects, providing detailed information about interruption events - Improved distinction between regular errors and intentional interrupts during execution
langgraph.errors.NodeInterrupt
- Added new exception class allowing nodes to signal interruption during execution
- Simplifies raising "during" interrupts from within node logic
langgraph.pregel.algo.should_interrupt
- Changed return type from boolean to list of executable tasks that should be interrupted
- Provides more precise control over which tasks get interrupted while maintaining the same criteria
langgraph.pregel.PregelTask
- Added
interruptsfield to track interruption events associated with a task - Enhances visibility of interruption state for debugging and flow control purposes
langgraph.pregel execution
- Fixed issues with interrupt propagation between nested graphs
- Improved checkpoint handling during interrupts
- Added proper copying of channel versions to avoid unintended mutations
- Fixed step numbering in update operations
- Made execution more robust by properly tracking all futures