-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Graph Display not working for over 3 levels nested graph and when more than one node #2607
Comments
parentImage = parentGraph.get_graph(xray=2).draw_mermaid_png() True is actually 1, since bool is a subclass of int. |
Yes I did try it, Less than 3 it doesn't throw error. But that doesn't give the full depth in the image if there are over 3 levels and the create_react_agent is used in the 3rd level. Since the default is False, I assumed True is to display all levels and I would expect an option to display all levels instead of hardcoding a number like that. |
^ This is actually incorrect for The |
Hi, @kmprasad4u . Sorry for the trouble. @vbarda is right. When I looked at your example, I didn't pay attention to what was written above. I later noticed the content of your In this situation, it can work. def testingSubSubGraphNode2(state):
return {"messages": []} In this situation, it will throw an error. executor_agent = create_react_agent(llm, [get_weather])
def testingSubSubGraphNode2(state):
executor_agent.invoke({"messages": "Hi, how are you?"})
return {"messages": []} Even if you directly assign the global variable of executor_agent = create_react_agent(llm, [get_weather])
def testingSubSubGraphNode2(state):
a = executor_agent
return {"messages": []} However, if I create it within the function instead of get it directly from the global variable, it works properly. def testingSubSubGraphNode2(state):
a = create_react_agent(llm, [get_weather])
return {"messages": []} I later determined that the issue is likely with I'm not sure if a graph that isn't explicitly declared as a Node, but is just executed within a node's action function, should appear in Mermaid. |
Even, I assumed that agent.invoke shouldn't have been displayed in the image when it was implicitly called inside the node function. I also noted that If I have a function call to get the agent and then use it, it just worked as I had expected without the react agent in the image and didn't throw error. But since it was working fine with smaller graphs, I thought it should be working for higher depths as well. Anyways, I initially thought the error was due to create_react_agent. I was also in need of interrupting one tool call alone which i believe create_react_agent didn't support. Hence I created my own simple version of the react agent, and the same error is present in that as well. Based on your comment, I tried to not use invoke from within the node and instead used the react agent as the node itself, and still the same issue is present. Then I went ahead and simplified it by removing all LLM calls and Tools. Just having two simple nodes in 4th level is causing error. Having just one node alone is not throwing error. I have updated the simplified code in my first post. |
Checked other resources
Example Code
Error Message and Stack Trace (if applicable)
Description
I am trying to create nested graphs and using 2 nodes in the fourth level. But when displaying the graph, i get error message. I have tried to simplify the code as much as possible to illustrate the problem.
This was started as an issue with create_react_agent, but later observed to be different issue altogether and the example code is updated with more simplified version without using create_react_agent.
System Info
langchain==0.3.7
langchain-core==0.3.18
langchain-community==0.3.7
langgraph==0.2.48
The text was updated successfully, but these errors were encountered: