[GH-ISSUE #1187] Docs Interrupt Examples do not work #164

Open
opened 2026-02-17 17:19:19 -05:00 by yindo · 1 comment
Owner

Originally created by @SammyAgrawal on GitHub (Oct 29, 2025).
Original GitHub issue: https://github.com/langchain-ai/docs/issues/1187

I am trying to run the example to understand interrupts and human in the loop:

https://docs.langchain.com/oss/python/langgraph/interrupts

But running this code example:

from typing import TypedDict
import uuid
from langgraph.checkpoint.memory import InMemorySaver
from langgraph.constants import START
from langgraph.graph import StateGraph

from langgraph.types import interrupt, Command


class State(TypedDict):
    some_text: str


def human_node(state: State):
    value = interrupt(  
        {
            "text_to_revise": state["some_text"]  
        }
    )
    return {
        "some_text": value  
    }


# Build the graph
graph_builder = StateGraph(State)
graph_builder.add_node("human_node", human_node)
graph_builder.add_edge(START, "human_node")
checkpointer = InMemorySaver()  
graph = graph_builder.compile(checkpointer=checkpointer)
# Pass a thread ID to the graph to run it.
config = {"configurable": {"thread_id": uuid.uuid4()}}
# Run the graph until the interrupt is hit.
result = graph.invoke({"some_text": "original text"}, config=config)


print(result['__interrupt__']) 
# > [
# >    Interrupt(
# >       value={'text_to_revise': 'original text'},
# >       resumable=True,
# >       ns=['human_node:6ce9e64f-edef-fe5d-f7dc-511fa9526960']
# >    )
# > ]
print(result["__interrupt__"])  
# > [Interrupt(value={'text_to_revise': 'original text'}, id='6d7c4048049254c83195429a3659661d')]

print(graph.invoke(Command(resume="Edited text"), config=config)) 
# > {'some_text': 'Edited text'}

Does not work. resu;t does not have an ['__interrupt__'] key so I get thrown: KeyError: 'interrupt'
Result after invoke instead remains {"some_text": "original text"}.

The interrupt object is instead viewable via the state snapshot; after some searching, I found it under list(graph.get_state_history(config))[0].tasks[0].interrupts

Still somewhat confused how to resume, but thought I would point out this example doc not working!

Originally created by @SammyAgrawal on GitHub (Oct 29, 2025). Original GitHub issue: https://github.com/langchain-ai/docs/issues/1187 I am trying to run the example to understand interrupts and human in the loop: https://docs.langchain.com/oss/python/langgraph/interrupts But running this code example: ``` from typing import TypedDict import uuid from langgraph.checkpoint.memory import InMemorySaver from langgraph.constants import START from langgraph.graph import StateGraph from langgraph.types import interrupt, Command class State(TypedDict): some_text: str def human_node(state: State): value = interrupt( { "text_to_revise": state["some_text"] } ) return { "some_text": value } # Build the graph graph_builder = StateGraph(State) graph_builder.add_node("human_node", human_node) graph_builder.add_edge(START, "human_node") checkpointer = InMemorySaver() graph = graph_builder.compile(checkpointer=checkpointer) # Pass a thread ID to the graph to run it. config = {"configurable": {"thread_id": uuid.uuid4()}} # Run the graph until the interrupt is hit. result = graph.invoke({"some_text": "original text"}, config=config) print(result['__interrupt__']) # > [ # > Interrupt( # > value={'text_to_revise': 'original text'}, # > resumable=True, # > ns=['human_node:6ce9e64f-edef-fe5d-f7dc-511fa9526960'] # > ) # > ] print(result["__interrupt__"]) # > [Interrupt(value={'text_to_revise': 'original text'}, id='6d7c4048049254c83195429a3659661d')] print(graph.invoke(Command(resume="Edited text"), config=config)) # > {'some_text': 'Edited text'} ``` Does not work. resu;t does not have an `['__interrupt__']` key so I get thrown: KeyError: '__interrupt__' Result after invoke instead remains `{"some_text": "original text"}`. The interrupt object is instead viewable via the state snapshot; after some searching, I found it under `list(graph.get_state_history(config))[0].tasks[0].interrupts` Still somewhat confused how to resume, but thought I would point out this example doc not working!
yindo added the external label 2026-02-17 17:19:19 -05:00
Author
Owner

@SammyAgrawal commented on GitHub (Oct 29, 2025):

Not sure again what my issue is, but I notice when doing graph.stream instead of invoke, the __interrupt__ field does not show up if I specify a stream_mode, but does if I leave it as default

@SammyAgrawal commented on GitHub (Oct 29, 2025): Not sure again what my issue is, but I notice when doing `graph.stream` instead of invoke, the `__interrupt__` field does not show up if I specify a stream_mode, but does if I leave it as default
yindo changed title from Docs Interrupt Examples do not work to [GH-ISSUE #1187] Docs Interrupt Examples do not work 2026-06-05 17:25:24 -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#164