PatchPal — A Python-Native AI Coding and Automation Agent
Batteries-included by default, lightweight when you need it. Runs on local and small-context models, sandboxed on Linux, macOS, and Windows. Use it from the terminal or as a Python SDK.
PatchPal is a Python-native AI coding agent harness that helps you build software, debug issues, and automate tasks. You can use it interactively through the terminal UI (patchpal) or headless through the Python SDK (agent.run("task")). It supports agent skills, tool use, and generating and running Python code, enabling interactive workflows for tasks such as data analysis, visualization, web scraping, API interactions, and research with synthesized findings. It was originally designed for working with private data (e.g., via local models or AWS GovCloud Bedrock) and on resource-constrained machines.
Batteries-included, or lightweight when you need it. Out of the box, PatchPal includes built-in tools for file editing, shell commands, code analysis, web search, browser automation, and task planning. It also supports skills, MCP, project memory, and autopilot, and installs as a single Python package. For local or small-context models, TinyAgent automatically slims down to five core tools plus optional web tools, with a compact system prompt, handoff compaction, and selective file reading. On larger windows, PATCHPAL_MINIMAL_TOOLS=true gives a similar reduced toolset.
Key Features
- Local Models with small-context-window support (TinyAgent) and ReAct mode
- Sandbox Mode for secure container isolation with network restrictions on Linux, macOS, and Windows
- Python SDK for flexibility and extensibility
- Built-in and Custom Tools
- Terminal Interface for interactive development
- Browser Automation for interactive web tasks, form filling, and JavaScript-heavy sites
- Skills System and MCP Integration
- Autopilot Mode using Ralph Wiggum loops
- Project Memory automatically loads project context from
MEMORY.md(repository root or~/.patchpal/repos/<repo-name>/MEMORY.md) at startup
PatchPal prioritizes customizability: custom tools, custom skills, a flexible Python API, and support for any tool-calling LLM.
Full documentation is here.
Quick Start
$ pip install patchpal # install
$ patchpal --model <model_id> # start
Model support: Any LiteLLM-supported model can be used. Platform support: Linux, macOS, and Windows are all supported
Alternative: Run with Docker/Podman (no installation required)
# Using pre-built image with patchpal installed (default model)
docker run -it --rm \
-v $(pwd):/workspace \
-e ANTHROPIC_API_KEY=$ANTHROPIC_API_KEY \
ghcr.io/amaiya/patchpal-sandbox:latest \
patchpal --model anthropic/claude-sonnet-4-5
# Or with Podman
podman run -it --rm \
-v $(pwd):/workspace \
-e ANTHROPIC_API_KEY=$ANTHROPIC_API_KEY \
ghcr.io/amaiya/patchpal-sandbox:latest \
patchpal --model anthropic/claude-sonnet-4-5
# Specify a different model
docker run -it --rm \
-v $(pwd):/workspace \
-e OPENAI_API_KEY=$OPENAI_API_KEY \
ghcr.io/amaiya/patchpal-sandbox:latest \
patchpal --model openai/gpt-5-mini
Setup
-
Install:
pip install patchpal- Optional: For browser automation (14 additional tools):
pip install patchpal[browser] && python -m playwright install chromium
- Optional: For browser automation (14 additional tools):
-
Get an API key or a Local LLM Engine:
- [Cloud] For Anthropic models (default): Sign up at https://console.anthropic.com/
- [Cloud] For OpenAI models: Get a key from https://platform.openai.com/
- [Local] For vLLM: Install from https://docs.vllm.ai/ (free - no API charges) Recommended for Local Use
- [Local] For Ollama: Install from https://ollama.com/ (⚠️ set
OLLAMA_CONTEXT_LENGTH, e.g.,16384or32768- see Ollama section below) - For other providers: Check the LiteLLM documentation
-
Set up your API key as environment variable:
# For Anthropic (default)
export ANTHROPIC_API_KEY=your_api_key_here
# For OpenAI
export OPENAI_API_KEY=your_api_key_here
# For vLLM - API key required only if configured
export HOSTED_VLLM_API_BASE=http://localhost:8000 # depends on your vLLM setup
export HOSTED_VLLM_API_KEY=token-abc123 # optional depending on your vLLM setup
# For Ollama, no API key required
# For other providers, check LiteLLM docs
- Run PatchPal:
# Use default model (anthropic/claude-sonnet-4-5)
patchpal
# Use a specific model via command-line argument
patchpal --model openai/gpt-5.2-codex # or openai/gpt-5-mini, anthropic/claude-opus-4-5, etc.
# Use vLLM (local)
# Note: vLLM server must be started with --tool-call-parser and --enable-auto-tool-choice
export HOSTED_VLLM_API_BASE=http://localhost:8000
export HOSTED_VLLM_API_KEY=token-abc123
patchpal --model hosted_vllm/openai/gpt-oss-120b
# Use Ollama (local - set OLLAMA_CONTEXT_LENGTH and PATCHPAL_CONTEXT_LIMIT to the same window)
export OLLAMA_CONTEXT_LENGTH=16384 # or set the context length in the Ollama app's Settings
PATCHPAL_CONTEXT_LIMIT=16384 patchpal --model ollama_chat/gemma4:e4b
# Or set the model via environment variable
export PATCHPAL_MODEL=openai/gpt-5.2
patchpal
Tip for Local Models: Local models (i.e., models served by Ollama or vLLM) work best with these settings:
- Always: set
PATCHPAL_CONTEXT_LIMITto your served window (e.g.,32768to matchOLLAMA_CONTEXT_LENGTH=32768, or16384on resource-constrained machines). PatchPal can't detect it from the server. At 64K or less, PatchPal uses TinyAgent, which includes minimal tools plus small-window compaction and reading. - Model with function calling, window over 64K:
PATCHPAL_MINIMAL_TOOLS=truelimits tools toread_file,read_lines,write_file,edit_file,run_shell, reducing tool confusion. - Model without function calling:
PATCHPAL_REACT_MODE=trueenables text-based tool invocation (see ReAct mode docs). - Ollama:
PATCHPAL_STREAM_OUTPUT=falsewas a workaround for unreliable streamed tool calls. PatchPal now handles Ollama's streamed tool calls correctly, so this may no longer be needed; try it if tool calls still fail. - Offline:
PATCHPAL_ENABLE_WEB=falsedisables web tools.
Beyond Coding: General Problem-Solving
While originally designed for software development, PatchPal is also a general-purpose assistant. With web search, file operations, shell commands, and custom tools/skills, it can help with research, data analysis, document processing, log file analyses, etc.
FAQ
There are so many coding agent harnesses. Why build yet another one?
- Most agent harnesses are built in TypeScript. We wanted something in Python that we could easily extend for our custom workflows.
- PatchPal includes a unique guardrails system that is better suited to privacy-conscious use cases involving sensitive data.
- We needed an agent harness that seamlessly works with both local and cloud models, including AWS GovCloud Bedrock models.
I noticed there's another package called PatchPal on GitLab. Are they related?
No, they're separate projects. The project with the same name on GitLab is unrelated to this one.
On Windows Subsystem for Linux (WSL), why is it stalling intermittently at "Thinking..."?
This is a known issue with WSL2.
Try examining and then lowering the mtu:
$ cat /sys/class/net/eth1/mtu
1427
$ sudo ip link set eth1 mtu 1400
Documentation
Full documentation is available here.
Metadata
Release files for patchpal 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 |
|---|---|---|---|---|
| patchpal-1.0.1.tar.gz | 271.9 kB | With provenance | Details for patchpal-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| patchpal-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for patchpal-1.0.1-py3-none-any.whl |
Total release size: 483.4 kB
Release files / patchpal-1.0.1.tar.gz
| Download URL | patchpal-1.0.1.tar.gz |
|---|---|
| Size | 271.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3f9a2165fe80c46ae8a5b091f4a9f1b1e5d480ecc3bebe1280043605d3dcec06
|
|
BLAKE2b-256 checksum How to use checksums |
69e8cabb4a98e03539d579f6eb218a9261a7925e42d52e8b24774c294bcffd08
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.
Transparency logRelease files / patchpal-1.0.1-py3-none-any.whl
| Download URL | patchpal-1.0.1-py3-none-any.whl |
|---|---|
| Size | 211.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c2c5963401f6c529ae62c5f487ef8bc3f73d000c87872293c822a19bd59e0647
|
|
BLAKE2b-256 checksum How to use checksums |
f078d6390704c4cf35ff270ee79574d2e6288e176464db3c3197bd7853aa559c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.
Transparency logSecurity for patchpal 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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for patchpal-1.0.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.
Transparency logA 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.