[PR #6603] docs(langgraph): clarify interrupt resumption behavior with side effects #5156

Closed
opened 2026-02-20 17:51:18 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langchain-ai/langgraph/pull/6603

State: closed
Merged: No


Description

This PR addresses issue #6577 by clarifying the behavior of interrupt resumption in the functional API. The issue reported unexpected behavior where local variables and side effects were not preserved when resuming after an interrupt.

Root Cause: When resuming after an interrupt, the entire entrypoint function re-executes from the beginning. While task results are cached (so completed tasks don't re-execute), side effects on mutable objects are NOT preserved because the task only executes once.

Solution: Added comprehensive documentation explaining:

  • That the entrypoint re-executes from the beginning on resume
  • That task results are cached, but side effects are not
  • Anti-pattern: relying on side effects (mutating mutable arguments)
  • Correct pattern: using return values to build up state

Changes Made:

  1. Added warning section in docs/docs/concepts/functional_api.md with clear examples
  2. Added test cases demonstrating the correct pattern:
    • test_interrupt_functional_return_values_pattern in test_pregel.py
    • test_interrupt_functional_return_values_pattern in test_pregel_async.py

Issue

Closes #6577

**Original Pull Request:** https://github.com/langchain-ai/langgraph/pull/6603 **State:** closed **Merged:** No --- ## Description This PR addresses issue #6577 by clarifying the behavior of interrupt resumption in the functional API. The issue reported unexpected behavior where local variables and side effects were not preserved when resuming after an interrupt. **Root Cause**: When resuming after an interrupt, the entire entrypoint function re-executes from the beginning. While task results are cached (so completed tasks don't re-execute), side effects on mutable objects are NOT preserved because the task only executes once. **Solution**: Added comprehensive documentation explaining: - That the entrypoint re-executes from the beginning on resume - That task results are cached, but side effects are not - Anti-pattern: relying on side effects (mutating mutable arguments) - Correct pattern: using return values to build up state **Changes Made**: 1. Added warning section in `docs/docs/concepts/functional_api.md` with clear examples 2. Added test cases demonstrating the correct pattern: - `test_interrupt_functional_return_values_pattern` in `test_pregel.py` - `test_interrupt_functional_return_values_pattern` in `test_pregel_async.py` ## Issue Closes #6577
yindo added the pull-request label 2026-02-20 17:51:18 -05:00
yindo closed this issue 2026-02-20 17:51:18 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraph#5156