Set up
Runs on your computer. Pick your agent and operating system.
This project does not publish an install method we can turn into a config. Follow the README instead.
README
synced Oct 26, 2026Foundation: Introduction to LangChain - Python
A comprehensive learning repository for building AI agents with LangChain, covering foundational concepts through production-ready multi-agent systems.
📚 Course Overview
This repository contains hands-on Jupyter notebooks and Python scripts for learning LangChain agent development. The course progresses from basic agent creation to advanced multi-agent orchestration with the Model Context Protocol (MCP).
Progress: 100% Complete (23/23 lessons)
🎯 Course Structure
✅ Module 1: Create Agent (Complete - 8/8)
Build foundational knowledge of LangChain agents, tools, and prompting techniques.
Topics Covered:
- Lesson 1: Foundational Models - Agent invocation, prompting, and structured output
- Lesson 2: Tools - Tool definition, integration with agents, and web search tools
- Lesson 3: Short-Term Memory - Managing conversation context
- Lesson 4: Multimodal Messages - Working with images, audio, and mixed media
- Lesson 5: Personal Chef (Project) - Building a recipe recommendation agent
Key Files:
module-1/1.1_foundation_models.ipynbmodule-1/1.1_prompting.ipynbmodule-1/1.2_tools.ipynbmodule-1/1.3_memory.ipynbmodule-1/1.4_Multimodal_Messages.ipynbmodule-1/1.5_personal_chef.ipynb
✅ Module 2: Advanced Agent (Complete - 8/8)
Learn sophisticated agent techniques including MCP, context management, and multi-agent systems.
Topics Covered:
- Lesson 1: Model Context Protocol (MCP) - Standardized tool and data integration
- Lesson 2: Context and State - Runtime context and stateful agents
- Lesson 3: Multi-Agent Systems - Supervisor-subagent architecture
- Lesson 4: Wedding Planner (Project) - Building a destination wedding planning agent team
- Bonus: RAG Agent - Semantic search over PDF documents with vector embeddings
- Bonus: SQL Agent - Natural language queries over a SQLite database
Key Concepts:
- MCP as "USB-C for AI models" - universal protocol for tool integration
- Context (immutable) vs State (mutable) management
- Agent orchestration patterns
- Multi-agent collaboration with LangGraph supervisor-subagent model
- RAG (Retrieval Augmented Generation) with in-memory vector stores
- Text-to-SQL with LangChain tool-calling agents
Key Files:
module-2/2.1_mcp.ipynbmodule-2/2.2_context_and_state.ipynbmodule-2/2.3_multi_agents.ipynbmodule-2/2.4_wedding_planners.ipynbmodule-2/bonus_rag.ipynbmodule-2/bonus_sql.ipynbmodule-2/resources/2.1_mcp_server.pymodule-2/resources/Chinook.db- SQLite database for SQL agent lessonmodule-2/resources/acmecorp-employee-handbook.pdf- PDF for RAG agent lesson
Documentation:
module-2/Context_And_State_Documentation.md- Comprehensive guide to state managementmodule-2/WINDOWS_MCP_FIX.md- Windows-specific MCP setup troubleshooting
🚧 Module 3: Production-Ready Agent (In Progress - 7/7)
Advanced production concepts for deploying robust agent systems.
Topics Covered:
- Lesson 1: Middleware - Production middleware patterns for agent customization
- Lesson 2: Managing Messages - Long conversation management, summarization, and trimming
- Lesson 3: Human-in-the-Loop - Approval checkpoints and human oversight patterns
- Lesson 4: Dynamic Agents - Dynamic prompts, models, and tools with wrap-style middleware
- Lesson 5: Email Assistant (Project) - Building an email inbox automation agent
- Bonus: Agent Chat UI - Frontend app using LangGraph dev server
Key Concepts:
- Middleware as customization hooks within agent execution loops
- Node-style middleware (before/after hooks) vs wrap-style middleware (model-level)
- Conversation summarization and message trimming for long-running agents
- Human-in-the-loop patterns for approving sensitive actions
- Dynamically swapping models, prompts, and tools at runtime
Key Files:
module-3/3.2_managing_messages.ipynbmodule-3/3.3_human_in_the_loop.ipynbmodule-3/3.4_dynamic_prompts.ipynbmodule-3/3.4_dynamic_models.ipynbmodule-3/3.4_dynamic_tools.ipynbmodule-3/3.5_email_agent.ipynbmodule-3/3.5_email_agent.pymodule-3/resources/Chinook.db- SQLite database for agent lessons
Documentation:
module-3/README.md- Module overview with middleware and lesson guides
🚀 Getting Started
Prerequisites
- Python 3.12 or 3.13
- pip or uv package manager
- API Keys (see Environment Setup)
Installation
-
Clone the repository:
git clone https://github.com/AnmolTomer/langchain-basics.git cd langchain-basics -
Create virtual environment:
# Using venv python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate # Or using uv (recommended) uv venv source .venv/bin/activate # On Windows: .venv\Scripts\activate -
Install dependencies:
# Using pip pip install -r requirements.txt # Or using uv (faster) uv pip install -r requirements.txt
Environment Setup
-
Copy the example environment file:
cp example.env .env -
Add your API keys to
.env:# Required OPENAI_API_KEY='your_openai_api_key_here' TAVILY_API_KEY='your_tavily_api_key_here' # Optional (used in Module 1, Lesson 1) ANTHROPIC_API_KEY='your_anthropic_api_key_here' GOOGLE_API_KEY='your_google_api_key_here' # Optional (for evaluation and tracing) LANGSMITH_API_KEY='your_langsmith_api_key_here' # LANGSMITH_TRACING=true LANGSMITH_PROJECT=lca-lc-foundation -
Launch JupyterLab:
jupyter lab
Windows Users: MCP Setup
If you're running MCP examples on Windows, you'll need to configure the event loop for subprocess support. See module-2/WINDOWS_MCP_FIX.md for detailed instructions.
Quick Fix:
import sys
import asyncio
if sys.platform == "win32":
asyncio.set_event_loop_policy(asyncio.WindowsProactorEventLoopPolicy())
# Then restart the kernel
🛠️ Key Technologies
- LangChain - Framework for building LLM applications
- LangGraph - Library for building stateful multi-agent applications
- Model Context Protocol (MCP) - Anthropic's open protocol for tool integration
- Tavily - AI-optimized search API
- OpenAI / Anthropic / Google - LLM providers
📦 Project Structure
langchain-basics/
├── module-1/ # Foundational agent creation
│ ├── 1.1_foundation_models.ipynb
│ ├── 1.1_prompting.ipynb
│ ├── 1.2_tools.ipynb
│ ├── 1.3_memory.ipynb
│ ├── 1.4_Multimodal_Messages.ipynb
│ ├── 1.5_personal_chef.ipynb
│ ├── 1.5_personal_chef.py
│ └── README.md
├── module-2/ # Advanced agent techniques
│ ├── 2.1_mcp.ipynb
│ ├── 2.2_context_and_state.ipynb
│ ├── 2.3_multi_agents.ipynb
│ ├── 2.4_wedding_planners.ipynb
│ ├── bonus_rag.ipynb
│ ├── bonus_sql.ipynb
│ ├── resources/
│ │ ├── 2.1_mcp_server.py
│ │ ├── Chinook.db
│ │ └── acmecorp-employee-handbook.pdf
│ ├── Context_And_State_Documentation.md
│ ├── WINDOWS_MCP_FIX.md
│ └── README.md
├── module-3/ # Production-ready agent patterns
│ ├── 3.2_managing_messages.ipynb
│ ├── 3.3_human_in_the_loop.ipynb
│ ├── 3.4_dynamic_prompts.ipynb
│ ├── 3.4_dynamic_models.ipynb
│ ├── 3.4_dynamic_tools.ipynb
│ ├── 3.5_email_agent.ipynb
│ ├── 3.5_email_agent.py
│ ├── langgraph.json
│ ├── resources/
│ │ └── Chinook.db
│ └── README.md
├── env_utils.py # Environment configuration utilities
├── pyproject.toml # Project metadata and dependencies
├── requirements.txt # Python package requirements
├── example.env # Environment variables template
└── README.md # This file
📖 Key Learning Resources
Module 1 Documentation
- Module 1 README - Overview of foundational concepts
Module 2 Documentation
- Module 2 README - Advanced agent patterns
- Context and State Guide - Complete guide to state management with diagrams
- Windows MCP Fix - Windows-specific troubleshooting
Module 3 Documentation
- Module 3 README - Production-ready agent patterns and middleware concepts
External Resources
- MCP Server Directory - Open-source MCP servers
- LangChain Documentation
- LangGraph Documentation
🎓 Learning Path
- Start with Module 1 - Work through notebooks 1.1 to 1.5 sequentially
- Complete the Personal Chef project - Apply foundational concepts
- Move to Module 2 - Learn MCP and advanced patterns
- Study Context & State - Read the comprehensive documentation
- Build Multi-Agent Systems - Implement supervisor-subagent patterns
- Complete the Wedding Planner - Multi-agent project
- Move to Module 3 - Learn production middleware and deployment patterns
- Master Dynamic Agents - Dynamic prompts, models, and tools
- Build the Email Assistant - Production-ready agent project
🤝 Contributing
This is a learning repository. Feel free to:
- Report issues or bugs
- Suggest improvements to documentation
- Share your own agent implementations
- Contribute fixes or enhancements
📝 Notes
- Windows Users: Review
WINDOWS_MCP_FIX.mdbefore running MCP examples - API Costs: Be mindful of API usage when running notebooks
- LangSmith: Optional but recommended for debugging and tracing agent behavior
🔧 Troubleshooting
Common Issues
Issue: NotImplementedError when running MCP on Windows
- Solution: See
module-2/WINDOWS_MCP_FIX.md
Issue: Import errors or missing modules
- Solution: Ensure virtual environment is activated and all dependencies are installed
Issue: API key errors
- Solution: Verify
.envfile exists and contains valid API keys
Issue: Jupyter kernel crashes
- Solution: Restart kernel and re-run cells in order
📄 License
MIT License - see LICENSE file for details
Copyright (c) 2026 Anmol Tomer
🙏 Acknowledgments
This repository is based on the "Foundation: Introduction to LangChain - Python" course, covering modern agent development patterns with LangChain, LangGraph, and the Model Context Protocol.
Happy Learning! 🚀
For questions or discussions, please open an issue or refer to the module-specific README files.