Tools (in LangChain)
In LangChain, a tool is any capability an agent can call — wrapped in a standard interface so the model knows its name, what it does, and what arguments it takes. LangChain makes defining tools trivial (a decorator on a function) and ships hundreds of prebuilt ones, from web search to SQL. Tools are what let a LangChain agent go beyond text and actually act.
💡 In one line: A LangChain tool wraps a function with a name, description, and argument schema so a model or agent can call it.
What is a Tool in LangChain?
A tool is a function or capability wrapped in LangChain's standard Tool interface: a name, a description, an argument schema, and the underlying function. Because they're standardised, any tool-calling model or agent can use them the same way.
Defining a Tool
The easiest way is the @tool decorator — the docstring becomes the description and the type hints become the schema:
For more control there are the StructuredTool / Tool classes, and a Pydantic args_schema for typed, validated inputs.
Tool Components
- name — the identifier.
- description — the model picks a tool by this, so write it well.
- args_schema — typed parameters.
- function — the code that runs.
Built-in Tools & Toolkits
LangChain ships hundreds of prebuilt tools — web search (Tavily), a Python REPL, calculators, SQL, Requests, Wikipedia, and more. Toolkits group related tools together (for example, a SQL toolkit with several database tools).
Binding Tools to a Model
You give a model access with model.bind_tools([...]), or pass them to create_agent(model, tools=[...]). The model can then emit tool calls when it decides one is needed.
The Tool-Calling Flow
Using Tools with Agents
With create_agent(model, tools), the agent loop — which runs on LangGraph — calls tools automatically each step. Under the hood, a ToolNode executes the requested tools inside the graph and feeds results back.
Best Practices
- Write a clear name and description — they drive tool selection.
- Use a typed
args_schemaand validate inputs. - Keep tools focused; offer a small, well-described set.
- Handle errors inside the tool and return useful messages.
Summary
- A LangChain tool wraps a function with a name, description, and args schema.
- Define one easily with the
@tooldecorator; use classes for more control. - LangChain ships hundreds of built-in tools and toolkits.
- Bind tools to a model or pass them to
create_agent; the model emits calls. - Clear descriptions and typed schemas are what make tool selection reliable.Â