An autonomous repo-maintainer that listens for GitHub issues and automatically generates code fixes, commits them, and opens pull requests — powered by a local LLM via Ollama.
GitHub Issue Opened
|
v
GitHub Webhook (POST /webhook)
|
v
listener.py (FastAPI server)
|
v
agent.py
├── scanner.py → Ollama identifies the relevant file
├── Ollama generates the code fix
├── git commit & push to new branch
└── gh pr create → Pull Request opened
- A new issue is opened on your GitHub repository.
- GitHub sends a webhook to the listener.
- The listener triggers the agent with the issue title and body.
- The scanner uses Ollama (Llama 3.1) to identify which file the issue relates to.
- The agent reads the file, asks Ollama to generate a fix, and writes it back.
- The agent commits the change, pushes a new branch, and opens a PR via the GitHub CLI.
| Dependency | Purpose |
|---|---|
| Python 3.10+ | Runtime |
| Ollama | Local LLM inference |
GitHub CLI (gh) |
PR creation & auth |
| ngrok | Expose local server to GitHub |
git clone https://github.com/yashasviudayan-py/PR-Agent.git
cd PR-Agent
pip install -r requirements.txtollama pull llama3.1:8b-instruct-q8_0
ollama servepython listener.pyYou should see: INFO: Uvicorn running on http://0.0.0.0:8000
In a separate terminal:
ngrok http 8000Copy the Forwarding URL (e.g., https://abc123.ngrok-free.app).
- Go to your repository on GitHub.
- Navigate to Settings > Webhooks > Add webhook.
- Payload URL:
<your-ngrok-url>/webhook - Content type:
application/json - Events: Select "Let me select individual events" and check Issues.
- Click Add webhook.
Pull the pre-built image from Docker Hub:
docker pull yashasviudayan/pr-agent:latestOr run it directly:
docker run -p 8000:8000 yashasviudayan/pr-agent:latestNote: The container includes Python, git, and GitHub CLI. You still need Ollama running on the host (accessible at
host.docker.internal:11434).
Open an issue on the repository. The agent will automatically:
- Identify the relevant file.
- Generate a code fix using Ollama.
- Open a pull request with the changes.
.
├── .github/
│ └── workflows/
│ └── docker-publish.yml # CI/CD: auto-push to Docker Hub
├── listener.py # FastAPI webhook server
├── agent.py # Orchestrator: scan → fix → commit → PR
├── scanner.py # LLM-powered file identification
├── Dockerfile # Container image definition
├── requirements.txt # Python dependencies
├── LICENSE # MIT License
├── .env # Environment variables (not committed)
├── .dockerignore
└── .gitignore
This project is licensed under the MIT License.