A Kaggle Agents Intensive – Capstone Project.
AutoCode Clinic is a multi-agent system designed to automate debugging, error detection, and code repair using orchestrated intelligent agents. It was built as part of the Agents Intensive Capstone Project on Kaggle, where the goal is to leverage agentic AI and multi-agent orchestration to solve real-world tasks.
The system automatically:
- Analyzes buggy code
- Runs tests in an isolated sandbox
- Generates model-driven patches
- Applies patches and re-validates
- Improves the program iteratively
This project demonstrates:
🧠 Autonomous multi-agent reasoning
🔁 Iterative feedback-driven debugging
🧩 Modular, extendable agent architecture
🛠️ Automated code repair mechanisms
🧪 Safe execution + validation loops
https://www.kaggle.com/code/vrajkumarshah/autocode-clinic
AutoCode-Clinic/
├── README.md
├── LICENSE
├── requirements.txt
├── .gitignore
├── notebooks/
│ ├── exploration.ipynb
│ └── demo_run.ipynb
├── src/
│ ├── agents/
│ │ ├── base.py
│ │ ├── orchestrator.py
│ │ ├── patch_generation_agent.py
│ │ ├── static_analysis_agent.py
│ │ ├── validation_agent.py
│ ├── utils.py
│ │ ├── analyzer.py
│ │ ├── model.py
│ │ ├── sandbox.py
│ │ ├── session_state.py
│ ├── main.py
├── tests/
│ ├── test_agents.py
│ └── test_workflow.py
└── examples/
├── demo_script.py
├── buggy.py
└── test_buggy.py
+-------------------+
| Orchestrator |
| (control center) |
+---------+---------+
|
v
+-----------------------+
| StaticAnalysisAgent |
| - AST scan |
| - Syntax issues |
| - Unsafe patterns |
+----------+------------+
|
v
+-----------------------+
| ValidationAgent |
| - Sandbox execution |
| - Runs tests |
| - Captures errors |
+----------+------------+
|
Tests pass? ──────────────── YES → FIXED
|
NO
v
+-----------------------------+
| PatchGenerationAgent |
| - Reads validation output |
| - Uses model to generate |
| file-replacement patches |
+----------+------------------+
|
v
(Apply patch)
|
└──────────────► Loop back to Orchestrator
+---------------------------+
| StaticAnalysisAgent |
+---------------------------+
| • Performs AST parsing |
| • Detects syntax errors |
| • Flags unsafe patterns |
+-------------+-------------+
|
v
+---------------------------+
| ValidationAgent |
+---------------------------+
| • Runs tests in sandbox |
| • Captures stdout/stderr |
| • Determines pass/fail |
+-------------+-------------+
|
v
+---------------------------+
| PatchGenerationAgent |
+---------------------------+
| • Reads validation logs |
| • Uses model wrapper |
| • Generates JSON patches |
+-------------+-------------+
|
v
+---------------------------+
| OrchestratorAgent |
+---------------------------+
| • Controls whole workflow |
| • Applies patches |
| • Manages iterations |
+---------------------------+
+----------------------+
| Start Debugging |
+----------+-----------+
|
v
+---------------------------+
| StaticAnalysisAgent |
| • Scan code |
| • Detect structural issues|
+------------+--------------+
|
v
+---------------------------+
| ValidationAgent |
| • Execute tests |
| • Capture errors |
+------------+--------------+
|
Tests pass?
| |
v v
YES NO
| |
v |
FIXED |
v
+---------------------------+
| PatchGenerationAgent |
| • Model-based patching |
| • Produces JSON patch |
+------------+--------------+
|
v
+---------------------------+
| Apply Patch to Code |
+------------+--------------+
|
v
+---------------------------+
| Orchestrator (Loop Back) |
+------------+--------------+
|
v
(Continue until fixed or max_iters)
git clone https://github.com/vraj826/AutoCode-Clinic.git
cd AutoCode-Clinic
pip install -r requirements.txt
python examples/demo_script.py
This demonstrates:
- static analysis
- failing validation
- patch generation
- re-validation
- successful fix
python src/main.py --code examples/buggy.py --tests examples/test_buggy.py
Open them with Jupyter:
jupyter notebook
Then run:
exploration.ipynb → Architecture understanding
demo_run.ipynb → End-to-end demo
From the root folder:
pytest -q
Runs:
- Agent tests
- Workflow tests
The orchestrator automatically saves:
fixed programs
session logs
patch proposals
summary files
When run in batch mode (Kaggle environment).
Python 3.9+
Multi-Agent Framework
Code Execution Environment
PyTest
Jupyter Notebooks
This project is licensed under the MIT License.
See the LICENSE file for details.
Vrajkumar Shah
Kaggle: https://www.kaggle.com/vrajkumarshah
GitHub: https://github.com/vrajshah826