c776326204efc1d69a61bf24ffbf84f7ae9fc050
LangGraph Reflection and Rewrite Workflow
This repository demonstrates a simple Python project built with the
LangGraph framework.
The workflow consists of two custom nodes:
- ReflectNode – Generates a reflection message based on user input.
- RewriteNode – Rewrites the reflection into a more formal style.
Project Structure
src/
├── nodes/
│ ├── reflect.py # ReflectNode implementation
│ └── rewrite.py # RewriteNode implementation
├── graph.py # Graph definition
└── main.py # Entry point to run the graph
tests/
├── test_reflect.py
├── test_rewrite.py
└── test_graph.py
requirements.txt
Installation
# Create a virtual environment (optional but recommended)
python -m venv venv
source venv/bin/activate # On Windows use `venv\Scripts\activate`
# Install dependencies
pip install -r requirements.txt
Running the Workflow
python src/main.py
You should see output similar to:
Graph output: {'rewritten': "I notice that you said: 'Hello world'. Let's reflect on that."}
Testing
Run the test suite with pytest:
pytest
All tests should pass, confirming that the nodes and graph work as expected.
License
MIT License
Languages
Python
51.9%
JavaScript
39.3%
TypeScript
8.8%