RepGen — Automated Bug Reproduction
Features • Quick Start • Usage • How it works • Paper
Overview
RepGen is a command-line tool that uses Large Language Models to automatically reproduce bugs in software libraries. Given a bug report and a repository, an exploration agent navigates the codebase with tools (search, read, grep, symbol lookup), generates a Python reproduction script, checks it through a four-stage static verification loop, and then — in an isolated virtual environment — actually runs it and verifies that the bug reproduces, refining and retrying on failure.
It is designed for Deep Learning libraries, where reproducing an issue (building a Minimum Reproducible Example) is often the hardest first step of debugging.
Features
- Exploration-based retrieval. Instead of a fixed pipeline, an agent explores the repo step by step (ReAct), gathering exactly the files, symbols, and signatures a reproduction needs.
- Five LLM backends, latest models.
openai,claude,gemini,openrouter, andollama(local, no API key) behind one interface, with a provider-agnostic catalog of state-of-the-art models (repgen models). - Real execution + reproduction verification. After static checks, RepGen
auto-detects dependencies, builds an isolated
venv, and runs the script — streaming output live — then compares the result against the bug report to decide whether the bug actually reproduced, with a confidence score and matching evidence. An LLM execution planner uses your hardware (CPU/RAM/GPU/disk) to classify runs as Quick / Medium / Large and gate long ones behind confirmation. Failed runs are analyzed, refined, and retried. Opt out with--no-executefor the original static-only flow. - Framework-aware & local projects. Choose a target framework (FastAPI,
Flask, Django, Streamlit, or plain Python) for the right scaffold, deps, and
run command; open existing local projects or scaffold new ones (
repgen new). - Static verification gate. Before anything runs, every generated script
passes through four verifiers that produce structured, actionable feedback:
- syntax —
astparse - compilation —
compile()+ focusedpylintbinding checks - pseudo-symbolic execution — an AST abstract interpreter that resolves imports/signatures against what the agent discovered and checks that the reported failing API is actually exercised
- LLM critique — a structured judgement of whether the script reproduces the bug
- syntax —
- Rich CLI. Live exploration/verification views, a syntax-highlighted result,
and a static
report.md/report.jsonper run. - Dynamic, LLM-driven retrieval. The agent reasons over an organized
structural repo map (AST outlines of modules, classes, and signatures) plus a
dependency-free BM25 index — semantic judgement is made by the model, not a
static embedding ranker. No
torch, no model downloads.
Quick Start
# One lightweight install — no ML stack, no model downloads
pip install -e .
Run it with a local model (no API key required):
# Start Ollama separately: `ollama serve` and `ollama pull llama3.1`
repgen run \
--bug-report https://github.com/owner/repo/issues/123 \
--repo https://github.com/owner/repo.git \
--backend ollama --model llama3.1
Or interactively — RepGen will prompt for anything you omit:
repgen run
Usage
repgen run # explore → generate → verify → execute a reproduction
repgen backends # show the 5 backends and which are configured
repgen models # list suggested state-of-the-art models per backend
repgen frameworks # list supported target frameworks
repgen new PATH # scaffold a new local project
repgen open PATH # inspect an existing local project
repgen config show # view effective configuration
repgen config set backend claude
repgen version
Common run options:
| Flag | Description |
|---|---|
-b, --bug-report |
Path or URL to a bug report / GitHub issue |
-r, --repo |
Path or URL to the repository |
--backend |
openai · claude · gemini · openrouter · ollama |
--model |
Model name (defaults per backend) |
--commit |
Check out a specific commit before analysis |
--max-attempts |
Generation attempts per run (default 3) |
--max-explore-steps |
Exploration budget (default 12) |
-f, --framework |
plain · fastapi · flask · django · streamlit |
--execute / --no-execute |
Run the script in an isolated venv and verify reproduction |
--max-exec-retries |
Refine/retry attempts on execution failure (default 2) |
-v, --verbose |
Stream every tool call, command, and finding |
-y, --yes |
Non-interactive (fail if inputs are missing) |
Configuration
Set API keys via environment variables:
export OPENAI_API_KEY="sk-..."
export ANTHROPIC_API_KEY="sk-ant-..."
export GEMINI_API_KEY="AIza..."
export OPENROUTER_API_KEY="sk-or-..."
# Ollama needs no key; override the host with OLLAMA_HOST if remote.
Persistent defaults live in ~/.config/repgen/config.toml (repgen config init).
Resolution order is CLI flags → config file → built-in defaults.
Docker
docker build -t repgen .
docker run --rm repgen backends
Python API
import repgen
script = repgen.reproduce(
bug_report_source="https://github.com/owner/repo/issues/123",
repo_source="https://github.com/owner/repo.git",
backend="openai",
model="gpt-4o",
)
print(script)
How it works
bug report ─► refine ─► EXPLORE ─► generate ─► VERIFY (static) ─► EXECUTE ─► verdict
│ │ (venv) │
RetrievedContext + SymbolIndex ─────┘ plan · run · refine/retry
(unresolved symbols trigger re-exploration)
Artifacts for every run are written to the output directory: the refined report,
the generated reproduce.py, report.md / report.json, and — when execution
runs — the detected requirements.txt and the isolated .venv/.
See the documentation for the full architecture.
GitHub integration
RepGen ships a GitHub Action that reproduces bugs straight from your issue
tracker: label an issue needs-repro and RepGen generates a reproduction
script and posts it back as a comment on that issue.
issue labeled `needs-repro` ─► RepGen (Action) ─► comment with reproduction + report
Add this workflow to your repo (the one whose issues you want reproduced):
# .github/workflows/repgen.yml
name: RepGen
on:
issues:
types: [labeled]
jobs:
reproduce:
if: github.event.label.name == 'needs-repro'
runs-on: ubuntu-latest
permissions:
contents: read
issues: write
steps:
- uses: actions/checkout@v4
with: { fetch-depth: 0 } # full history so RepGen can time-travel
- uses: mehilshah/RepGen@v1
with:
backend: openai
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
That's it — the reusable action (action.yml) does the install,
run, and comment. Prefer to vendor the full workflow instead? Copy
examples/github-action/repgen-repro.yml.
See docs/github-action.md for one-time setup (LLM key
secret, the needs-repro label) and all inputs.
Contributing
pip install -e ".[dev]"
pytest
Contributions are welcome — please open an issue or a PR.
Issues
Open a GitHub issue or contact Mehil Shah at shahmehil@dal.ca.
License
MIT © Mehil Shah
Metadata
Release files for repgen-ai 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| repgen_ai-1.0.1.tar.gz | 102.5 kB | Without provenance | Details for repgen_ai-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| repgen_ai-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for repgen_ai-1.0.1-py3-none-any.whl |
Total release size: 209.7 kB
Release files / repgen_ai-1.0.1.tar.gz
| Download URL | repgen_ai-1.0.1.tar.gz |
|---|---|
| Size | 102.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dd964726c133775f74e62ab9302d0ac4aaae69bd7759eecab56cf09a703032a0
|
|
BLAKE2b-256 checksum How to use checksums |
b90a43f1e95ae204108e5ba04e5ca03ed1db95bb1d110fe87fec37e41a6d9b1d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / repgen_ai-1.0.1-py3-none-any.whl
| Download URL | repgen_ai-1.0.1-py3-none-any.whl |
|---|---|
| Size | 107.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dcfdde2368a9dcfbe24f97d0b3028f52beef97e2b5cee82ddb09e23148423acf
|
|
BLAKE2b-256 checksum How to use checksums |
27e400e9b1a8e2fdcdae30e534b3523ebe041c136adfb650d0b78689ef535289
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Security for repgen-ai 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.