Skip to content

JustCodeIt7/LangGraph_101

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

LangGraph 101: A Comprehensive Tutorial Series

Welcome to LangGraph 101, a hands-on tutorial series designed to help you learn and master LangGraph, a powerful library for building stateful, multi-actor applications with Large Language Models (LLMs).


πŸ“š About This Repository

This repository offers a structured learning path from basic concepts to advanced applications, featuring code examples, detailed tutorials, and full applications. Whether you're new to LangGraph or looking to deepen your expertise, this resource will guide you through effective LangGraph implementation.


πŸš€ Getting Started

Prerequisites

  • Python 3.9+
  • Ollama (for running local models)
  • Basic understanding of LLMs and Python
  • OpenAI API key (optional, for OpenAI models)

Installation

  1. Clone this repository:

    git clone https://github.com/yourusername/LangGraph_101.git
    cd LangGraph_101
  2. Install the required dependencies:

    pip install -r requirements.txt
  3. Set up your environment variables (if needed):

    cp .env.example .env
    # Edit .env with your API keys and configuration

πŸ“– Repository Structure

The repository is organized into several key sections to facilitate a clear learning progression:

01-LangGraph_Intro

Get started with the fundamentals of LangGraph:

01-Graphs

Explore core LangGraph concepts and graph-based workflows:

02-Agents

Dive into advanced agent implementations and patterns:

03-Apps

Explore complete real-world application examples:


πŸ’‘ Quick Start Examples

Basic Graph Structure

This example demonstrates the fundamental structure of a LangGraph StateGraph.

from langgraph.graph import StateGraph
from typing import TypedDict, List

# Define your state
class WorkflowState(TypedDict):
    user_input: str
    steps: List[str]

# Create a node function
def start_node(state: WorkflowState) -> dict:
    return {"steps": ["started"]}

# Build the graph
builder = StateGraph(WorkflowState)
builder.add_node("start", start_node)
builder.set_entry_point("start")
builder.set_finish_point("start")

app = builder.compile()

Chat Application with LLM

This snippet illustrates how to initialize an LLM for use in a LangGraph application. See the complete example in 01-Graphs/07-Basic_Chat_Graph/ for full details.

from langgraph.graph import StateGraph
from langchain_litellm import ChatLiteLLM

# Initialize LLM
llm = ChatLiteLLM(
    model="ollama/qwen3:0.6b",
    api_base="http://localhost:11434",
    temperature=0.7,
)

# ... (see complete example in 01-Graphs/07-Basic_Chat_Graph/)

πŸ”§ Supported LLM Providers

This repository demonstrates integration with various LLM providers, offering flexibility for your projects:

  • Ollama (local models): Examples include llama3.2, qwen3, deepseek-r1.
  • OpenAI: Supports models like gpt-4o-mini, gpt-4.
  • OpenRouter: Integrates with various models, including google/gemma-3-27b-it.
  • LiteLLM: Provides a unified interface for multiple providers.

πŸ“‹ Dependencies

Key dependencies for this project include:

  • langgraph~=0.4.7: The core graph framework.
  • langchain-core~=0.3.59: Foundation for LangChain integration.
  • langchain-openai~=0.3.11: For seamless OpenAI integration.
  • litellm~=1.67.4: A versatile multi-provider LLM interface.
  • rich~=14.0.0: For enhanced terminal output.
  • yfinance~=0.2.61: Used for financial data in stock agent examples.

For a complete list, please refer to the requirements.txt file.


🎯 Learning Path

We recommend the following learning progression:

  1. Start with Basics: Begin with 01-LangGraph_Intro to grasp core concepts.
  2. Explore Graphs: Work through the examples in 01-Graphs to master graph structures.
  3. Build Agents: Progress to 02-Agents for advanced agent patterns and implementations.
  4. Create Applications: Apply your knowledge with the real-world examples in 03-Apps.

πŸ› οΈ Development Setup

For development and testing, follow these steps:

# Install in development mode
pip install -e .

# Run with a specific Python version (e.g., Python 3.11)
python3.11 -m pip install -r requirements.txt

# Use with Jupyter notebooks
jupyter notebook 01-LangGraph_Intro/01-LangGraph_Basics.ipynb

πŸ“Š Visualization

Many examples within this repository include graph visualization, typically generated as .png and .mermaid files in their respective directories. This helps in understanding the flow and structure of the LangGraph applications.


🀝 Contributing

Contributions are highly encouraged and welcome! Please feel free to submit pull requests or open issues for:

  • New example applications.
  • Bug fixes and general improvements.
  • Documentation enhancements.
  • Additional LLM provider integrations.

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


About

LangGraph coding examples

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published