How to route to a specific node based on tool return in LangGraph #5113
Unanswered
nimishdm-airindia
asked this question in
Q&A
Replies: 1 comment
-
Hi, have you solved your problem? I have a similar problem with the usage of the conditional edge. Can we use both the "goto" command and a conditional edge at the same time? Since both of them are used to route to the next node. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm working on a chatbot using LangGraph, and I need to implement proper routing after tool execution. My setup uses a state graph with conditional edges, and I want to route to a specific node if the tool returns a goto command, otherwise route back to the main processing node.
Here's my current approach:
I need to modify this to check if the last tool call returned a Command with a goto field, and route accordingly.
Here's the relevant part of my graph setup code:
For example, one of my tools returns a Command with a goto field that should end the flow:
How can I properly implement route_tools_to_node to check if the most recent tool execution returned a Command with a goto field, and route to that node instead of always returning to the main processing node?
Beta Was this translation helpful? Give feedback.
All reactions