Inspiration
Managing and improving code repositories can be tedious, especially for teams striving to maintain high-quality code. GitAgent was inspired by the need for an AI-driven tool to automate repetitive development tasks like refactoring, creating READMEs, and generating Dockerfiles, saving time and boosting productivity.
What it does
GitAgent is an AI-powered agent for GitHub repositories that simplifies code management. It automates:
- Semantic searching to find what code is responsible for queried features.
- Code refactoring for readability and optimization.
- Intelligent code commenting for better understanding.
- README file generation for seamless onboarding.
- Dockerfile creation for containerized environments.
Due to its agentic nature, GitAgent is directly connected to the GitHub API and is able to directly performs these tasks on your web-hosted GitHub repository!
How I built it
GitAgent was built using:
- Backend: Python with FastAPI to handle API requests to the LLM driving the agent and API calls to the GitHub API
- AI Models: CoHere's Command R+ LLM model along with document based RAG for code analysis and generation.
- GitHub Integration: GitHub REST API connected to an internal RAG document generation pipeline, which is then fed onto the LLM to create a repo-based context.
- Frontend: Streamlit was used for the frontend due to its simple and highly efficient AI-native integrations.
Challenges I ran into
This project had two major hurdles.
The first was passing on an entire codebase into an LLM. The first major challenge was converting the repo tree into an LLM-parseable structure. I accomplished this via a recursive depth first traversal of the Git tree and then appending this structure along with file content into a series of RAG documents. Initially I tried passing it in the prompt but quickly exceeded the input token limit, hence why I went with RAG. Via this robust RAG pipeline I was able to provide the repo as a set of documents to the LLM, allowing it to "learn" the repository and effectively perform its tasks.
The second major hurdle was prompt engineering. To get consistent and accurate performance I needed to provide clear and consise prompts to the LLM, something that took a fair bit of trial and error. While doing this, I also discovered the CoHere beta Prompt Tuner, which also came in use. By creating specific prompts for each usecase of the Agent, I was able to get the expected behaviour from the CoHere model on a consistent basis. While this consumed a fair amount of time and effort, it was also very rewarding once the final product was complete.
Accomplishments that I'm proud of
One major source of pride was how seemless the GitHub integration was. By creating a defined set of actions for the agent and defining an API callback workflow for each one, I was able to effectively directly connect the LLM to the GitHub repo, allowing it to truly behave in an agentic manner. I also gave it the ability to actually commit to a separate branch, allowing a human review of the generated code so that the agent would be able to fit into a normal PR-based environment.
Additionally:
- Successfully automated key developer tasks, reducing the time required for routine maintenance.
- Built an intuitive UI that simplifies complex AI-powered features.
- Created a scalable and modular architecture that can adapt to future use cases.
- Developed a robust README generator that adapts to unique project structures.
What I learned
- How to fine-tune AI models to provide contextually relevant and actionable outputs.
- Effective use of the GitHub REST API for repository automation.
- The importance of user-centric design in building developer tools.
- Strategies to handle edge cases in code analysis and Dockerfile generation.
What's next for GitAgent
- Adding a Merge Assistant to walk through the merging process and any conflict resolution.
- Adding support for CI/CD pipeline generation and configuration.
- Introducing customizable AI prompts for more tailored automation.
- Developing an offline version for teams working on private repositories.
- Expanding integrations to include GitLab and Bitbucket.
Built With
- cohere
- fastapi
- githubapi
- python
- streamlit


Log in or sign up for Devpost to join the conversation.