This project introduces a sophisticated, AI-powered agent capable of autonomously detecting, diagnosing, and correcting errors in Python code. By leveraging a multi-stage graph-based workflow and a long-term memory system, this agent can learn from past mistakes and continuously improve its bug-fixing capabilities. It's a powerful demonstration of how autonomous agents can enhance developer productivity and code reliability.
The agent operates on a state machine orchestrated by LangGraph. When a function fails, the agent initiates a multi-step process to resolve the issue:
- 💻 Code Execution: The agent begins by running the user-provided Python function.
 - 🐞 Error Detection: If the function throws an error, the agent transitions to the bug analysis phase.
 - 📝 Bug Report Generation: An LLM is used to generate a detailed bug report, analyzing the function and the error it produced.
 - 🧠 Memory Search: The agent searches its vector database (ChromaDB) for similar, previously encountered bugs.
 - 💡 Solution Generation & Code Patching: Drawing insights from its memory and the current bug report, the agent generates a potential fix. This "patch" is then applied to the original function.
 - ✅ Validation: The agent re-executes the patched function. If it runs successfully, the process concludes. If not, the cycle continues, refining the solution.
 
- Orchestration: 
LangGraph - LLM Integration: 
LangChain - Web Framework: 
FastAPI - Frontend: 
Streamlit - Vector Database: 
ChromaDB - LLM Providers: 
OpenAI,Google,Groq 
git clone <your-repository-url>
cd code-correction-agentCreate a .env file in the project's root directory and add your API keys:
OPENAI_API_KEY="sk-..."
GROQ_API_KEY="gsk_..."
GOOGLE_API_KEY="AIza..."pip install -r requirements.txtstreamlit run frontend.py