Observed since 21 Oct, 10:13 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
An AI agent that automatically detects, diagnoses, and fixes bugs in Python scripts.
AI Automated Code Repair Agent is a professional, autonomous CLI tool that executes Python scripts, detects crashes, and uses an AI-driven workflow to analyze, repair, and securely verify fixes before recommending them. It packages everything you need—from intelligent error parsing to isolated Docker-based verification—so you can point it at a script and get reliable, reproducible results.
PyPI Package: ai-code-repair-agent
agent <script.py> and let the tool handle execution, crash detection, analysis, patching, and reporting.requirements.txt and a Dockerfile.pip install commands when appropriate.agent configure command for easy setup and a built-in Docker prerequisite check.graph TD
A[New User] --> B[pip install ai-code-repair-agent];
B --> C[agent configure];
C --> D[Enters API Key];
D --> E[✅ Agent is ready to use];
graph TD
A[User executes `agent <script_path>`] --> B{Docker Running?};
B -- No --> C[❌ End: Advise user to start Docker];
B -- Yes --> D[ProcessRunner executes script];
D --> E{Crash Detected?};
E -- No --> F[✅ End: Success];
E -- Yes --> G[ErrorParser analyzes traceback];
G --> H{Error Type?};
H -- ModuleNotFoundError --> I[👩🏫 Reporter advises `pip install` & exits];
H -- Other Error --> J[ContextManager retrieves faulty function];
J --> K[AICore sends context to Gemini LLM];
K --> L[Receives proposed code fix];
L --> M[🛡️ SandboxVerifier begins test];
M --> N{Test Passed?};
N -- Yes --> O[🎉 Reporter shows success & diff];
N -- No --> P[❌ Reporter shows failure];
style C fill:#e63946,stroke:#333,stroke-width:2px
style I fill:#f9f,stroke:#333,stroke-width:2px
This project is modular for clarity, testability, and extensibility.
agent/cli.py — Orchestrator & CLI (argparse), handles configure command, Docker prerequisite check, and full workflow.agent/process_runner.py — Executes target scripts (subprocess), captures stdout/stderr, determines crash state.agent/error_parser.py — Parses Python tracebacks into structured data via regex.agent/context_manager.py — Extracts faulty function context using ast for high-signal AI prompts.agent/ai_core.py — Prompts and calls Google Gemini, securely loading API key from a .env in the user's home directory.agent/sandbox_verifier.py — Uses Docker SDK to build sandbox environments, apply patches, and verify.agent/reporter.py — Provides human-friendly output with colorama and clean diffs.| Category | Technology |
|---|---|
| Core Language | Python 3.9+ |
| Execution | subprocess, tempfile, pathlib |
| Analysis | ast, inspect, re, traceback, difflib, stack-data |
| AI | Google Gemini via google-generativeai |
| Sandboxing | Docker & Docker SDK for Python; auto-generated Dockerfile and requirements.txt |
| CLI & UX | argparse, colorama, interactive agent configure command |
| Packaging | PyPI with pyproject.toml, versioned CLI entry point |
pip install ai-code-repair-agent
agent configure
agent path/to/your/buggy_script.py
agent path/to/script_with_args.py --input data.csv --output results.json
ai_code_repair_agent/
└─ agent/
├─ __init__.py
├─ cli.py # CLI orchestrator, configure command, Docker check
├─ process_runner.py # Run target script, capture outputs
├─ error_parser.py # Parse tracebacks
├─ context_manager.py # Extract faulty function via AST
├─ ai_core.py # Prompt & call Gemini, load API key
├─ sandbox_verifier.py # Build Docker envs & verify
└─ reporter.py # Colorized results & diffs
.env file in your home directory.Distributed under the MIT License. See LICENSE for details.
Darshan S
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 1.1.2 | 10 Jan 2026 | 6 |
This describes our collected data; it is not a security assessment.
Observed since 21 Oct, 10:13 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:093b75ae193e2baeb231e47c557b1d96f1f20a8206789cbb161d0f8d6d8e6737