Welcome to the LeetCodeSolver project, powered by crewAI! 🚀
This innovative agent-based system is designed to help you solve LeetCode problems effortlessly, from easy to hard. A team of AI agents collaborates to analyze problems, design algorithms, write and test code, and optimize performance.
The LeetCodeSolver Crew operates in a hierarchical structure to efficiently solve LeetCode problems. Here's a breakdown of the workflow:
- Manager: The manager receives the LeetCode problem and delegates tasks to the appropriate team members.
- Software Architect: Analyzes the problem and designs the algorithm.
- Software Engineer: Writes the Python code based on the algorithm.
- Tester: Writes test cases to ensure the code works correctly.
- QA: Reviews the code and test cases, providing reports and suggestions for improvements.
Each team member focuses on their specialized role, ensuring a streamlined and efficient problem-solving process.
Ensure you have Python >=3.10 <3.13 installed. This project uses UV for seamless dependency management.
- Install Docker
- Docker is necessary to execute Python code using the CodeInterpreterTool.
-
Install UV
If you haven't already, install UV by running:pip install uv
-
Set Up the Project
Navigate to your project directory and install dependencies:uv install
(Optional) Lock dependencies and install them using:
crewai install
-
Environment Setup
- Copy
.env-templateto.env. - Configure the
LLM_PROVIDERandMODELvariables by commenting/uncommenting the options. - Add your API key for the chosen LLM provider (e.g.,
OPENAI_API_KEYfor OpenAI).
- Copy
-
Prepare LeetCode Problem Files
- Visit LeetCode and copy the problem description into a markdown file.
- Save the markdown file in the
datafolder. - Update the
.envfile with the path to your problem file:LEETCODE_FILE="data/your_leetcode_file.md"
-
Open a new terminal window and start Phoenix:
phoenix serve
-
Access the Phoenix dashboard at: http://localhost:6006
To start solving problems with your AI crew, run the following command from the project root:
crewai run- This will initialize the LeetCodeSolver Crew, assign tasks, and begin execution based on your configuration.
- The final code will be stored in result folder with the same name as leetcode file.
The LeetCodeSolver Crew consists of multiple specialized AI agents, each with unique roles and tools. These agents work together to tackle tasks defined in:
config/tasks.yaml: Task definitions and workflows.config/agents.yaml: Agent capabilities and configurations.
Unleash the power of AI collaboration and solve LeetCode problems like never before! 🎉
