LangGraph React Component Generator is an open-source project that demonstrates the integration of LangChain's LangGraph with LangGraph Studio, LangGraph Cloud, and LangSmith. This project serves as an educational example for developers interested in leveraging these technologies to create intelligent agents for code generation.
This project is inspired by and builds upon the original LangGraph Engineer by Harrison Chase @hwchase17.
- Generates React components based on user requirements
- Utilizes a multi-step process for component creation:
- Gathering component requirements
- Drafting the component
- Performing programmatic checks
- Critiquing the generated code
- Creating documentation
- Integrates with various LangChain tools and services
The LangGraph React Component Generator uses a state graph to manage the flow of component creation. Here's a brief overview of the main steps:
- Gather Requirements: The agent interacts with the user to collect detailed requirements for the React component.
- Create Draft: Based on the gathered requirements, a draft of the React component is generated.
- Check: The draft undergoes programmatic checks to ensure it meets basic React component structure and syntax.
- Critique: An AI model reviews the component, focusing on best practices, performance, and adherence to React and Next.js conventions.
- Documentation: If the component passes all checks, comprehensive documentation is generated.
agent.py
: Defines the main workflow and state graph for the component generation process.gather_component_requirements.py
: Handles the interaction for collecting component requirements.draft.py
: Generates the initial draft of the React component.check.py
: Performs basic syntax and structure checks on the generated component.critique.py
: Provides an AI-powered review of the component.documentation.py
: Creates detailed documentation for the final component.
- Python 3.9+
- LangChain
- LangGraph
-
Clone the repository:
git clone https://github.com/GitMaxd/langgraph-react-component-gen.git cd langgraph-react-component-gen
-
Copy .env.example to .env and fill in the OpenAI and Anthropic API Keys
cp .env.example .env
You can run this project using different methods:
-
LangGraph Studio: Use LangGraph Studio for local development and testing.
-
LangGraph Cloud: Deploy the project to LangGraph Cloud for scalable execution.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is open-source and available under the MIT License.
- Harrison Chase (@hwchase17) for the original LangGraph Engineer project
- The entire LangChain team for LangGraph, LangGraph Studio, and LangSmith and two years of awesome!
Created by @GitMaxd - feel free to contact me, DM's open!