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

Modern LangChain Architecture & Tool-Calling Agents

LangChain has evolved fast. Here's what's current, what's deprecated, and where to put your effort. FIND_VIDEO: search 'langchain 2026 LCEL latest version' — recommended channel: LangChain / Sam Witteveen / James Briggs. Aim for 11 min or under.

21 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. Introduction & Environment Setup — Covers agent fundamentals, SerpAPI search setup, and LangSmith tracing configuration.
  2. Tool Anatomy & Requirements — Explains requirements for tool docstrings, explicit naming, and type annotations for LLM compatibility.
  3. Defining Custom Tools with @tool — Demonstrates converting Python arithmetic functions into StructuredTools and inspecting their Pydantic schemas.
  4. Tool Invocation Mechanics — Details how JSON strings returned by the LLM are parsed and executed as keyword arguments against functions.
  5. Prompt Design & Agent Scratchpad — Walks through building ChatPromptTemplate with placeholders for chat history and the intermediate agent scratchpad.
  6. Agent Assembly & Memory — Combines ChatOpenAI, tool definitions, prompts, and memory via create_tool_calling_agent.
  7. Agent Actions & AgentExecutor Loop — Contrasts AgentAction decision outputs with the full execution loop managed by AgentExecutor.
PDF notes

Frequently asked questions

Why do tools require both type hints and docstrings?

LangChain uses type hints to construct the JSON schema parameter types, while the LLM reads the docstring to understand what the tool does and when to call it.

What is the purpose of the agent_scratchpad?

It holds the sequence of intermediate tool calls and their returned outputs during multi-step reasoning before the model delivers a final answer.

Why must the tools array be passed to both create_tool_calling_agent and AgentExecutor?

The agent requires tools to format schemas for LLM tool binding, while AgentExecutor requires the actual functions to run them during execution.

How does AgentExecutor determine when to stop running?

It continues looping until the agent emits an AgentFinish object instead of an AgentAction request, or until configured iteration limits are met.

How was this lesson?

Your feedback helps us refine explanations and catch bugs.