Inspiration

Every developer knows the pain: a bug gets reported in GitLab, and before writing a single line of code, you've spent 30 minutes reading the issue, hunting through the repo, creating a branch, and writing a merge request description. We wanted to build an agent that handles all of that — autonomously, but always with a human in control of the final call.

What it does

PR Pilot is an autonomous GitLab merge-request copilot for small dev teams. You paste a GitLab issue URL, and the agent:

  1. Reads the issue title and description from GitLab
  2. Scans the repository file structure to understand the codebase
  3. Proposes a step-by-step fix plan and identifies the exact file to edit
  4. Waits for your explicit approval (the Human Approval Gate)
  5. Generates a code patch, creates a new Git branch, commits the fix, and opens a Merge Request with a professional reviewer summary

How we built it

  • Backend: FastAPI (Python) orchestrates a multi-agent pipeline — a Planner Agent, a Patch Agent, and a Summarizer Agent — each powered by the Google Gemini API (gemini-2.0-flash).
  • GitLab Integration: The python-gitlab library handles all real repository actions: reading issues, fetching file trees, creating branches, committing patches, and opening MRs.
  • Frontend: A React + Vite UI styled with TailwindCSS, featuring a dark-mode design with step-by-step status states and a clear approval gate.

Challenges we faced

  • Ensuring Gemini returned structured JSON reliably for the planning step required careful prompt engineering.
  • Handling GitLab's fine-grained token permission system to allow the agent to write to repositories.
  • Keeping the human approval gate front-and-center so the agent never takes irreversible action without consent.

What we learned

Building a true agent (not just a chatbot) means designing around tool use, multi-step reasoning, and real-world side effects. The hardest part is not the AI — it's the "guard rails" that make it trustworthy.

What's next for PR Pilot

  • Support for multiple file edits in a single patch
  • Slack/Discord notifications when the MR is ready for review
  • A task history dashboard so teams can track agent-created MRs over time

Built With

Share this project:

Updates