Replies: 2 comments 1 reply
-
Thanks for reporting -- found the issue, will fix up in the next patch release. In the meantime, you can fix it by doing this: builder.add_conditional_edges("writer_assistant", tools_condition, path_map=["tools", "__end__"]) |
Beta Was this translation helpful? Give feedback.
1 reply
-
@rugrill use like this, it should work
|
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.
-
Hi there,
I'm using the tools_condition from langgraph.prebuild to decide in a conditional edge whether to call a tool or go to the end node. So I initialised a ToolNode, also from the langgraph.prebuild library. However, the source node of the conditional node has a conditional node not only to the ToolNode as expected, but also to every other node in the graph.
In Langgraph Studio or a Mermaid diagram this looks like this

I'm expecting a graph more like this:

Apart from the overhead of the edges, the graph works fine and like indendet. I'm just curious how to get a cleaner graph.
How does the prebuild tools_condition function work in detail? From my understanding the function should only route to tool nodes or the end node.
I've also worked with a dictionary to map to the nodes I want, then I get key errors for the tools and end nodes.
graph.add_conditional_edges("node_a", routing_function, {True: "tools", False: "__end__"})}
This is my graph in code:
The versions I'm using:
langchain==0.3.7
langchain-community==0.3.7
langchain-core==0.3.18
langgraph==0.2.48
langgraph-checkpoint==2.0.4
langgraph-sdk==0.1.36
langsmith==0.1.143
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions