A comprehensive, hands-on tutorial series for learning LangChain v1.0 and LangGraph from the ground up. This repository contains 42 complete, working examples that progress from basic concepts to advanced multi-agent systems.
This project provides practical, executable code examples for developers learning to build AI applications with LangChain v1.0. Each tutorial is self-contained in its own folder with a single Python file, complete with detailed comments and explanations.
Key Features:
- Built for LangChain v1.0 (latest patterns, no deprecated code)
- Progressive learning path from basics to advanced topics
- Complete working examples, not just snippets
- Detailed inline documentation
- Production-ready patterns and best practices
- 0-quickstart: Build your first agent with tools and memory
- 1-agents: Dynamic models, middleware, and error handling
- 2-models: Invocation methods, tool calling, and structured outputs
- 3-messages: Conversation management and message types
- 4-tools: Creating tools with runtime context access
- 5-memory: Short-term memory, state management, and summarization
- 6-langsmith: Tracing, debugging, and monitoring with LangSmith
- 7-document-loaders: PDF processing, text splitting, and vector stores
- 8-retrieval: Advanced querying techniques (MMR, filtering, thresholds)
- 9-two-step-rag: Fixed retrieval-then-generation pattern
- 10-agentic-rag: Agent-controlled retrieval decisions
- 11-multi-agent: Supervisor pattern with specialized sub-agents
Prompts & Templates (12-15)
- Prompt templates, chat prompts, output parsers, and structured outputs
Tools & Error Handling (16-19)
- Simple and multiple tools, tool error handling, and agent routing
Memory & State Management (20-26)
- Agent memory, conversation buffers, summary memory, custom state schemas, checkpointing, and session-based memory
RAG & Embeddings (27-31)
- Text splitting, embeddings, vector search, retrieval metadata, and RAG with citations
Advanced Agent Patterns (32-36)
- Decision loops, reflection agents, planner agents, tool-using agents, and human-in-the-loop workflows
Production & Evaluation (37-41)
- Logging, tracing, configuration management, cost awareness, evaluation, and a comprehensive capstone project
- Python 3.9 or higher
- OpenAI API key
- Basic Python knowledge
- Clone this repository:
git clone https://github.com/eriperspective/langchain.git
cd langchain- Install dependencies:
pip install langchain langchain-openai langchain-community langgraph pypdf langsmith- Set your API key:
export OPENAI_API_KEY="your-api-key-here"- Optional - Enable LangSmith tracing:
export LANGSMITH_TRACING=true
export LANGSMITH_API_KEY="your-langsmith-key"
export LANGSMITH_PROJECT="langchain-learning"Each tutorial is independent and can be run directly:
# Start with the basics
python 0-quickstart/quickstart_demo.py
# Or jump to a specific topic
python 5-memory/memory_demo.pyRecommended Learning Path:
- Start with tutorials 0-5 in order to build foundational knowledge
- Complete tutorial 6 to set up debugging tools
- Work through tutorials 7-10 for RAG systems
- Finish with tutorial 11 for multi-agent architectures
langchain/
├── 0-quickstart/ # Simple and advanced agent examples
├── 1-agents/ # Agent configuration and middleware
├── 2-models/ # Working with language models
├── 3-messages/ # Message types and conversations
├── 4-tools/ # Tool creation and context
├── 5-memory/ # State management and memory
├── 6-langsmith/ # Tracing and debugging
├── 7-document-loaders/ # Document processing and embeddings
├── 8-retrieval/ # Vector database querying
├── 9-two-step-rag/ # Basic RAG implementation
├── 10-agentic-rag/ # Advanced RAG with autonomy
├── 11-multi-agent/ # Multi-agent coordination
├── 12-41/ # Advanced topics (see "What You'll Learn" above)
└── README.md
- Agent Creation: Using
create_agent()for standard and custom agents - Tool Development: Building tools with
@tooldecorator and runtime context - Memory Management: Checkpointers, state schemas, and conversation history
- RAG Patterns: 2-step vs agentic retrieval strategies
- Multi-Agent Systems: Supervisor pattern with tool calling
- Production Practices: LangSmith integration, error handling, middleware
- LangChain v1.0+ - Core framework
- LangGraph - Agent workflow orchestration
- OpenAI GPT-4o-mini - Language model
- ChromaDB - Vector database (tutorials 7-10)
- LangSmith - Tracing and monitoring (tutorial 6)
- All code uses LangChain v1.0 patterns (no deprecated LCEL or legacy chains)
- ChromaDB requires C++ build tools - RAG tutorials may need additional setup
- Each tutorial includes detailed comments explaining concepts and decisions
- Examples use GPT-4o-mini to minimize API costs during learning
This is a learning resource repository. If you find issues or have suggestions for improvements, please open an issue.
This project is provided for educational purposes.
Created by Eri Perspective while building production AI systems. These patterns and best practices are extracted from real-world projects including SmartFinance AI, a multi-agent financial assistant with LangGraph orchestration. Built to share knowledge with the AI developer community.