Skip to content

An autonomous AI software engineering crew that diagnoses, researches, and repairs broken Python code using a "Research-Fix-Verify" loop with sandboxed Docker execution and real-time mobile notifications.

Notifications You must be signed in to change notification settings

Sama-ndari/code-phoenix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🦅 CodePhoenix: Autonomous Code Repair Agent

Python CrewAI Docker OpenAI

CodePhoenix is a "self-healing" multi-agent system designed to autonomously diagnose, research, and repair broken Python code. It mimics the workflow of a Senior Software Engineer by executing a strict Research-Fix-Verify loop within a secure execution environment.

🏗️ Architecture & Workflow

CodePhoenix utilizes a Sequential Process across three specialized agents:

  1. 🔍 The Investigator: Analyzes broken_script.py and uses Google Search to find current solutions.
  2. ⚙️ The Engineer: Implements the fix and runs it inside an isolated Docker container.
  3. 💼 The Manager: Validates the result and sends a Push Notification to the user.

🚀 Getting Started

1. Prerequisites

  • Python 3.11+
  • Docker Desktop: Download here. (Ensure it is running before starting the crew).
  • OpenAI API Key: Get it here.

2. Configure External Tools (Optional but Recommended)

To enable the full "Autonomous" experience, sign up for these free tiers:

  • Serper (Search): Go to serper.dev, sign up, and copy your API Key. This allows the agent to search Google/StackOverflow.
  • Pushover (Mobile Alerts): 1. Install the Pushover app on your phone. 2. Go to pushover.net to get your User Key. 3. Create an "Application" on the dashboard to get your API Token.

3. Installation

# Clone the repository
git clone [https://github.com/Sama-ndari/code_phoenix.git](https://github.com/Sama-ndari/code_phoenix.git)
cd code_phoenix

# Install dependencies
uv sync

4. Setup Environment (.env)

Create a .env file in the root directory and fill in your keys:

# Core LLM
OPENAI_API_KEY=sk-proj-xxxx

# Web Research (serper.dev)
SERPER_API_KEY=xxxx

# Mobile Notifications (pushover.net)
PUSHOVER_USER=xxxx
PUSHOVER_TOKEN=xxxx

🛠️ Usage

  1. Define the Problem: Place any broken Python code into broken_script.py in the root folder.
  2. Run the Crew:
uv run crewai run
  1. Observe:
  • The Investigator will log its research findings.
  • The Engineer will create fixed_script.py and start a Docker container to test it.
  • You will receive a Push Notification on your phone once the script is verified as working.

📂 Project Structure

  • src/code_phoenix/config/: YAML files defining Agent personalities and Task sequences.
  • src/code_phoenix/tools/: Custom Python tools (Pushover integration).
  • broken_script.py: The input file the agents monitor.
  • fixed_script.py: The final output generated by the Engineer.

Created by Samandari

About

An autonomous AI software engineering crew that diagnoses, researches, and repairs broken Python code using a "Research-Fix-Verify" loop with sandboxed Docker execution and real-time mobile notifications.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages