Skip to main content

🤖 Patch Pilot

Documentation GitHub Stars License: MIT

📖 Live Documentation & Interactive FAQs: https://agent-docs-coral.vercel.app#patch-pilot

Patch Pilot Live Terminal Demo

An autonomous test-driven code healing and bug patching agent with universal model support.

Patch Pilot inspects your local repository, analyzes bug descriptions, pinpoints root-cause files, iteratively applies patches, executes your test suite, and feeds back error stack traces until tests pass and changes are committed cleanly to Git.

🌐 Universal Model Support (Bring Your Own Key)

Patch Pilot works with all major AI providers or entirely local setups:

Provider Supported Models Environment Variable
Anthropic Claude claude-3-5-sonnet-20241022, claude-3-7-sonnet export ANTHROPIC_API_KEY="..."
OpenAI gpt-4o, gpt-4o-mini, o1, o3-mini export OPENAI_API_KEY="..."
Google Gemini gemini-2.5-flash, gemini-2.5-pro, gemini-1.5-pro export GEMINI_API_KEY="..."
DeepSeek deepseek-chat, deepseek-reasoner export DEEPSEEK_API_KEY="..."
NVIDIA Nemotron nvidia/nemotron-4-340b-instruct export NVIDIA_API_KEY="..."
OpenRouter 200+ models across all frontier labs export OPENROUTER_API_KEY="..."
Local / Self-Hosted Ollama (qwen2.5-coder, llama3.2, deepseek-r1), vLLM --base-url http://localhost:11434/v1

🌟 Key Capabilities

  • Multi-Model Intelligence: Fix code using Claude 3.5 Sonnet, GPT-4o, Gemini 2.5, DeepSeek-Coder, or local Ollama.
  • Automatic Test Runner Detection: Supports pytest, unittest, npm test, cargo test, and go test with zero configuration.
  • Iterative Self-Healing Loop: If a patch fails the test suite, Patch Pilot captures the exact error tracebacks and re-prompts the model to refine the fix.
  • Git Branch & Commit Automation: Automatically isolates changes in a dedicated Git feature branch and writes conventional commit messages upon test verification.

🚀 Quick Start

1. Installation

git clone https://github.com/shubhransh-gupta/patch-pilot.git
cd patch-pilot
pip install -e .

⚡ Use as a GitHub Action in Your CI/CD

You can drop Patch Pilot directly into any repository's CI pipeline to automatically self-heal failing builds:

- name: Run Patch Pilot Self-Healing
  uses: shubhransh-gupta/patch-pilot@v1
  with:
    api-key: ${{ secrets.GEMINI_API_KEY }}
    provider: 'gemini'
    issue: 'Fix failing unit tests in CI build'

2. Set Your Preferred API Key

Choose any provider:

# Option A: Anthropic Claude (Great for complex reasoning)
export ANTHROPIC_API_KEY="sk-ant-..."

# Option B: OpenAI
export OPENAI_API_KEY="sk-proj-..."

# Option C: Google Gemini
export GEMINI_API_KEY="AIzaSy..."

# Option D: DeepSeek
export DEEPSEEK_API_KEY="sk-..."

3. Run Patch Pilot Inside Any Repo

cd my-project/

# Auto-detects provider from your exported environment variable
patch-pilot "Fix KeyError when parsing optional config headers in client.py"

# Or explicitly choose provider and model
patch-pilot "Fix race condition in token refresher" --provider anthropic --model claude-3-5-sonnet-20241022

# Or run with local Ollama
patch-pilot "Fix off-by-one error in pagination" --base-url http://localhost:11434/v1 --model qwen2.5-coder

⚙️ Options

patch-pilot [ISSUE] [OPTIONS]

Options:
  --provider, -p TEXT     LLM provider: gemini, openai, anthropic, deepseek, nvidia, ollama, openrouter
  --model, -m TEXT        Specific model identifier
  --base-url TEXT         Custom API base URL (for Ollama, vLLM, etc.)
  --repo, -r PATH         Path to local repository (default: .)
  --test-cmd, -t TEXT     Custom test command (e.g. 'pytest tests/test_auth.py')
  --max-attempts INT      Max self-healing iterations (default: 4)
  --api-key, -k TEXT      Explicit API key override
  --no-branch             Skip automatic git branch creation

📦 Project Structure

patch-pilot/
├── patch_pilot/
│   ├── agent.py       # Core self-healing loop and diagnosis orchestrator
│   ├── llm.py         # Universal multi-provider LLM interface (Claude/GPT/Gemini/Ollama)
│   ├── runner.py      # Subprocess test executor and framework detector
│   ├── git_ops.py     # Git branch and commit wrapper
│   ├── config.py      # Configuration and model settings
│   └── cli.py         # Rich terminal interface
└── pyproject.toml     # Packaging and entry points

📄 License

MIT License. Copyright (c) 2026 Shubhransh Gupta.

Metadata

Release files for patch-pilot-ai 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for patch-pilot-ai 0.1.0
File Size Uploaded Provenance Actions
patch_pilot_ai-0.1.0.tar.gz 14.1 kB Without provenance Details for patch_pilot_ai-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for patch-pilot-ai 0.1.0
File Interpreter ABI Platform Actions
patch_pilot_ai-0.1.0-py3-none-any.whl Python 3 none any Details for patch_pilot_ai-0.1.0-py3-none-any.whl

Total release size: 28.2 kB

Release files / patch_pilot_ai-0.1.0.tar.gz

Download URL patch_pilot_ai-0.1.0.tar.gz
Size 14.1 kB
Tags Source
SHA-256 checksum
How to use checksums
2d502a04e873caee6a3bdaa7671f24f7846f67a0c572c144d730c62c13edf811
BLAKE2b-256 checksum
How to use checksums
ef2e8f29f3938073147e24936136f7bcdb1bd273225217031179b2ec971e4c71
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.0

Release files / patch_pilot_ai-0.1.0-py3-none-any.whl

Download URL patch_pilot_ai-0.1.0-py3-none-any.whl
Size 14.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2b98b336dbba487e709a434f3e8fc17ed5613cb3922a7ef98bd65d0ebf5b20e9
BLAKE2b-256 checksum
How to use checksums
eef50ba76278f5df33cd3ff2008c31e3dca62d45fe7127359637a0d670c1e72b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.0

Security for patch-pilot-ai 0.1.0

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page