Skip to main content

PatchPal — A Python-Native AI Coding and Automation Agent

PatchPal Screenshot

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

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

  1. Install: pip install patchpal

    • Optional: For browser automation (14 additional tools): pip install patchpal[browser] && python -m playwright install chromium
  2. Get an API key or a Local LLM Engine:

  3. 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
  1. 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

# Use any OpenAI-compatible server (e.g., PolyStrata, llama.cpp, LM Studio) - include /v1 in the URL
# OPENAI_API_KEY can be any non-empty value if the server doesn't check keys
OPENAI_API_BASE=http://127.0.0.1:8080/v1 OPENAI_API_KEY=dummy PATCHPAL_CONTEXT_LIMIT=32768 \
  patchpal --model openai/<served-model-name>

# 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_LIMIT to your served window (e.g., 32768 to match OLLAMA_CONTEXT_LENGTH=32768, or 16384 on 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=true limits tools to read_file, read_lines, write_file, edit_file, run_shell, reducing tool confusion.
  • Model without function calling: PATCHPAL_REACT_MODE=true enables text-based tool invocation (see ReAct mode docs).
  • Ollama: PATCHPAL_STREAM_OUTPUT=false was 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=false disables 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.

PatchPal as General Assistant

FAQ

There are so many coding agent harnesses. Why build yet another one?

  1. Most agent harnesses are built in TypeScript. We wanted something in Python that we could easily extend for our custom workflows.
  2. PatchPal includes a unique guardrails system that is better suited to privacy-conscious use cases involving sensitive data.
  3. 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.2

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

Source distribution (sdist)

Source distribution for patchpal 1.0.2
File Size Uploaded Provenance Actions
patchpal-1.0.2.tar.gz 284.2 kB With provenance Details for patchpal-1.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for patchpal 1.0.2
File Interpreter ABI Platform Actions
patchpal-1.0.2-py3-none-any.whl Python 3 none any Details for patchpal-1.0.2-py3-none-any.whl

Total release size: 502.1 kB

Release files / patchpal-1.0.2.tar.gz

Download URL patchpal-1.0.2.tar.gz
Size 284.2 kB
Tags Source
SHA-256 checksum
How to use checksums
0fab5fbe7ae573b6e39b85eea8de5d5bbf8766429a72eb47b54c6cc2f73f290a
BLAKE2b-256 checksum
How to use checksums
c14cb0eae7e95db788cc9b6f8d58f9777dabef05740559ce37e297af0501fd01
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 Dec 1, 2026.

Transparency log

Release files / patchpal-1.0.2-py3-none-any.whl

Download URL patchpal-1.0.2-py3-none-any.whl
Size 217.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3956adacbbb7486c8aba8e218b85b220ea29db271b717e29e485b4e54bdf0cd1
BLAKE2b-256 checksum
How to use checksums
1fc8163fb3ec44b9c852fc815eef6a31887fc9d534e2fcff6fa16f6a8ccb8273
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 Dec 1, 2026.

Transparency log

Security for patchpal 1.0.2

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.

Select from 2 files

Attestation for patchpal-1.0.2.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 Dec 1, 2026.

Transparency log

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

1.0.2 This release

2 release files Full 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