Week 02: LangChain & Agentic Foundations
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
| Day | Time | Focus |
|---|---|---|
| Saturday | 8:00 - 11:00 PM WAT | LangChain Architecture & Tool Design |
| Sunday | 8:00 - 11:00 PM WAT | Agent 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 ChainsTool 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 PydanticAgent 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 IterationError Handling & Retries
OutputParser errors, tool failures, retry with exponential backoff, fallback chains. Building agents that fail gracefully instead of crashing.
Error Handling Retries FallbacksWeb 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 ToolsWeekly 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
| File | Purpose |
|---|---|
main.py | CLI entry point |
tools.py | Tool definitions |
agent.py | Agent setup & execution |
prompts.py | System & tool prompts |
report.py | Report 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.
- Complete the research agent build — push your code to the bootcamp repo
- Add a 4th custom tool of your choice — get creative with what your agent can do
- Compare AgentExecutor vs create_react_agent — document the differences in behavior and output
- Write a 1-page reflection on agent failure modes — what breaks and why? Share in the WhatsApp group