[GH-ISSUE #2378] [langgraph]: Does LangGraph support using HITL within subgraphs? #293

Open
opened 2026-02-17 17:19:34 -05:00 by yindo · 0 comments
Owner

Originally created by @qq745639151 on GitHub (Jan 26, 2026).
Original GitHub issue: https://github.com/langchain-ai/docs/issues/2378

Type of issue

question

Language

Python

Description

I tried to use the interrupt in sub graph.but it doesn't work


from typing_extensions import TypedDict
from langgraph.graph.state import StateGraph, START
from langgraph.types import interrupt


class SubgraphState(TypedDict):
    bar: str
    node_2: str

# Subgraph

def subgraph_node_1(state: SubgraphState):
    print(state["bar"])
    return {"bar": "hi! " + state["bar"]}

def subgraph_node_2(state: SubgraphState):
    user_answer = interrupt({
        "question": "continue"
    })
    if user_answer == "Y":
        print(user_answer["question"])
    else:
        print("this time in loop is deprecated")


subgraph_builder = StateGraph(SubgraphState)
subgraph_builder.add_node(subgraph_node_1)
subgraph_builder.add_node(subgraph_node_2)
subgraph_builder.add_edge(START, "subgraph_node_1")
subgraph_builder.add_edge(START, "subgraph_node_2")
subgraph = subgraph_builder.compile()

# Parent graph

class State(TypedDict):
    foo: str

def call_subgraph(state: State):
    # Transform the state to the subgraph state
    for i in range(1,10):
        subgraph_output = subgraph.invoke({"bar": f"{state["foo"]}_{i}"})
        if subgraph_output["__interrupt__"]:
            print(subgraph_output["__interrupt__"])
    # Transform response back to the parent state
    return {"foo": subgraph_output["bar"]}

builder = StateGraph(State)
builder.add_node("node_1", call_subgraph)
builder.add_edge(START, "node_1")
graph = builder.compile()
graph.invoke({"foo": "bar"})
Originally created by @qq745639151 on GitHub (Jan 26, 2026). Original GitHub issue: https://github.com/langchain-ai/docs/issues/2378 ### Type of issue question ### Language Python ### Description I tried to use the interrupt in sub graph.but it doesn't work ```python from typing_extensions import TypedDict from langgraph.graph.state import StateGraph, START from langgraph.types import interrupt class SubgraphState(TypedDict): bar: str node_2: str # Subgraph def subgraph_node_1(state: SubgraphState): print(state["bar"]) return {"bar": "hi! " + state["bar"]} def subgraph_node_2(state: SubgraphState): user_answer = interrupt({ "question": "continue" }) if user_answer == "Y": print(user_answer["question"]) else: print("this time in loop is deprecated") subgraph_builder = StateGraph(SubgraphState) subgraph_builder.add_node(subgraph_node_1) subgraph_builder.add_node(subgraph_node_2) subgraph_builder.add_edge(START, "subgraph_node_1") subgraph_builder.add_edge(START, "subgraph_node_2") subgraph = subgraph_builder.compile() # Parent graph class State(TypedDict): foo: str def call_subgraph(state: State): # Transform the state to the subgraph state for i in range(1,10): subgraph_output = subgraph.invoke({"bar": f"{state["foo"]}_{i}"}) if subgraph_output["__interrupt__"]: print(subgraph_output["__interrupt__"]) # Transform response back to the parent state return {"foo": subgraph_output["bar"]} builder = StateGraph(State) builder.add_node("node_1", call_subgraph) builder.add_edge(START, "node_1") graph = builder.compile() graph.invoke({"foo": "bar"}) ```
yindo added the langgraphexternal labels 2026-02-17 17:19:34 -05:00
yindo changed title from [langgraph]: Does LangGraph support using HITL within subgraphs? to [GH-ISSUE #2378] [langgraph]: Does LangGraph support using HITL within subgraphs? 2026-06-05 17:26:08 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/docs#293