Difference between langchain.tools.tool_node & langgraph.prebuilt.tool_node?

Hello there!
Why are there two different interpretations of the same class, and why is one of them part of LangChain?

Hi @Sanctious

I see the main difference is that the ToolNode (newer one) from langchain.tools includes ToolRuntime injection. ToolNode (older or legacy one) from langgraph.prebuilt does not have it.

I assume this is a temporary situation when we have two implementations of ToolNode.

I see the main author of the newer is @sydney-runkle - could you say something about this situation Sidney? :slight_smile:

1 Like

Thanks alot !

  • Use langchain.tools.ToolNode when you want to incorporate tools in simpler LangChain chains or agents without complex stateful graph logic.

  • Use langgraph.prebuilt.ToolNode when building complex, stateful, multi-step workflows or agentic applications that require graph-based control flow, persistence, and advanced orchestration features.

2 Likes