Week 02: LangChain & Agentic Foundations

Build: Multi-tool research agent that browses, summarizes, and synthesizes
Overview
Topics
Weekly Build
Resources
Homework

What You'll Learn

Build your first real agent. Move beyond wrappers and understand how LangChain chains, agents, and tools actually compose. You'll understand why most agent tutorials break and how to fix them.

Session Schedule

DayTimeFocus
Saturday8:00 - 11:00 PM WATLangChain Architecture & Tool Design
Sunday8:00 - 11:00 PM WATAgent Build Session

Pre-Requisites

  • Week 01 completed
  • Python environment set up
  • OpenAI API key active
  • Familiarity with prompt engineering basics

Topics Covered

LangChain Chains & Runnables

How LCEL works, pipe operator, RunnablePassthrough, composing chains. Understanding the execution model that powers every LangChain application.

LCEL Runnables Chains

Tool Definition & Function Calling

@tool decorator, Pydantic schemas, structured outputs, OpenAI function calling. How to define tools the model can actually use reliably.

@tool Function Calling Pydantic

Agent Executor Internals

How AgentExecutor loops, observation-thought-action cycle, max iterations, early stopping. Understanding what happens under the hood when an agent runs.

AgentExecutor ReAct Loop Iteration

Error Handling & Retries

OutputParser errors, tool failures, retry with exponential backoff, fallback chains. Building agents that fail gracefully instead of crashing.

Error Handling Retries Fallbacks

Web Search, Code & File Tools

DuckDuckGo search, Python REPL, file reader tools, combining multiple tools. Giving your agent the ability to interact with the real world.

Web Search Code Interpreter File Tools

Weekly Build: Multi-Tool Research Agent

Build a research agent that takes a topic, searches the web, reads documents, summarizes findings, and outputs a structured research report.

Architecture

User Query (research topic)
    |
    v
Agent (LangChain AgentExecutor)
    |
    ├── Web Search Tool (DuckDuckGo)
    ├── Document Reader Tool (file/URL)
    ├── Summarizer Tool (LLM chain)
    └── Report Generator (structured output)
    |
    v
Formatted Research Report (JSON/Markdown)

Key Files

FilePurpose
main.pyCLI entry point
tools.pyTool definitions
agent.pyAgent setup & execution
prompts.pySystem & tool prompts
report.pyReport formatting

Resources

Required Reading

  • LangChain Expression Language docs
  • OpenAI Function Calling guide
  • "Building Effective Agents" blog post

Code Repository

Switch to the week-02 branch:

git checkout week-02

Session Recording

Recording will be available within 24 hours after the live session. Check the WhatsApp group for the link.

Homework

Due before Week 3 live session.

  1. Complete the research agent build — push your code to the bootcamp repo
  2. Add a 4th custom tool of your choice — get creative with what your agent can do
  3. Compare AgentExecutor vs create_react_agent — document the differences in behavior and output
  4. Write a 1-page reflection on agent failure modes — what breaks and why? Share in the WhatsApp group