These docs are for the v1.0 alpha release of LangGraph. For the latest stable docs, please see the old sites: LangGraph Python | LangGraph JavaScript
Tool calling
Tool calling is typically conditional. Based on the user input and available tools, the model may choose to issue a tool call request. This request is returned in anAIMessage
object, which includes a tool_calls
field that specifies the tool name and input arguments:
Prebuilt tools
LangChain provides prebuilt tool integrations for common external systems including APIs, databases, file systems, and web data. Browse the integrations directory for available tools. Common categories:- Search: Bing, SerpAPI, Tavily
- Code execution: Python REPL, Node.js REPL
- Databases: SQL, MongoDB, Redis
- Web data: Scraping and browsing
- APIs: OpenWeatherMap, NewsAPI, etc.
Custom tools
You can define custom tools using thetool
function. For example:
Tool execution
While the model determines when to call a tool, execution of the tool call must be handled by a runtime component. LangGraph provides prebuilt components for this:- ToolNode: A prebuilt node that executes tools.
createReactAgent
: Constructs a full agent that manages tool calling automatically.