LangChain & LangGraph for AI Agents
Back to Agent Foundations & LCEL Composition

Tools, Toolkits, and Structured Function Binding

The @tool decorator and bind_tools API. The foundation for agentic behavior in LangChain. FIND_VIDEO: search 'langchain tools tool calling tutorial' — recommended channel: LangChain / Sam Witteveen / Greg Kamradt. Aim for 11 min or under.

19 minutesVideo LessonPDF notes
🎯 Free Guest Mode: You are learning for free. Sign in to save your completion progress and quiz answers.
Loading progress...

Key moments

  1. AI Agent Fundamentals — Explains how tools bridge model knowledge cutoffs and capability gaps.
  2. Agent Architecture and Integration — Traces how LLM orchestrators route user queries to external services.
  3. Tool Calling Mechanics — Clarifies the execution boundary between model argument generation and client-side execution.
  4. Defining Tools with Pydantic — Demonstrates creating arithmetic tools with custom Pydantic validation schemas.
  5. Binding Tools and Output Inspection — Binds tools to ChatOpenAI and inspects structured tool_calls in AIMessage responses.
PDF notes

Frequently asked questions

Does the LLM run my tool code directly on OpenAI's servers?

No. The LLM only generates tool names and parameter values in a structured JSON payload, leaving code execution entirely to your local application runtime.

Why is the function docstring necessary when using @tool?

The LLM uses the docstring as the natural language description to determine whether a given tool matches the user's intent.

What happens if the LLM generates arguments that fail Pydantic validation?

LangChain raises a validation error on the client side before the function executes, preventing malformed inputs from reaching your core logic.

How was this lesson?

Your feedback helps us refine explanations and catch bugs.