Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to add Interrupts to nodes within subgraphs #197

Open
hwchase17 opened this issue Nov 26, 2024 · 2 comments
Open

Ability to add Interrupts to nodes within subgraphs #197

hwchase17 opened this issue Nov 26, 2024 · 2 comments

Comments

@hwchase17
Copy link
Contributor

Ability to add Interrupts to nodes within subgraphs
Really loving using Interrupts for debugging and testing up to a certain node!
I just realized when I converted a group of nodes into a subgraph that the interrupts can only occur on the top-level nodes or the subgraph node itself, but not nodes within the subgraph. I think this was mentioned as a limitation when subgraph support was added to Studio

@bforbanks
Copy link

I have also experienced this.
This migth be related to #190

@anmol-aidora
Copy link

Langgraph Studio not working with subgraphs

We have built a graph which also has subgraphs in it. The subgraphs contain nodes at which they interrupt. When we run it in Langgraph Studio, we are facing a major roadblock. When the subgraph interrupts, the As Node option becomes empty (instead of indicating the node it should resume execution from).

When I try to resume execution, I pass human message into the messages state variable, but the graph doesn't resume.

I have tried three approaches when passing the message:
Letting the As Node empty. -> Graph starts from start node (of the main graph), which is not desired.
Setting the subgraph node name (subgraph_3:__start__) in As Node.
Setting the exact node inside the subgraph from which I know it should resume from (subgraph_3:human_input_subgraph_3) in As Node.

I am attaching the respective error messages below:
Case 2:

langgraph-api-1       | error | Bad Request Error | Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
    await app(scope, receive, sender)
  File "/api/langgraph_api/route.py", line 32, in app
  File "/usr/local/lib/python3.12/site-packages/langgraph_storage/retry.py", line 34, in wrapper
    return await func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/api/langgraph_api/api/threads.py", line 137, in update_thread_state
  File "/usr/local/lib/python3.12/site-packages/langgraph_storage/ops.py", line 562, in post
    next_config = await graph.aupdate_state(
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/langgraph/pregel/__init__.py", line 1261, in aupdate_state
    raise InvalidUpdateError(f"Node {as_node} does not exist")
langgraph.errors.InvalidUpdateError: Node subgraph_3:__start__ does not exist

Case 3:

langgraph-api-1       | error | Bad Request Error | Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
    await app(scope, receive, sender)
  File "/api/langgraph_api/route.py", line 32, in app
  File "/usr/local/lib/python3.12/site-packages/langgraph_storage/retry.py", line 34, in wrapper
    return await func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/api/langgraph_api/api/threads.py", line 137, in update_thread_state
  File "/usr/local/lib/python3.12/site-packages/langgraph_storage/ops.py", line 562, in post
    next_config = await graph.aupdate_state(
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/langgraph/pregel/__init__.py", line 1261, in aupdate_state
    raise InvalidUpdateError(f"Node {as_node} does not exist")
langgraph.errors.InvalidUpdateError: Node subgraph_3:human_input_subgraph_3 does not exist

It seems like the UI is directly passing the node name as subgraph_3:human_input_subgraph_3. But the node of the subgraph has a unique name human_input_subgraph_3. The node ID being passed to the backend is not correct.

By the way, I am able to resume from the exact subgraph node in backend (using the RemoteGraph object/ doing graph.stream directly by following this langgraph doc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants