how to send details from one node to multiple nodes in parallel #583
-
In LangGraph we add nodes and edges so that flow should be directed from one particular node to another particular node. Conditional edge takes the decision that which node to direct. Is it possible in LangGraph to direct details from one node to multiple nodes in parallel? how we can do it? code
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Hello! It looks like you're almost there - the thing you'd want to make sure you handle well is that when the updates are returned from nodes 2 and 3 in your graph, the results don't overwrite each other (if they're writing to the same state key). So you typically either want to write to different keys or to make sure that the key in the state is annotated with a reducer that will handle the updates correctly. You can read more about branching here: https://langchain-ai.github.io/langgraph/how-tos/branching/ A related API is the "Send" API which makes it easier to do map-reduce like work (where each parallel branch can see a different view/copy of the state), but this doesn't seem necessary for your intent. |
Beta Was this translation helpful? Give feedback.
-
Hi I have used SEND class but I think it might have a problem with tool, when a different node sends objects to a node with a tool this raises an error |
Beta Was this translation helpful? Give feedback.
Does this help? (from the link above)
The state is updated after every step, so by definition, node…