This article is published in English.
What LangChain Actually Buys You Beyond Raw Tool Calling
Hand-rolled tool loops teach the machinery; LangChain moves schemas, history, and agent orchestration behind abstractions so product logic stays in focus.
AI apps can call an LLM API directly and own every detail. That path has a real upside: the control flow is visible. It also has a cost. As soon as the product grows past a single chat turn, a lot of code appears that is not really product logic.
Typical plumbing includes:
- Defining tools and schemas
- Sending tools to the model
- Handling tool-call responses
- Executing the requested functions
- Feeding tool results back
- Keeping conversation history
- Coordinating multiple tool calls
- Driving the model↔tool loop
Those steps are excellent for learning. In a shipping app, repeating them by hand becomes the job.
Frameworks such as LangChain exist to absorb that repetition.
The cost of doing everything by hand
Picture a tiny calculator tool. Without a framework the path looks roughly like:
User
↓
LLM API
↓
LLM requests calculator
↓
Our code detects the request
↓
Our code executes calculator()
↓
Our code sends the result back
↓
LLM generates the final answer
One tool stays manageable. Twenty tools, several models, durable chat state, retries, and branching agent workflows turn “simple product logic” into an orchestration project.
Abstractions exist because that machinery grows faster than the feature list.
What LangChain contributes
LangChain supplies shared shapes for models, tools, messages, and agent runtimes. Instead of wiring every hop, describe capabilities and let the framework run much of the boilerplate.
Creating a tool
A normal Python function becomes a tool:
from langchain.tools import tool
def calculator(a: float, b: float, operation: str):
"""Perform a mathematical calculation."""
if operation == "add":
return a + b
elif operation == "subtract":
return a - b
elif operation == "multiply":
return a * b
elif operation == "divide":
if b == 0:
return "Cannot divide by zero."
return a / b
return "Unknown operation."
The calculator body remains application logic. LangChain only wraps it so an LLM can request it.
Connecting the tool to a model
from langchain_google_genai import ChatGoogleGenerativeAI
model = ChatGoogleGenerativeAI(
model="gemini-3.5-flash-lite"
)
model_with_tools = model.bind_tools([calculator])
Then invoke:
response = model_with_tools.invoke(
"What is 2 + 6?"
)
The model may answer with a structured tool request such as:
calculator(
a=2,
b=6,
operation="add"
)
bind_tools() does not run the calculator. It advertises availability: the model may ask for the tool when needed.
Where the abstraction shows up
Manually, the engineer owns a long pipeline:
Create function
↓
Create tool schema
↓
Send schema to LLM
↓
Receive tool call
↓
Extract arguments
↓
Execute function
↓
Create tool result
↓
Send result back to LLM
↓
Check if another tool call is needed
↓
Repeat
With LangChain, much of that pipeline lives in the agent runtime. Attention shifts to:
What capability does my application need?
↓
Define the tool
↓
Give it to the model
↓
Build the application
Complexity did not vanish — it moved behind a boundary.
What is actually gained
LangChain does not invent tool calling; raw APIs already support it. The win is not reinventing schemas, loops, and history handling on every feature. Time goes to product questions instead:
- What should the assistant be able to do?
- Which tools belong in scope?
- What happens when a tool fails?
- How should the rest of the app react?
- Which business rules must stay hard-coded?
Should every project use a framework?
Not always. Hand-rolled tool calling is still the best teacher. Walking the loop once:
LLM
↓
Tool call
↓
Application
↓
Tool execution
↓
Tool result
↓
LLM
makes later framework behavior less mysterious. Using an abstraction without knowing the problem it solves makes debugging painful.
A durable habit: learn the machinery first, then adopt abstractions so the machinery is not rewritten for every ticket. Teams that skip the first step often treat LangChain as magic and stall when a tool schema or retry policy misbehaves. Teams that keep both skills move faster without losing the ability to drop to the metal when a production incident demands it.