Principle:Langchain ai Langchain Tool Invocation With Tools
| Knowledge Sources | |
|---|---|
| Domains | NLP, Tool_Use, Agentic_AI |
| Last Updated | 2026-02-11 00:00 GMT |
Overview
The invocation of a tool-bound chat model that produces an AIMessage containing structured tool call requests alongside or instead of text content.
Description
When a model with bound tools is invoked, the LLM can decide to call one or more tools instead of generating text. The response AIMessage contains a tool_calls list with structured ToolCall objects, each specifying the tool name, parsed arguments, and a unique call ID. The model may also include text content alongside tool calls, or make no tool calls at all depending on the input.
Usage
Invoke a tool-bound model when implementing agent loops or any workflow where the model should decide whether and how to use available tools.
Theoretical Basis
# Abstract algorithm (not real code)
response = model_with_tools.invoke(messages)
if response.tool_calls:
for tool_call in response.tool_calls:
execute(tool_call.name, tool_call.args)
else:
return response.content # Direct text response