An AI-powered coding assistant built using LangGraph, LangChain, and OpenAI GPT models that helps developers analyze, understand, and modify code through natural language instructions.
The agent leverages modern LLM workflows to perform intelligent coding tasks such as answering questions about code, generating implementations, debugging, refactoring, and explaining source files.
- 💬 Chat with your codebase using natural language
- 🧠 AI-powered code generation
- 🐞 Debug existing code
- ♻️ Refactor source code
- 📝 Explain complex code snippets
- 🔍 Analyze project structure
- ⚡ Built with LangGraph for agentic workflows
- 🔑 OpenAI API integration
code-agent/
│
├── app.py # Main application
├── agent.py # AI agent logic
├── prompts.py # System prompts
├── tools.py # Agent tools
├── requirements.txt # Python dependencies
├── .env.example # Environment variables
└── README.md
The exact file structure may vary slightly depending on updates to the repository.
- Python 3.11+
- LangChain
- LangGraph
- OpenAI API
- Streamlit (UI)
- dotenv
git clone https://github.com/techwithprateek/ai-engineering-lab.gitcd ai-engineering-lab/code-agentWindows
python -m venv venv
venv\Scripts\activateLinux/macOS
python3 -m venv venv
source venv/bin/activatepip install -r requirements.txtCreate a .env file inside the project directory.
OPENAI_API_KEY=your_openai_api_keyReplace the value with your own OpenAI API key.
If the project uses Streamlit:
streamlit run app.pyIf it is a Python script:
python app.py- Explain this function.
- Refactor this code.
- Optimize the algorithm.
- Find bugs in this file.
- Generate unit tests.
- Convert this function into a class.
- Improve readability.
- Add documentation.
- Implement missing logic.
User Prompt
│
▼
LangGraph Agent
│
▼
Tool Selection
│
▼
OpenAI GPT Model
│
▼
Generated Response
Typical dependencies include:
- langchain
- langgraph
- openai
- python-dotenv
- streamlit
Install all packages using:
pip install -r requirements.txtExample interaction:
You:
Explain the merge_sort() function.
AI:
The merge_sort function recursively divides the array into halves,
sorts each half independently, and merges them back together,
resulting in O(n log n) time complexity.
- Multi-file code editing
- GitHub integration
- Local LLM support
- Conversation memory
- RAG over repositories
- Docker support
- Unit test generation
- Code review mode
Contributions are welcome!
- Fork the repository.
- Create a new branch.
git checkout -b feature-name- Commit your changes.
git commit -m "Add feature"- Push your branch.
git push origin feature-name- Open a Pull Request.
This project is intended for educational purposes as part of the AI Engineering Lab repository.
- LangChain
- LangGraph
- OpenAI
- AI Engineering Lab by Tech With Prateek
If you found this project helpful, consider giving the repository a ⭐ on GitHub.