interrupt_before not work #189

Closed
opened 2026-02-20 17:30:56 -05:00 by yindo · 1 comment
Owner

Originally created by @FunnyWolf on GitHub (Aug 14, 2024).

Checked other resources

  • I added a very descriptive title to this issue.
  • I searched the LangGraph/LangChain documentation with the integrated search.
  • I used the GitHub search to find a similar question and didn't find it.
  • I am sure that this is a bug in LangGraph/LangChain rather than my code.
  • I am sure this is better as an issue rather than a GitHub discussion, since this is a LangGraph bug and not a design question.

Example Code

from typing import TypedDict

from langgraph.checkpoint.memory import MemorySaver
from langgraph.graph import StateGraph, START, END


class State(TypedDict):
    input: str
    user_feedback: str


def step_1(state):
    print("---Step 1---")
    pass


def human_feedback(state):
    print("---human_feedback---")
    pass


def step_3(state):
    print("---Step 3---")
    pass


builder = StateGraph(State)
builder.add_node("step_1", step_1)
builder.add_node("human_feedback", human_feedback)
builder.add_node("step_3", step_3)
builder.add_edge(START, "step_1")
builder.add_edge("step_1", "human_feedback")
builder.add_edge("human_feedback", "step_3")
builder.add_edge("step_3", END)

# Set up memory
memory = MemorySaver()

# Add
graph = builder.compile(checkpointer=memory, interrupt_before=["human_feedback"])
# Input
initial_input = {"input": "hello world"}

# Thread
thread = {"configurable": {"thread_id": "1"}}

# Run the graph until the first interruption

for event in graph.stream(initial_input, thread, stream_mode="values"):
    print("---111---")
    print(event)

for event in graph.stream(None, thread, stream_mode="values"):
    print("---222---")
    print(event)

Error Message and Stack Trace (if applicable)

No response

Description

output should be

---111---
{'input': 'hello world'}
---Step 1---
---222---
---human_feedback---
---Step 3---

real output

---111---
{'input': 'hello world'}
---Step 1---
---human_feedback---
---Step 3---

if we delete

for event in graph.stream(None, thread, stream_mode="values"):
    print("---222---")
    print(event)

output is

---111---
{'input': 'hello world'}
---Step 1---

which is work as except

System Info

langgraph==0.2.3
langgraph-checkpoint==1.0.2
langgraph-checkpoint-sqlite==1.0.0

Originally created by @FunnyWolf on GitHub (Aug 14, 2024). ### Checked other resources - [X] I added a very descriptive title to this issue. - [X] I searched the [LangGraph](https://langchain-ai.github.io/langgraph/)/LangChain documentation with the integrated search. - [X] I used the GitHub search to find a similar question and didn't find it. - [X] I am sure that this is a bug in LangGraph/LangChain rather than my code. - [X] I am sure this is better as an issue [rather than a GitHub discussion](https://github.com/langchain-ai/langgraph/discussions/new/choose), since this is a LangGraph bug and not a design question. ### Example Code ```python from typing import TypedDict from langgraph.checkpoint.memory import MemorySaver from langgraph.graph import StateGraph, START, END class State(TypedDict): input: str user_feedback: str def step_1(state): print("---Step 1---") pass def human_feedback(state): print("---human_feedback---") pass def step_3(state): print("---Step 3---") pass builder = StateGraph(State) builder.add_node("step_1", step_1) builder.add_node("human_feedback", human_feedback) builder.add_node("step_3", step_3) builder.add_edge(START, "step_1") builder.add_edge("step_1", "human_feedback") builder.add_edge("human_feedback", "step_3") builder.add_edge("step_3", END) # Set up memory memory = MemorySaver() # Add graph = builder.compile(checkpointer=memory, interrupt_before=["human_feedback"]) # Input initial_input = {"input": "hello world"} # Thread thread = {"configurable": {"thread_id": "1"}} # Run the graph until the first interruption for event in graph.stream(initial_input, thread, stream_mode="values"): print("---111---") print(event) for event in graph.stream(None, thread, stream_mode="values"): print("---222---") print(event) ``` ### Error Message and Stack Trace (if applicable) _No response_ ### Description output should be ``` ---111--- {'input': 'hello world'} ---Step 1--- ---222--- ---human_feedback--- ---Step 3--- ``` real output ``` ---111--- {'input': 'hello world'} ---Step 1--- ---human_feedback--- ---Step 3--- ``` if we delete ``` for event in graph.stream(None, thread, stream_mode="values"): print("---222---") print(event) ``` output is ``` ---111--- {'input': 'hello world'} ---Step 1--- ``` which is work as except ### System Info langgraph==0.2.3 langgraph-checkpoint==1.0.2 langgraph-checkpoint-sqlite==1.0.0
yindo closed this issue 2026-02-20 17:30:56 -05:00
Author
Owner

@gbaian10 commented on GitHub (Aug 14, 2024):

for event in graph.stream(initial_input, thread):
    print("---111---")
    print(event)

for event in graph.stream(None, thread):
    print("---222---")
    print(event)

If you need to observe the difference between values ​​and updates in stream_mode, add a return value in node_action

@gbaian10 commented on GitHub (Aug 14, 2024): ```py for event in graph.stream(initial_input, thread): print("---111---") print(event) for event in graph.stream(None, thread): print("---222---") print(event) ``` If you need to observe the difference between `values` ​​and `updates` in `stream_mode`, add a return value in node_action
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraph#189