Tools and Agents: Giving a Chain the Ability to Act
Everything so far produces text. A LangChain tool is a Python function wrapped so a model can request it be called, and an agent is a chain that repeatedly decides which tool (if any) to call, based on the model's own reasoning, closing the loop between "the model wants to act" and "code actually executes that action."
Defining a tool
The @tool decorator turns a normal, type-annotated function into something LangChain can describe to a model automatically, the function's docstring becomes the tool's description, exactly what the model reads to decide when this tool is relevant, a vague docstring produces a model that doesn't know when to reach for the tool.
Binding tools to a model
This needs a real API key, so it's read-only here. .bind_tools() returns a new model that, when it decides a tool is useful, responds with a tool_calls list instead of (or alongside) plain text, exactly like the raw function-calling mechanics from the AI Agent course, LangChain just standardizes the description and binding step.
The agent loop
Read-only, needs a real model. AgentExecutor is the loop: call the model, check for tool_calls, execute any requested tools, feed the results back, and repeat until the model responds with a final answer instead of another tool call, the exact same feedback loop from the AI Agent course's run_agent(), just packaged as a reusable class.
NOTE
A tool with a bad or missing description is invisible to the model in practice, even if the code works perfectly, the model can only decide to use a tool based on what it's told the tool does.