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.
ToolCall with additional context for graph state.
This is an internal data structure meant to help the ToolNode accept
tool calls with additional context (e.g. state) when dispatched using the
Send API.
The Send API is used in create_agent to distribute tool calls in parallel and support human-in-the-loop workflows where graph execution may be paused for an indefinite time.
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.
The state of the agent.
The state of the agent.
The state of the agent with a structured response.
The state of the agent with a structured response.