Skip to content

0.2.37

Choose a tag to compare

@github-actions github-actions released this 15 Oct 00:40

langgraph 0.2.37

Summary of Changes

  • Added new RemainingSteps managed value to get the number of remaining steps in a loop
  • Improved managed values architecture with the introduction of LoopProtocol interface
  • Enhanced Chat Agent Executor with better termination conditions using remaining steps
  • Improved checkpointing in nested loops with proper parent configuration propagation

Detailed Changes

langgraph.managed.is_last_step.RemainingSteps

  • Added new RemainingSteps managed value that returns the number of remaining steps in a loop execution
  • Exposed through langgraph.managed module exports for easy access
  • Can be used alongside IsLastStep for better loop control

langgraph.types.LoopProtocol

  • Added new protocol class that provides context for loop execution
  • Contains fields for config, store, stream, step, and stop information
  • Makes managed values and channels more aware of loop execution context
  • Simplified accessing step and recursion information across the codebase

langgraph.managed.base.ManagedValue

  • Refactored to use LoopProtocol instead of raw RunnableConfig
  • Changed __call__ signature to no longer require a step parameter
  • Simplified managed value implementation by accessing loop context directly

langgraph.prebuilt.chat_agent_executor

  • Enhanced agent executor with support for both IsLastStep and RemainingSteps
  • Improved termination logic to handle different conditions:
    • Last step with tool calls
    • Low remaining steps with direct-return tools
    • Very low remaining steps with any tool calls
  • Provides more nuanced control over when to stop agent execution

langgraph.pregel.loop.PregelLoop

  • Updated to extend LoopProtocol for consistent interface
  • Improved checkpoint metadata handling with step and parent information
  • Better management of checkpoint configuration in nested loops

langgraph.utils.config.patch_checkpoint_map

  • Enhanced to properly handle None configs
  • Improved proper config propagation through nested graph invocations