A collection of LangGraph workflow examples and chatbot implementations built with OpenAI and LangChain.
.
├── sequential_workflow/ # Step-by-step LLM pipelines
│ ├── simple_llm_workflow.py
│ ├── prompt_chaining.py
│ └── bmi_workflow.ipynb
├── parallel_workflow/ # Concurrent node execution
│ ├── cricket.py
│ └── upsc_essay.py
├── conditional_workflow/ # Dynamic routing based on state
│ ├── quadratic_equation_workflow.py
│ └── review_workflow.py
├── iterative_workflow/ # Looping until a condition is met
│ └── x_post_generator.py
├── Chatbot/
│ ├── basic_shell_chatbot.py # Shell chatbot with in-memory persistence
│ ├── InMemoryChatbot/ # Chatbot with MemorySaver checkpointer
│ └── ChatbotWithDB/ # Chatbot with SQLite persistence and tools
└── MCP Server/
└── calculator_server.py # FastMCP calculator server
| Pattern | Description |
|---|---|
| Sequential | Nodes execute one after another in a fixed chain |
| Parallel | Multiple nodes run concurrently and results are merged |
| Conditional | Routing decisions are made based on the current graph state |
| Iterative | A loop runs until a stopping condition is reached |
- InMemoryChatbot — conversation history kept in memory for the session
- ChatbotWithDB — persistent history stored in SQLite across sessions
- backend_with_tools — LLM can call external tools during a conversation
- chatbot_mcp — chatbot integrated with an MCP server
MCP Server/calculator_server.py exposes arithmetic operations (add, subtract, multiply, divide, power, modulo) as tools via the Model Context Protocol.
-
Create and activate a virtual environment:
python -m venv langgraph source langgraph/bin/activate -
Install dependencies:
pip install langgraph langchain langchain-openai langchain-community fastmcp
-
Copy
.env.exampleto.envand fill in your keys:OPENAI_API_KEY=your_key_here LANGCHAIN_API_KEY=your_key_here LANGCHAIN_TRACING_V2=true LANGCHAIN_PROJECT=chatbot-project
Run any example directly:
python sequential_workflow/simple_llm_workflow.py
python iterative_workflow/x_post_generator.py
python Chatbot/basic_shell_chatbot.pyStart the MCP calculator server:
python "MCP Server/calculator_server.py"