langgraph 0.2.5
Summary of Changes
- Added support for preserving task errors in state snapshots, allowing better visibility into failures
- Enhanced state history tracking with proper step numbering and task details
- Simplified the managed values interface by removing the unnecessary task parameter
- Improved error handling during graph execution with better mechanisms to save errors to checkpoints
- Added new error constant for more consistent error tracking across the system
Detailed Changes
langgraph.constants.ERROR
- Added new constant
ERROR = "__error__"for tracking and propagating errors in graph execution - Added the ERROR constant to the RESERVED set of special keys
langgraph.managed.base.ManagedValue
- Simplified interface by removing the task parameter from the
__call__method - Changed signature from
__call__(self, step: int, task: PregelTaskDescription) -> Vto__call__(self, step: int) -> V
langgraph.managed.is_last_step.IsLastStepManager
- Updated to match the simplified ManagedValue interface by removing the task parameter
- Changed signature from
__call__(self, step: int, task: PregelExecutableTask)to__call__(self, step: int)
langgraph.pregel.types.StateSnapshot
- Enhanced with additional field
tasksto include information about tasks with errors - Added better typing and documentation for fields
- Improved representation of task state in snapshots
langgraph.pregel.types.PregelTask
- Replaced
PregelTaskDescriptionwith enhancedPregelTaskclass - Added
idfield to uniquely identify tasks - Added optional
errorfield to track exceptions that occurred during task execution
langgraph.pregel.algo
- Improved task preparation logic in
prepare_next_tasksfunction - Made task ID generation more consistent for both execution and non-execution contexts
- Updated managed value handling to use simplified interface without task parameter
langgraph.pregel.debug
- Added
tasks_w_writesfunction to associate tasks with their writes and any errors - Enhanced checkpoint debug output to include task errors
- Improved visibility of task execution state in debug information
langgraph.pregel.init.Pregel
- Enhanced
get_stateandaget_statemethods to include proper step numbers and task information - Added tracking of task errors in state snapshots
- Added
_exceptionand_should_stop_othershelper functions for better error handling - Changed error handling in task execution to save errors to the checkpointer
- Fixed debug output to use the passed parameter instead of instance variable
langgraph.pregel.loop.PregelLoop
- Updated to skip ERROR entries when processing pending writes
- Improved handling of error cases in the task execution flow