Step 1/9

Purpose: Install LangGraph ecosystem with stateful workflows, memory systems, and research tools

image.png

cd /root && mkdir -p langgraph-lab && cd langgraph-lab
python3 -m venv venv && source venv/bin/activate
pip install --upgrade pip uv

# Core LangGraph and LangChain packages
uv pip install langgraph langchain langchain-core langchain-community

# LLM Providers and State Management
uv pip install langchain-openai langgraph-checkpoint

# Research Tools and Utilities (DuckDuckGo is FREE - no API key!)
uv pip install ddgs beautifulsoup4 requests python-dotenv pydantic typing-extensions

echo "LANGGRAPH_INSTALLED" > /root/langgraph-ready.txt

Step 2/9

Sequential vs Stateful - Why Graphs Matter

image.png

For better understanding, run these three code examples


# This is the project directory, 
code
|>task2
|>task3
|>task4
|>task5
|>task6
|>task7
|>task8
|>task9
readme.md

put this file in task2 folder

sequential_chain.py

<aside> 💡

replace $ from langchain.prompts import ChatPromptTemplate with $ from langchain_core.prompts import ChatPromptTemplate

</aside>

stateful_graph.py

compare_approaches.py

# Step 1: Run sequential chain example
python /root/code/task2/sequential_chain.py

# Step 2: Run stateful graph example
python /root/code/task2/stateful_graph.py

# Step 3: Compare the approaches
python /root/code/task2/compare_approaches.py

Step 3/9

State Graph - The Heart of LangGraph