You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I included a self-contained, minimal example that demonstrates the issue INCLUDING all the relevant imports. The code run AS IS to reproduce the issue.
Example Code
# graphsfromtypingimportTypedDictfromlanggraph.graphimportStateGraph, START, ENDfromapp.ai.agent.baseimportBaseAgentfromlanggraph.typesimportCheckpointer, interruptfromlanggraph.checkpoint.memoryimportMemorySaverclassAgentState(TypedDict):
input: strdefnode_1(state: AgentState):
result=interrupt("interrupt node 1")
print("result", result)
defnode_2(state: AgentState):
result=interrupt("interrupt node 2")
print("result", result)
sub_graph=StateGraph(AgentState).add_node("node_1", node_1).add_node("node_2", node_2).add_edge(START, "node_1").add_edge("node_1", "node_2").add_edge("node_2", END).compile()
definvoke_sub_agent(state: AgentState):
sub_graph.invoke(state)
parent_agent=StateGraph(AgentState).add_node("invoke_sub_agent", invoke_sub_agent).add_edge(START, "invoke_sub_agent").add_edge("invoke_sub_agent", END).compile(checkpointer=MemorySaver())
# invoking the parent graphfromapp.ai.agent.testimportparent_agentimportuuidthread_id=uuid.uuid4()
parent_agent.invoke({"input": "test"}, config={"configurable": {"thread_id": thread_id}}, subgraphs=True)
# then the graph get interrupted by the first interrupt as expected# resume from the first interruptparent_agent.invoke(Command(resume=True), config={"configurable": {"thread_id": thread_id}}, subgraphs=True)
# then not just first interrupt get passed, the second interrupt also get passed with same resume value printed out.Thecodeissupposedtobeinterruptedtwiceandwaitforhumaninputfortwice
Error Message and Stack Trace (if applicable)
No response
Description
As described in the Example code section. I have
parent_graph -> subgraph (two interrupts)
when invoke parent_graph, the parent_graph stops at the first subgraph interrupt as expected. Then I resume, the expected behavior is the graph should pass the first interrupt and stop at the second interrupt, however, both interrupt passed. The second interrupt returns the value I passed for resuming the first interrupt instead of raising a new interrupt.
System Info
langgraph==0.2.60
The text was updated successfully, but these errors were encountered:
I can replicate this issue; it seems to not work properly in the subgraph.
I added some extra interrupt commands in the parent graph, and it appears to function normally there.
However, in the subgraph, as described in this issue, it references the previous resume value.
Checked other resources
Example Code
Error Message and Stack Trace (if applicable)
No response
Description
As described in the Example code section. I have
parent_graph -> subgraph (two interrupts)
when invoke parent_graph, the parent_graph stops at the first subgraph interrupt as expected. Then I resume, the expected behavior is the graph should pass the first interrupt and stop at the second interrupt, however, both interrupt passed. The second interrupt returns the value I passed for resuming the first interrupt instead of raising a new interrupt.
System Info
langgraph==0.2.60
The text was updated successfully, but these errors were encountered: