Skip to content

0.3.16

Choose a tag to compare

@github-actions github-actions released this 19 Mar 00:48
9533d35

langgraph 0.3.16

Summary of Changes

  • Improved schema coercion with better error handling and type compatibility, increasing default max depth and adding support for set types (#3871)
  • Reduced memory usage by implementing weak references in the pregel execution engine, preventing reference cycles (#3907)
  • Added internal implementation of get_function_nonlocals to reduce external dependencies (#3894)

Detailed Changes

langgraph.graph.schema_utils.SchemaCoercionMapper

  • Increased default max_depth from 5 to 12, allowing deeper nested schema structures
  • Added support for set types in schema coercion
  • Improved type compatibility by handling errors more gracefully
  • Enhanced Pydantic model support for both v1 and v2 with better type hint handling
  • Now returns original values instead of raising exceptions in most type coercion failures
  • Made the mapper cache a module-level variable rather than a class variable
  • Added proper handling of type hints for more accurate schema coercion

langgraph.pregel.Pregel

  • Implemented weak references to prevent reference cycles and reduce memory leaks
  • Improved memory management by using weakref.WeakMethod for runner callbacks
  • Enhanced formatting of conditional assignments for better code readability

langgraph.pregel.runner.PregelRunner

  • Refactored to use weak references for futures, task scheduling and execution
  • Moved callback implementations from nested functions to module-level functions for better organization
  • Separated sync and async call implementations into distinct functions (_call and _acall)
  • Improved error handling during task execution

langgraph.pregel.utils.get_function_nonlocals

  • Added internal implementation of get_function_nonlocals function
  • Implemented AST analysis to determine nonlocal variables accessed by functions
  • Added support for proper handling of attributes and nested function definitions