LangGraph 1 · Building graphs
Run tools with the prebuilt node
ToolNode runs the tool calls in the last message, and tools_condition routes to it or to the end.
from langgraph.prebuilt import ToolNode, tools_condition
builder.add_node("tools", ToolNode(tools))
builder.add_conditional_edges("chatbot", tools_condition)
builder.add_edge("tools", "chatbot")
Official LangGraph 1 documentation