A node for executing tools in LangGraph workflows.
Handles tool execution patterns including function calls, state injection, persistent storage, and control flow. Manages parallel execution, error handling.
Use ToolNode when building custom workflows that require fine-grained control over
tool execution—for example, custom routing logic, specialized error handling, or
non-standard agent architectures.
For standard ReAct-style agents, use create_agent
instead. It uses ToolNode internally with sensible defaults for the agent loop,
conditional routing, and error handling.
Creates an agent graph that calls tools in a loop until a stopping condition is met.
This function is deprecated in favor of
create_agent from the langchain
package, which provides an equivalent agent factory with a flexible
middleware system. For migration guidance, see
Migrating from LangGraph v0.