Skip to content

Nabin68/Langgraph-complete-guide

Repository files navigation

๐Ÿ”— LangGraph Complete Guide

Hands-on implementations of LangGraph concepts and workflows

Python LangGraph LangChain Cohere

Building graph-based LLM systems, one node at a time

๐Ÿ“Œ What This Covers โ€ข ๐Ÿง  Key Concepts โ€ข ๐Ÿ“‚ Repository Structure โ€ข ๐Ÿš€ Getting Started


๐Ÿ“– About

This repository contains structured learning and practical implementations of LangGraph, focusing on how to build graph-based LLM systems, manage state, route tools, and design non-trivial agent workflows.

๐ŸŽฏ The Philosophy

Learn by building, not just reading documentation.

This is not a tutorial copy or boilerplate repo. Every example here is built from the ground up to understand LangGraph at a system-design level โ€” how to think in graphs, control LLM execution, and build extensible agent systems.


๐Ÿ“Œ What This Repository Covers

๐Ÿ—๏ธ Core Fundamentals

  • LangGraph basics
  • State management using TypedDict
  • Message reducers (add_messages)
  • Graph construction using StateGraph
  • Node definitions and edges

๐Ÿ”„ Workflow Patterns

  • Sequential workflows
  • Parallel workflows
  • Conditional workflows
  • Iterative workflows
  • Cyclic execution patterns

๐Ÿ› ๏ธ Tool Integration

  • Tool integration using ToolNode
  • Conditional tool routing (tools_condition)
  • Dynamic tool selection
  • Tool-aware reasoning

๐Ÿ’พ Memory & Persistence

  • Checkpointing and memory
  • In-memory persistence
  • SQLite database integration
  • Conversation state management

โšก Advanced Features

  • Streaming graph execution
  • Backendโ€“frontend integration
  • Multi-turn conversations
  • MCP (Model Context Protocol)

๐ŸŽจ Real-World Examples

  • Chatbots with memory
  • Tool-calling agents
  • Database-backed persistence
  • LangSmith integration

๐Ÿง  Key Concepts Practiced

Graphs Over Chains

Designing LLM systems as directed graphs instead of linear flows. This enables:

  • Dynamic branching based on LLM decisions
  • Parallel execution of independent tasks
  • Conditional logic and loops
  • Better control over complex workflows

State-Driven Execution

Explicit state schema controlling how data flows through nodes:

class AgentState(TypedDict):
    messages: Annotated[list, add_messages]
    context: str
    user_info: dict

Tool-Aware Reasoning

Letting the model decide when tools are required:

  • LLM evaluates if a tool is needed
  • Graph routes to tool execution
  • Results feed back to LLM for synthesis

Checkpointed Memory

Persisting conversation state across executions:

  • Thread-based conversations
  • Resume interrupted workflows
  • Multi-session memory

๐Ÿ—๏ธ Typical Graph Structure

Most examples follow this powerful pattern:

        START
          โ†“
      LLM Node
          โ†“
    (Conditional)
       โ†™    โ†˜
  Tool Node  Direct Response
       โ†˜    โ†™
         โ†“
     END / Loop

What This Enables:

Feature Benefit
Dynamic Branching LLM decides the execution path
Tool Execution Automatic tool invocation when needed
Iterative Reasoning Loop back for multi-step problems
Conditional Logic Different paths for different scenarios

๐Ÿ“‚ Repository Structure

langgraph-complete-guide/
โ”‚
โ”œโ”€โ”€ 1.Sequential_workflow/          # Learn sequential graph execution
โ”œโ”€โ”€ 2.Parallel_workflow/            # Parallel node execution patterns
โ”œโ”€โ”€ 3.Conditional_workflow/         # Conditional routing and branching
โ”œโ”€โ”€ 4.Iterative_workflow/           # Loops and iterative reasoning
โ”œโ”€โ”€ 6.Persistence/                  # In-memory checkpointing
โ”œโ”€โ”€ 7.ChatBot/                      # Full chatbot implementation
โ”œโ”€โ”€ 8.SQLite_Database/              # SQLite-backed persistence
โ”œโ”€โ”€ 9.LangSmith/                    # LangSmith tracing integration
โ”œโ”€โ”€ 10.Chatbot_tools/               # Chatbots with tool integration
โ”œโ”€โ”€ 11.Chatbot_with_tools_SQLite/   # Complete chatbot + tools + DB
โ”œโ”€โ”€ 12.MCP/                         # Model Context Protocol examples
โ”‚
โ”œโ”€โ”€ requirements.txt
โ”œโ”€โ”€ .env.example
โ””โ”€โ”€ README.md

Each folder contains runnable examples focusing on one concept at a time.


๐Ÿ—‚๏ธ Module Breakdown

1. Sequential Workflow ๐Ÿ“

Learn the basics of LangGraph by building simple sequential flows.

  • Define nodes and edges
  • Create linear execution paths
  • Understand state management

2. Parallel Workflow โšก

Execute multiple nodes in parallel for efficiency.

  • Parallel node execution
  • Fan-out and fan-in patterns
  • Combining parallel results

3. Conditional Workflow ๐Ÿ”€

Build intelligent routing based on conditions.

  • Conditional edges
  • Dynamic path selection
  • If-else logic in graphs

4. Iterative Workflow ๐Ÿ”„

Implement loops and recursive patterns.

  • Loop until condition met
  • Iterative problem solving
  • Self-correction loops

6. Persistence ๐Ÿ’พ

Add memory to your graphs with checkpointing.

  • In-memory checkpointers
  • Save and resume conversations
  • Thread-based state management

7. ChatBot ๐Ÿ’ฌ

Build a complete conversational agent.

  • Multi-turn conversations
  • Context maintenance
  • Natural dialogue flow

8. SQLite Database ๐Ÿ—„๏ธ

Persist conversation state in SQLite.

  • Database schema design
  • Save/load checkpoints
  • Long-term memory storage

9. LangSmith ๐Ÿ”

Integrate LangSmith for observability.

  • Trace graph execution
  • Debug agent behavior
  • Performance monitoring

10. Chatbot Tools ๐Ÿ› ๏ธ

Add tool-calling capabilities to chatbots.

  • Web search integration
  • API calling
  • Tool result synthesis

11. Chatbot with Tools + SQLite ๐Ÿš€

Complete production-ready chatbot.

  • Tool integration
  • Persistent memory
  • Full conversation management

12. MCP (Model Context Protocol) ๐Ÿ”Œ

Work with Model Context Protocol.

  • MCP integration
  • Context sharing
  • Advanced communication patterns

๐Ÿš€ Getting Started

Prerequisites

  • Python 3.8+
  • Cohere API Key (Get one here)
  • Basic understanding of LangChain concepts

1๏ธโƒฃ Clone the Repository

git clone https://github.com/Nabin68/Langgraph-complete-guide.git
cd Langgraph-complete-guide

2๏ธโƒฃ Install Dependencies

pip install -r requirements.txt

Key dependencies:

langchain
langchain-cohere
langgraph
python-dotenv
sqlite3

3๏ธโƒฃ Set Up Environment

Create a .env file in the project root:

COHERE_API_KEY=your_cohere_api_key_here
LANGSMITH_API_KEY=your_langsmith_key_here  # Optional

4๏ธโƒฃ Run Examples

Navigate to any folder and run the example:

cd 1.Sequential_workflow
python main.py

๐ŸŽ“ Learning Path

For Beginners:

  1. Start with 1.Sequential_workflow
  2. Move to 2.Parallel_workflow
  3. Understand 3.Conditional_workflow
  4. Practice 4.Iterative_workflow

For Intermediate:

  1. Explore 6.Persistence
  2. Build 7.ChatBot
  3. Integrate 10.Chatbot_tools

For Advanced:

  1. Study 8.SQLite_Database
  2. Implement 11.Chatbot_with_tools_SQLite
  3. Master 12.MCP
  4. Experiment with 9.LangSmith

โš™๏ธ Tech Stack

Technology Purpose
Python Core language
LangGraph Graph-based orchestration
LangChain LLM framework
Cohere Language model provider
SQLite Persistent storage
LangSmith Observability & tracing
Streamlit UI demonstrations

๐ŸŽฏ Purpose of This Repository

This repository exists to:

โœ… Learn LangGraph at a system-design level
โœ… Understand agent workflows beyond simple chatbots
โœ… Practice production-relevant patterns
โœ… Serve as a reference for future projects

This is NOT:

โŒ A tutorial copy
โŒ A boilerplate repo
โŒ Just documentation reading

This IS:

โœ… Practical, runnable code
โœ… Progressive learning path
โœ… Real-world patterns
โœ… Production-ready examples


๐Ÿ”ฎ Roadmap & Future Additions

  • RAG workflows using LangGraph
  • Multi-agent graph patterns
  • Advanced MCP integrations
  • Vector database integration
  • Deployment examples (Docker, Cloud)
  • Performance optimization techniques
  • Error handling best practices
  • Testing strategies for graphs

๐Ÿ’ก Key Takeaways

After working through this repository, you will understand:

1. How to Think in Graphs

  • Design workflows as nodes and edges
  • Visualize execution flow
  • Plan conditional paths

2. How to Control LLM Execution

  • Manage state explicitly
  • Route based on conditions
  • Handle tool calls gracefully

3. How to Build Extensible Systems

  • Modular node design
  • Reusable graph patterns
  • Scalable architecture

๐Ÿ“š Additional Resources


๐Ÿ‘ค Author

Nabin

Focused on LangGraph, agent systems, and scalable AI workflows.


โš–๏ธ License

This project is open source and available under the MIT License.


๐Ÿค Contributing

Contributions, issues, and feature requests are welcome!

Feel free to check the issues page if you want to contribute.


โœ… Final Note

If you are learning LangGraph seriously, this repository demonstrates:

  • โœ… How to think in graphs โ€” Not just chains
  • โœ… How to control LLM execution โ€” Explicit state management
  • โœ… How to build extensible agent systems โ€” Production patterns

Start with the basics, progress to advanced patterns, and build real systems.


โญ Star this repo if you find it helpful!

Made with ๐Ÿง  by Nabin

Learning LangGraph one graph at a time

About

Hands-on LangGraph implementations covering workflows, persistent chatbots, tool integration, MCP servers, LangSmith tracing, and Streamlit streaming UI.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors