A structured, hands-on progression through the LangChain ecosystem — from a single LLM call all the way to stateful multi-agent workflows with LangGraph.
This repository documents my learning path through LangChain, LangGraph, and LangSmith — building progressively more complex AI systems step by step. Each numbered file is a self-contained lesson that builds on the previous one.
The progression follows this arc:
Simple LLM Call → Sequential Chains → RAG (v1→v4) → Agents → LangGraph
langsmith/
├── 1_simple_llm_call.py # Lesson 1: Basic LLM chain with PromptTemplate
├── 2_sequential_chain.py # Lesson 2: Multi-step sequential chains (LCEL)
├── 3_rag_v1.py # Lesson 3a: RAG - naive retrieval baseline
├── 3_rag_v2.py # Lesson 3b: RAG - improved chunking & embeddings
├── 3_rag_v3.py # Lesson 3c: RAG - FAISS vector store + retriever
├── 3_rag_v4.py # Lesson 3d: RAG - conversational memory + history
├── 4_agent.py # Lesson 4: ReAct agent with DuckDuckGo + tools
├── 5_langgraph.py # Lesson 5: Stateful graph-based agent (LangGraph)
├── islr.pdf # Knowledge base: Introduction to Statistical Learning
├── requirements.txt # All dependencies (pinned)
└── .gitignore
The foundation. Builds a minimal chain using LangChain Expression Language (LCEL):
PromptTemplate → ChatOpenAI → StrOutputParser
Concepts: PromptTemplate, ChatOpenAI, StrOutputParser, pipe operator (|), .invoke()
Chains multiple LLM steps together so the output of one becomes the input of the next.
Concepts: Multi-step LCEL chains, prompt composition, chaining transforms
A four-version deep dive into RAG using islr.pdf (Introduction to Statistical Learning) as the knowledge source.
| Version | What's new |
|---|---|
v1 |
Naive RAG — load PDF, split, embed, query |
v2 |
Better chunking strategy, improved retrieval quality |
v3 |
FAISS vector store, persistent index, similarity search |
v4 |
Conversational RAG with chat history & memory |
Concepts: PyPDFLoader, RecursiveCharacterTextSplitter, OpenAIEmbeddings, FAISS, RetrievalQA, ConversationalRetrievalChain
An autonomous agent that decides which tools to call based on the query — including live web search.
Tools used:
- 🔍
DuckDuckGoSearchRun— real-time web search - 📺
YouTubeTranscriptTool— fetch and query YouTube transcripts
Concepts: create_react_agent, tool binding, agent executor, tool schemas
The most advanced lesson. Builds a graph-based agent with persistent state, conditional edges, and SQLite checkpointing using LangGraph.
[User Input] → [Agent Node] → (tool needed?) → [Tool Node] → [Agent Node] → [Output]
↓ no
[END]
Concepts: StateGraph, ToolNode, MessagesState, conditional edges, SqliteSaver checkpointer, streaming
git clone https://github.com/codeantik/langsmith.git
cd langsmithpython -m venv venv
source venv/bin/activate # macOS/Linux
venv\Scripts\activate # Windowspip install -r requirements.txtCreate a .env file in the root:
OPENAI_API_KEY=your_openai_api_key_here
LANGCHAIN_API_KEY=your_langsmith_api_key_here
LANGCHAIN_TRACING_V2=true
LANGCHAIN_PROJECT=langsmith-learningGet your LangSmith API key at smith.langchain.com
# Run any lesson individually
python 1_simple_llm_call.py
python 2_sequential_chain.py
python 3_rag_v1.py
python 4_agent.py
python 5_langgraph.py| Package | Purpose |
|---|---|
langchain |
Core chains, prompts, output parsers |
langchain-openai |
OpenAI model integration |
langchain-community |
Community tools (DuckDuckGo, YouTube, etc.) |
langgraph |
Stateful agent graphs |
langsmith |
Tracing, evaluation, observability |
faiss-cpu |
Vector similarity search |
pypdf |
PDF loading for RAG |
openai |
Direct OpenAI API client |
python-dotenv |
Environment variable management |
streamlit |
(Optional) interactive UI |
All chains and agents are automatically traced in LangSmith when LANGCHAIN_TRACING_V2=true is set. This gives you:
- Full run traces (inputs, outputs, latency)
- Token usage per step
- Error debugging
- Prompt evaluation and comparison
View your traces at → smith.langchain.com
- Simple LLM calls with LCEL
- Sequential chains
- RAG pipeline (v1 → v4)
- ReAct agents with tools
- Stateful graphs with LangGraph
- Multi-agent systems
- Human-in-the-loop workflows
- LangGraph Studio integration
- Custom evaluators in LangSmith
Ankit Singh — Full Stack Developer & Agentic AI Specialist
This project is open source and available under the MIT License.