Skip to content

ruthuraraj-ml/ai-code-debugging-assistant

Repository files navigation

πŸ€– AI-Powered Code Debugging Assistant

A multi-agent AI system that automatically analyzes, debugs, and corrects Python programs using CrewAI, Code Interpreter, Pydantic, and Streamlit.

Python CrewAI Streamlit Pydantic License


πŸŽ₯ Demo

Demo Video

Watch Demo


πŸ“– Overview

Debugging Python programs often requires identifying syntax, runtime, and logical errors before applying safe corrections.

This project implements a CrewAI-powered multi-agent debugging workflow where specialized AI agents collaborate to analyze code, generate corrections, and verify the debugging process.

Unlike traditional prompt-based implementations, this project introduces a Builder Pattern that separates LLM reasoning from structured artifact construction, producing deterministic and strongly typed workflow outputs.


✨ Features

  • πŸ€– Multi-Agent AI Debugging using CrewAI
  • πŸ” Automated Syntax, Runtime & Logical Error Detection
  • πŸ›  Automatic Code Correction
  • 🧠 Code Interpreter Integration
  • πŸ“„ Builder Pattern for Structured Artifacts
  • πŸ“Š Interactive Streamlit Dashboard
  • πŸ“ˆ Observability & Execution Tracing
  • πŸ”„ Side-by-Side Code Comparison
  • πŸ“‘ Unified Diff Viewer
  • πŸ“¦ JSON Trace Export

πŸ— System Architecture

The application consists of:

  • Streamlit Frontend
  • Debugging Service
  • Sequential CrewAI Workflow
  • Analyzer Agent
  • Corrector Agent
  • Manager Agent
  • Builder Components
  • Structured Pydantic Artifacts
  • Observability Layer

βš™ Multi-Agent Workflow

                User Code
                     β”‚
                     β–Ό
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β”‚  Code Analyzer Agent    β”‚
        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                     β”‚
                     β–Ό
            AnalysisResponse
                     β”‚
                     β–Ό
            AnalysisBuilder
                     β”‚
                     β–Ό
             AnalysisReport
                     β”‚
                     β–Ό
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β”‚ Code Corrector Agent    β”‚
        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                     β”‚
                     β–Ό
           CorrectionResponse
                     β”‚
                     β–Ό
          CorrectionBuilder
                     β”‚
                     β–Ό
       CorrectedCodeArtifact
                     β”‚
                     β–Ό
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β”‚     Manager Agent       β”‚
        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                     β”‚
                     β–Ό
          Verification Summary

🧩 Builder Pattern

One of the key architectural improvements in this project is the Builder Pattern.

Instead of asking the LLM to generate complex Pydantic objects directly, each agent only produces a lightweight response schema.

Dedicated Builder classes then construct rich domain artifacts.

LLM
      β”‚
      β–Ό
AnalysisResponse
      β”‚
      β–Ό
AnalysisBuilder
      β”‚
      β–Ό
AnalysisReport
LLM
      β”‚
      β–Ό
CorrectionResponse
      β”‚
      β–Ό
CorrectionBuilder
      β”‚
      β–Ό
CorrectedCodeArtifact

Benefits

  • Deterministic artifact construction
  • Reduced prompt complexity
  • Strong type safety
  • Better maintainability
  • Fewer schema validation failures

πŸ“¦ Domain Artifacts

The debugging workflow exchanges structured artifacts throughout execution.

SourceCodeArtifact

        β”‚

        β–Ό

AnalysisReport

        β”‚

        β–Ό

CorrectedCodeArtifact

        β”‚

        β–Ό

Verification Summary

πŸ“Š Streamlit Dashboard

Analysis Dashboard


Code Comparison


Corrected Code


Verification Summary


Observability Dashboard


πŸ“ˆ Observability

The project includes a lightweight observability framework that records:

  • Workflow Events
  • Agent Execution
  • Task Completion
  • Execution Metrics
  • JSON Trace Export

These metrics are visualized directly inside the Streamlit application.


πŸ›  Technology Stack

Component Technology
Framework CrewAI
Language Python
LLM Groq Llama 3.3 70B
Validation Pydantic v2
UI Streamlit
Execution CodeInterpreterTool
Observability Custom Tracer

πŸ“ Project Structure

code-debugging-assistant/

β”‚

β”œβ”€β”€ agents/

β”œβ”€β”€ builders/

β”œβ”€β”€ config/

β”œβ”€β”€ observability/

β”œβ”€β”€ prompts/

β”œβ”€β”€ schemas/

β”œβ”€β”€ services/

β”œβ”€β”€ tasks/

β”œβ”€β”€ utils/

β”‚

β”œβ”€β”€ images/

β”œβ”€β”€ streamlit_app.py

β”œβ”€β”€ crew.py

β”œβ”€β”€ main.py

β”œβ”€β”€ requirements.txt

└── README.md

πŸš€ Installation

Clone the repository

git clone https://github.com/ruthuraraj-ml/ai-code-debugging-assistant.git

Move into the project

cd ai-code-debugging-assistant

Create virtual environment

python -m venv .venv

Activate

Windows

.venv\Scripts\activate

Linux / macOS

source .venv/bin/activate

Install dependencies

pip install -r requirements.txt

Configure environment variables

GROQ_API_KEY=your_api_key

Run

streamlit run streamlit_app.py

πŸ’‘ Key Learnings

This project demonstrates:

  • Multi-Agent AI Systems
  • CrewAI Workflow Design
  • Builder Design Pattern
  • Pydantic Domain Modeling
  • Observability for AI Applications
  • Streamlit Application Development
  • Software Engineering for LLM Systems

πŸ›£ Roadmap

βœ… Version 1.0

  • Multi-Agent Workflow
  • Builder Pattern
  • Structured Artifacts
  • Streamlit Dashboard
  • Execution Tracing
  • Code Diff Viewer

πŸ”„ Version 2.0

  • Evaluation Benchmark Suite
  • Regression Testing
  • Prompt Optimization
  • Improved Logical Error Detection
  • Verification Artifact
  • Multi-language Support

πŸ‘¨β€πŸ’» Author

Ruthuraraj R

Assistant Professor – Mechanical Engineering

AI β€’ Machine Learning β€’ Generative AI β€’ Agentic AI Systems


⭐ If you found this project interesting, consider giving it a Star.

About

Multi-agent AI-powered Python code debugging assistant built with CrewAI, Streamlit, Pydantic, and Code Interpreter, featuring structured artifacts, Builder Pattern architecture, and execution tracing.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages