Skip to content

MABSSSSS/Langgraphs

Repository files navigation

LangGraph Mastery: Stateful LLM Workflows

A comprehensive laboratory for building resilient, stateful, and cyclic LLM applications using LangGraph. Master the transition from linear chains to complex agentic graphs.


Project Overview

This repository is a structured learning journey into LangGraph, the framework for building stateful, multi-actor applications with LLMs. It covers the complete spectrum of graph-based orchestration, starting from basic mathematical logic to advanced persistent chatbots.

Strategic Learning Path

1. Foundations & Control Flow

  • 0_test_installation: Verification of the graph execution environment.
  • 1_bmi_workflow: Introduction to StateGraph, TypedDict, and basic node-to-node transitions.
  • 2_simple_llm_workflow: Integrating LLMs as functional nodes within a graph.
  • 6_quadratic_equation: Handling complex mathematical reasoning and multi-step logic.

2. Chain of Thought & Pattern Design

  • 3_prompt_chaining: Implementing sequential prompt logic for refined outputs.
  • 4_batsman_workflow: Dynamic routing and domain-specific logic implementation.
  • 7_review_reply_workflow: Automated customer sentiment analysis and response generation.

3. Iterative Generation & Advanced State

  • 5_CSS_essay_workflow: Multi-stage content generation with refinement loops.
  • 8_X_post_generation: Automating social media content creation using agentic workflows.
  • 10_persistence: Mastering Checkpointers for state recovery, human-in-the-loop, and time-travel debugging.

4. Conversational Agents

  • 9_basic_chatbot: Building a standard conversational interface using stateful memory.
  • langgraph-chatbot/: A full-scale implementation of a persistent, tool-enabled chatbot.

Key Concepts Demonstrated

  • State Management: Using TypedDict to maintain and update application state across nodes.
  • Nodes & Edges: Defining functional units and the logic that connects them (including START and END).
  • Conditional Routing: Implementing branches based on the graph's current state.
  • Persistence: Using MemorySaver to persist graph state across sessions.
  • Visualization: Generating Mermaid diagrams to visualize complex logic flows.

Setup & Execution

1. Environment Setup

# Create and activate virtual environment
python -m venv myenv
source myenv/Scripts/activate  # Windows

2. Install Dependencies

pip install langgraph langchain_openai langchain_groq ipykernel

3. Run Notebooks

Launch Jupyter and explore the modules in order:

jupyter notebook

Why LangGraph?

While standard LangChain is excellent for linear DAGs, LangGraph enables:

  1. Cycles: Iterative refinement where an LLM can check its own work.
  2. Persistence: Seamlessly saving and resuming long-running agent workflows.
  3. Fine-Grained Control: Explicitly defining exactly how data flows between actors.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors