ToolNode is a built-in LangGraph component that handles tool calls within an agent's workflow.
It works seamlessly with createAgent, offering advanced tool execution control, built
in parallelism, and error handling.
constgetWeather = tool((input) => { if (["sf", "san francisco"].includes(input.location.toLowerCase())) { return"It's 60 degrees and foggy."; } else { return"It's 90 degrees and sunny."; } }, { name:"get_weather", description:"Call to get the current weather.", schema:z.object({ location:z.string().describe("Location to get the weather for."), }), });
ToolNode
is a built-in LangGraph component that handles tool calls within an agent's workflow. It works seamlessly withcreateAgent
, offering advanced tool execution control, built in parallelism, and error handling.Example