Sweep — Turn GitHub Issues into Pull Requests
AI agent that turns GitHub issues into pull requests automatically. Handles bug fixes and small features with context-aware code generation.
What it is
Sweep is an AI-powered GitHub bot that reads issue descriptions and generates pull requests with the corresponding code changes. You write an issue describing a bug or a small feature, tag Sweep, and it analyzes your codebase, generates a fix, and opens a PR for review.
The project originally ran as a hosted service. The Sweep team has since pivoted to building a JetBrains AI coding assistant plugin, but the codebase remains available as an open-source reference for building AI code generation agents.
How it saves time or tokens
For routine bug fixes and small feature additions, the cycle of reading code, writing a fix, and opening a PR can take 30 minutes or more. Sweep reduces this to the time it takes to write an issue description. The estimated token cost is approximately 496 tokens per workflow.
Sweep also demonstrates a pattern for AI agent design: it scans the full repository for context, plans changes across multiple files, and handles the git workflow (branch, commit, PR) automatically.
How to use
- The hosted Sweep bot is no longer actively maintained. To use Sweep, run it locally or study the codebase:
git clone https://github.com/sweepai/sweep.git
cd sweep
pip install -r requirements.txt
- Configure your GitHub token and OpenAI API key in the environment.
- Run the agent against a repository:
export GITHUB_TOKEN=ghp_...
export OPENAI_API_KEY=sk-...
python -m sweepai.app
Example
# GitHub Issue (tagged for Sweep)
Title: Fix broken pagination on /api/users endpoint
Body:
The /api/users endpoint returns all users instead of
respecting the `page` and `limit` query parameters.
The SQL query in `src/routes/users.ts` is missing
OFFSET and LIMIT clauses.
# Sweep generates a PR:
# - Modifies src/routes/users.ts to add OFFSET/LIMIT
# - Updates the test file to cover pagination
# - Opens PR with description explaining the changes
Related on TokRepo
- AI Tools for Coding -- Other AI coding assistants and agents
- AI Tools for Automation -- Workflow automation tools for development teams
Common pitfalls
- The hosted Sweep bot is no longer actively maintained. Expect to run and modify the codebase yourself if you want to use it.
- Sweep works best for small, well-described issues. Complex multi-file refactors or architectural changes are beyond its current capability.
- Generated PRs still need human review. Sweep can introduce subtle bugs, especially in code with complex business logic or edge cases.
Frequently Asked Questions
The Sweep team has pivoted to building a JetBrains AI plugin. The original GitHub bot codebase is archived but still available. It serves as a reference implementation for building AI code agents.
Yes. The codebase is open-source and can be run locally with your own GitHub token and OpenAI API key. However, you may need to update dependencies and adapt the code since it is no longer actively maintained.
Sweep is designed for small to medium changes: bug fixes, adding a new endpoint, updating configuration. It works across multiple files but struggles with large refactors or changes that require deep architectural understanding.
Sweep uses OpenAI's GPT models for code generation. The codebase can be adapted to use other LLM providers that support the OpenAI API format.
Sweep indexes your repository, builds a map of files and their relationships, and uses this context when generating code. It reads relevant files based on the issue description to understand the code that needs to change.
Citations (3)
- Sweep GitHub Repository— Sweep turns GitHub issues into pull requests using AI
- Sweep README— The team pivoted to a JetBrains AI plugin
- Sweep Documentation— Uses OpenAI GPT models for context-aware code generation
Related on TokRepo
Source & Thanks
sweep — ⭐ 7,600+ JetBrains AI Plugin
Thanks to the Sweep team for pioneering the issue-to-PR workflow. The concept influenced many subsequent AI coding tools.
Discussion
Related Assets
Moodle — Open-Source Learning Management System
The most widely used open-source learning platform, providing course management, assessments, and collaboration tools for educators and organizations worldwide.
Sylius — Headless E-Commerce Framework on Symfony
An open-source headless e-commerce platform built on Symfony and API Platform, designed for developers who need a customizable and API-first commerce solution.
Akaunting — Free Self-Hosted Accounting Software
A free, open-source online accounting application built on Laravel for small businesses and freelancers to manage invoices, expenses, and financial reports.