langchain-masterclass
A hands-on LangChain course with 100+ runnable labs — RAG, tools, agents, MCP, structured outputs, and multi-provider LLM support.
Install / Use
claude mcp add zainulabidin1 -- npx -y github:zainulabidin1/langchain-masterclassIf the server publishes to npm under a different name, use that package instead — check the repo README.
MCP Server
Model Context Protocol server
Quality Score
Category
AI & Machine LearningSupported Platforms
Our assessment of langchain-masterclass
langchain-masterclass scores 84/100 on our quality scale, 618th of 963 AI & Machine Learning skills we index.
Its MCP Server is 20 KB long, well organised into 37 sections with 7 code examples: a thorough specification that gives an agent plenty to work with.
It has 10 GitHub stars, so there is little community track record yet; judge it on its content.
Maintenance, license and trust
- The repository was last updated 32 days ago, so langchain-masterclass is actively maintained.
- Our last check on 2026-09-25 found the source still online.
- It is released under the MIT license, a permissive license that allows use, modification and commercial use with attribution.
- Its trust signals score 97/100, with no cautions. These come from repository metadata, not a code audit — read the skill file before letting an agent act on it.
Safety scan
No issues foundOur scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. An AI review of the same text found nothing harmful.
AI review by kimi-k2.7-code on 2026-09-24. Automated pattern scan on 2026-09-24. It catches known dangerous patterns, not every risk — read a skill before letting an agent act on it.
langchain-masterclass compared with similar skills
All 4 of these similar skills score higher than langchain-masterclass; compare them before choosing.
| Skill | Score | Stars | Updated | Format |
|---|---|---|---|---|
| langchain-masterclass (this skill)by zainulabidin1 | 84 | 10 | 32d ago | MCP Server |
| claude-memby thedotmack | 100 | 97.5k | today | CLAUDE.md |
| Agent-Reachby Panniantong | 100 | 93.0k | 22d ago | CLAUDE.md |
| Understand-Anythingby Egonex-AI | 100 | 85.5k | 1d ago | CLAUDE.md |
| headroomby headroomlabs-ai | 100 | 74.6k | today | CLAUDE.md |
Frequently asked questions
- How do I install langchain-masterclass?
- Run
claude mcp add zainulabidin1 -- npx -y github:zainulabidin1/langchain-masterclass. The install tabs above show the steps for each supported agent. - Which AI agents does langchain-masterclass work with?
- It is written for Claude Code, Claude Desktop and Gemini CLI, as a MCP Server file. Other agents that read the same format can often use it too.
- Is langchain-masterclass safe to use?
- Our scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. An AI review of the same text found nothing harmful. It is MIT-licensed and scores 97/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
- Is langchain-masterclass still maintained?
- The repository was last updated 32 days ago, so langchain-masterclass is actively maintained.
Skill content
View source on GitHub
Table of Contents
- Introduction
- Features
- Course Roadmap
- Prerequisites
- Installation
- Configuration
- Running Labs
- Curriculum
- Skills Acquired
- Best Practices Demonstrated
- Troubleshooting / FAQ
- Contributing
- Acknowledgements
- License
🦜 Introduction
LangChain MasterClass is a structured, code-first curriculum that teaches you how to build sophisticated AI applications using the LangChain ecosystem. Every concept is grounded in a self-contained Python lab — no slides, no fluff, no theoretical hand-waving.
The repository spans 18 modules and 100+ individual labs, taking you from the absolute basics (invoking a chat model) all the way to building autonomous agents that call live APIs, query databases, discover tools over the Model Context Protocol, and reason across multi-step tool chains. Every lab is executable as a standalone script with a single command.
Target Audience
This course is designed for students, Python developers, backend engineers, and AI practitioners who want to build real LangChain applications — not just copy-paste demos. Whether you are transitioning into AI engineering, deepening an existing LangChain skill set, or building the knowledge base needed to build RAG and agent systems, this curriculum provides a clear, practical path.
| Audience | Why This Course Fits | |----------|---------------------| | Students | Bridging academic theory with industry-standard AI engineering | | Python Developers | Familiar with Python; want to add AI/LLM capabilities to their skill set | | Backend Engineers | Building APIs or services that incorporate LLM-powered features | | AI/ML Practitioners | Know the theory; want hands-on LangChain implementation experience | | Data Engineers | Interested in RAG pipelines, document processing, and semantic search |
What Makes It Different?
Unlike tutorial repositories that focus on a single feature or borrow examples directly from LangChain's documentation, this course builds every concept from the ground up using a consistent codebase, shared helper utilities, and progressively harder challenges. A multi-provider ModelFactory abstraction means you can run every lab against OpenAI, Anthropic Claude, Google Gemini, Ollama, HuggingFace, OpenRouter and more by changing two lines in a .env file.
✨ Features
- 📦 18 progressive modules — from your first model call to full autonomous agents
- 🧪 100+ runnable labs — every concept is a standalone, executable Python script
- 🔌 Multi-provider support — OpenAI, Anthropic, Google Gemini, Ollama, HuggingFace, OpenRouter and more
- 🧬 Structured outputs — Pydantic, TypedDict, and JSON-schema-driven extraction
- 🗄️ Vector databases — InMemoryVectorStore, Chroma, and FAISS, each with full CRUD coverage
- 📚 Retrieval-Augmented Generation (RAG) — from basic pipelines to conversational chatbots and agentic RAG
- 🔗 Model Context Protocol (MCP) — local and remote tool discovery and aggregation
- 🤖 Agents — custom agentic loops, ReAct-style agents, SQL agents, and RAG agents
- ⚡ Async, Streaming — non-blocking pipelines with token-by-token delivery
- 📡 Callbacks — logging, cost tracking, and real-time event hooks
<p align="center"> 💡 If you find this repo useful, don't forget to <a href="https://github.com/zainulabidin1/langchain-masterclass/stargazers">star (🌟)</a> — it helps others discover it too! </p>
📚 Course Roadmap
| Module | Topic | Skills Learned |
|--------|-------|----------------|
| 01_models | Models & Embeddings | ChatModel, temperature, max_tokens, stop sequences, multimodal (image input), LLM caching, embedding vectors, embedding dimensions |
| 02_prompts | Prompt Engineering | Message types (System/Human/AI/Tool/Chat), PromptTemplate, ChatPromptTemplate, multi-variable prompts, few-shot prompting, length-based example selection |
| 03_chains | LCEL Chains | Simple LCEL chains, output parsers in chains, multi-step sequential chains, batch execution, sequential vs batch performance benchmarking |
| 04_runnables | LCEL Runnables | RunnableSequence, pipe operator \|, RunnableParallel, RunnableBranch, RunnableLambda (dynamic routing), RunnablePassthrough, .assign(), fallback chains, runtime ConfigurableField & ConfigurableAlternatives |
| 05_output_parsers | Output Parsers | StrOutputParser, CommaSeparatedListOutputParser, JsonOutputParser, XMLOutputParser, PydanticOutputParser, custom BaseOutputParser |
| 06_structured_output | Structured Output | JSON schema binding, TypedDict schema, Pydantic schema, nested Pydantic models, with_structured_output() |
| 07_async_streaming | Async & Streaming | ainvoke, astream (token-by-token), astream_events (v2 event filtering by run name) |
| 08_callbacks | Callbacks | StdOutCallbackHandler, OpenAI token & cost tracking, custom sync BaseCallbackHandler, custom async AsyncCallbackHandler |
| 09_memory | Memory & Persistence | Stateless chat (demonstrates forgetting), manual message list, RunnableWithMessageHistory, SQLite via SQLChatMessageHistory, JSON file custom history, trim_messages, interactive in-memory chatbot, interactive SQLite chatbot |
| 10_document_loaders | Document Loaders | TextLoader, CSVLoader, PyPDFLoader, WebBaseLoader, DirectoryLoader, SQLDatabaseLoader, WikipediaLoader |
| 11_text_splitters | Text Splitters | CharacterTextSplitter, RecursiveCharacterTextSplitter, TokenTextSplitter (tiktoken), MarkdownHeaderTextSplitter, language-aware code splitter, SemanticChunker |
| 12_document_transformers | Document Transformers | HTML cleaning & tag extraction with BeautifulSoupTransformer, semantic duplicate filtering with EmbeddingsRedundantFilter |
| 13_vector_stores | Vector Stores | InMemoryVectorStore (CRUD), Chroma (persistent, CRUD), FAISS (save/load, CRUD), similarity search types (standard, MMR, scored, threshold) |
| 14_retrievers | Retrievers | WikipediaRetriever, VectorStoreRetriever, BM25Retriever, EnsembleRetriever (hybrid), MultiQueryRetriever, ContextualCompressionRetriever (LLM extractor), ParentDocumentRetriever, MultiVectorRetriever (summary index), FlashRank reranking |
| 15_rag | RAG Pipelines | Basic RAG (PDF ingestion), Wikipedia RAG (LCEL), RAG + message history + query rewriting, RAG + Pydantic citations, conversational RAG chatbot (CLI), long-context reordering |
| 16_tools | Tools & Toolkits | DuckDuckGo/Wikipedia/PythonREPL/Requests built-in tools, @tool decorator, StructuredTool, BaseTool class, manual tool-call execution loop, FileManagementToolkit, custom BaseToolkit, retriever-as-tool |
| 17_mcp | Model Context Protocol (MCP) | FastMCP server, @mcp.tool(), STDIO transport, MultiServerMCPClient, local & remote (Streamable HTTP) tool discovery, multi-server aggregation |
| 18_agents | Agents | Custom agentic reasoning loop with tool dispatch, create_agent (built-in ReAct-style), create_sql_agent (natural language to SQL), MCP-powered agent via MultiServerMCPClient, retriever-as-tool RAG agent via create_retriever_tool |
📋 Prerequisites
- Python 3.10 or higher
- Basic Python proficiency (functions, classes, decorators,
async/await) - Familiarity with REST APIs and JSON (used in tool labs)
- At least one LLM API key (OpenAI, Anthropic, Google, OpenRouter) — or Ollama install
- No prior LangChain experience required
🚀 Installation
1. Clone the repository
git clone https://github.com/zainulabidin1/langchain-masterclass.git
cd langchain-masterclass
2. Create and activate a virtual environment
python -m venv .venv
# Windows
.venv\Scripts\activate
# macOS / Linux
source .venv/bin/activate
3. Install all dependencies
pip install -r requirements.txt
4. Configure your environment
# macOS / Linux / Windows (PowerShell)
cp .env.example .env
# Windows (CMD)
copy .env.example .env
Then open .env and fill in your credentials (see Configuration below).
⚙️ Configuration
All configuration lives in the .env file at the project root. The two most important settings are LLM_MODEL_PROVIDER and LLM_MODEL_NAME.
# Choose your LLM provider: "openai", "google", "ollama", "anthropic", "huggingface", "openrouter"
LLM_MODEL_PROVIDER="ollama"
LLM_MODEL_NAME="gpt-oss:120b-cloud"
# Choose your embeddings provider: "openai", "google", "ollama", "huggingface", "openrouter"
EMBEDDINGS_MODEL_PROVIDER="ollama"
EMBEDDINGS_MODEL_NAME="nomic-embed-text"
# API Keys — fill in only the ones you plan to use
OPENAI_API_KEY=""
ANTHROPIC_API_KEY=""
GOOGLE_API_KEY=""
HUGGINGFACEHUB_API_TOKEN=""
OPENROUTER_API_KEY=""
# Set if not running Ollama on the default localhost. Otherwise leave blank
OLLAMA_BASE_URL=""
# Identifies your requests to external services (e.g. Wikipedia, WebBaseLoader)
# Some APIs reject or rate-limit requests with no User-Agent — safe to leave as default
USER_AGENT="LangChainMasterClass/1.0"
How model_factory.py Works
The _common/model_factory.py module is the backbone of the entire course. It reads LLM_MODEL_PROVIDER and LLM_MODEL_NAME from the environment at startup and exposes three factory functions:
| Function | Returns | Notes |
|----------|---------|-------|
| get_chat_model(**kwargs) | BaseChatModel | Supports OpenAI, Google, Ollama, Anthropic, HuggingFace, OpenRouter |
| get_embedding_model(**kwargs) | Embeddings | Supports OpenAI, Google, Ollama, HuggingFace, OpenRouter |
All **kwargs are forwarded directly to the underlying provider class, so you can pass temperature, max_tokens, streaming, or any provider-specific parameter without modifying the factory. This is why every lab can override the model behavior (e.g., get_chat_model(temperature=0.9)) without touching the provider configuration.
In practice, every lab starts the same way:
from _common.model_factory import get_chat_model
# The entire codebase adapts to your .env file automatically
model = get_chat_model(temperature=0)
response = model.invoke("Hello, LangChain!")
Switch LLM_MODEL_PROVIDER in .env — no code changes required — runs against a different provider.
▶️ Running Labs
Each lab is a self-contained Python script. To run any lab, activate your virtual environment and execute the file directly:
# Example: Run from module folder
cd 01_models
Truncated for display — read the full file on GitHub.
Related Skills
claude-mem
97.5kPersistent Context Across Sessions for Every Agent – Captures everything your agent does during sessions, compresses it with AI, and injects relevant context back into future sessions. Works with Claude Code, OpenClaw, Codex, Gemini, Hermes, Copilot, OpenCode + More
Agent-Reach
93.0kGive your AI agent eyes to see the entire internet. Read & search Twitter, Reddit, YouTube, GitHub, Bilibili, XiaoHongShu — one CLI, zero API fees.
Understand-Anything
85.5kGraphs that teach > graphs that impress. Turn any code into an interactive knowledge graph you can explore, search, and ask questions about. Works with Claude Code, Codex, Cursor, Copilot, Gemini CLI, and more.
headroom
74.6kCompress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.
Languages
Trust signals
From repository metadata: license, adoption, age and documentation. Not a code audit — see the Safety scan above for what the skill file itself contains.
