Skip to content

About

LLM-driven evolution of prompts and pipelines. Evolves the prompt and the pipeline's parameters together against your labeled data, cuts losing candidates early, and shows every measurement behind the winner. Open source.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

7 stars

Watchers

0 watching

Forks

Latest commit

 

History

2,742 Commits

Folders and files

Repository files navigation

An LLM-driven prompt optimizer for the whole pipeline

The Potter PromptPotter

PyPI Python License: MIT-RG

Give it examples where you know the right answer. It evolves your prompt and your pipeline's settings,
and hands back the winner with every measurement behind it.

Try it in the browser  ·  Install  ·  Docs  ·  Watch a live run

Your examples go into PromptPotter; your AI goes in hand-patched and comes out tuned

Fits your stack if it answers two calls

┌──────────────────────┐                       ┌──────────────────────┐
│  Your Backend        │  GET  /pipeline   ──► │  PromptPotter        │
│  (any pipeline)      │                       │  Optimizer           │
│                      │  POST /matches    ◄── │                      │
│  runs the task       │   {prompt, params}    │  generates candidates│
│                      │                       │  scores + critiques  │
│                      │  → predictions    ──► │  iterates            │
└──────────────────────┘                       └──────────────────────┘

LangGraph, CrewAI, n8n, Dify or plain FastAPI: put it behind these two endpoints and it can be tuned (how). In the browser app there is nothing to set up. You get back one file, export.json, with the winning settings.

Not just a prompt optimizer, a universal one: the prompt sits inside the model, the model inside the settings, the settings inside any program (pipelines, agents and skills, loops); freeze any part

Whatever your service exposes, it can tune. Whatever you lock, it leaves alone.

Why PromptPotter

  • 💸 Stops paying for losers. A version that cannot win is cut after a handful of examples.
  • 🎯 Won't let you fool yourself. Each round says whether its gain is noise; one command grades the winner on held-out examples.
  • 🔍 Every number opens down to the call. The exact input, the answer, the expected answer, paid or replayed.
  • 🌳 Searches a tree, not a line. When progress stalls it rewrites its own search plan or backs up to an earlier version.
  • ⚖️ Runs the others too. GEPA, CAPO and LEVI run inside it, under one grader and one budget.
  • 🤖 Runs from Claude Code. /potter-run launches the run, watches it and explains every round.

The Candidates card across 11 real campaigns: candidate fitness per round, with the lineage tree under each chart

11 real campaigns: each dot is a scored version, the crown marks the one that stands,
the tree shows who was bred from whom. In-run scores, not held-out results.

Run it where your data lives

☁️ We run it Online, zero setup. Free to try, or bring your own key. app.promptpotter.com
💻 You run it Local, on your own keys. We never see your data. pip install promptpotter
🤖 Your AI runs it Claude Code launches and supervises the run; the browser app stays live. /potter-run
👥 Your team runs it Self-hosted, multi-user. We never see your data. deploy-linux/

From Python you need Python 3.13+ and an OpenRouter key in OPENROUTER_API_KEY for the optimizer's own calls (other providers).

Against your own pipeline, from the terminal. Start the backend from the diagram above before new; without one, use the browser.

pip install "promptpotter[all]"
python -m promptpotter new tickets.csv --set raw_task_description="classify support tickets by urgency"
python -m promptpotter resume        # Ctrl+C pauses; resume picks up where it stopped

The shipped example datasets run against TermNorm on :8000; in Claude Code, /potter-run starts it for you. To watch locally: python -X utf8 -m uvicorn promptpotter.main:app --port 8001, then open http://localhost:8001/.

In DSPy: a drop-in optimizer, no backend needed

Use it where you would reach for MIPROv2 or GEPA. It runs inside your process, with no extra service:

# pip install "promptpotter[dspy]"
from promptpotter.presentation.teleprompter import PromptPotterOpt

optimizer = PromptPotterOpt(metric=my_metric, dataset_name="my-task")
compiled = optimizer.compile(my_program, trainset=trainset)

A walk through the app: the chat thread, the run card, the dashboard, the sample leaderboard, one opened cell

The app: the chat where a run starts, the round-by-round scoreboard, and one example opened down to the call.

A round, in four steps

  1. Generate. An LLM reads the last round's misses and writes a few new versions of the prompt and its settings.
  2. Score. Each version runs on your examples. A version that falls behind is cut as soon as it cannot win.
  3. Critique. It reads each miss to steer what the next round tries; the round's winner becomes the next starting point.
  4. Escalate. When progress stalls, it rewrites how it searches, or backs up the lineage tree and tries another branch. It stops on your goal, your budget or a plateau.
One real round, replayed from its log: the third version is cut after 7 of 34 examples

Replay of one real round: three candidates measured, the third eliminated after 7 of 34 samples

Three versions race on 34 examples; the third is cut after 7, so its other 27 calls are never paid for (how the cut is decided).

Under the hood: the statistics and the search

The loop: generate, score and critique repeat until a stopping rule fires; L2 and L3 escalate lazily on a stall

  • The cut is Posterior-of-Being-Best: a version stops when its chance of being the best falls under a bar (candidate elimination).
  • The score is a Rasch ability (θ), so versions measured on different examples still compare on one scale; each round says when its lift is noise (what a winner's number may claim).
  • The search has three layers: L1 proposes versions, L2 rewrites how L1 searches when L1 stalls, L3 rewrites the plan when L2 stalls. When a branch is spent, a UCB rule picks the ancestor to re-expand: AlphaZero-shaped tree search over the lineage, with deterministic scoring in place of rollouts (the loop, the mapping).
  • Self-optimization (L4): the optimizer is itself a pipeline of nodes, so it can be pointed at its own optimizer prompts (L4). Research, run from a checkout.
  • A campaign is a folder on disk. Each round is a JSON file the app renders as a scoreboard; pause, resume, rewind to any round, or fork a sibling and compare (persistence and recovery).

Same family as GEPA. A wider reach.

PromptPotter belongs to the same family as GEPA, MIPROv2 and CAPO: an LLM proposes versions, a scorer ranks them, the winners breed.

GEPA PromptPotter
Tunes model, temperature and pipeline thresholds together with the prompt partly ✓
Stops scoring a losing version early partly ✓
Prices every measurement, cache hits included ✗ ✓
Open and inspectable: code on GitHub, a browser app, a run you pause, resume, rewind or fork partly ✓

GEPA is ahead on reach: it ships inside DSPy's ecosystem. PromptPotter is also a bench: GEPA, CAPO and LEVI run inside it as optimizers under one grader, one budget meter and one stopping rule. The capability comparison is not a benchmark result (the landscape, what we measure on).

Works with what you already run
You built it with How PromptPotter meets it
LangGraph, CrewAI, the OpenAI Agents SDK, Bedrock Agents, n8n, Dify, plain FastAPI Two HTTP endpoints on your backend; the knobs your pipeline declares become what is tuned (backend integration)
DSPy PromptPotterOpt, in place of MIPROv2 or GEPA (DSPy guide)
An agent in a sandbox Each version runs as a Harbor trial, graded by the task's own checker
OpenRouter, OpenAI, Anthropic, Groq Any of them, for your pipeline and for the optimizer

What you get back: export.json, the winning prompt and settings by field name, with the evidence behind them. We never load, host, route or hot-swap anything in your production path.

What is stable, what is beta
  • 🟢 Stable: the campaign loop from the CLI, the local app and /potter-run; the HTTP connector and its export.json; pause, resume, rewind (resume --from N) and fork; the head-to-head bench (GEPA, CAPO and the rest under one grader and one budget); the zero-spend offline run.
  • 🟡 Beta: the hosted app and the team box (accounts, delegates, API keys, the wallet); the MCP host tools; embedded Python, whose surface still changes between releases; the n8n, Harbor and DSPy connectors.
  • 🧪 Research: L4 self-optimization (promptpotter-self), run from a checkout.
Limitations
  • Parameters only. Prompts, thresholds, model settings; never model weights or architectures.
  • It needs a known answer or a checker. Each example's expected output, or the backend's own grader (Harbor).
  • In-run scores are not held-out scores. The number to quote is the winner's score on held-out examples no optimizer saw: python -m promptpotter held-out.
Contributing
git clone https://github.com/PromptPotter/prompt-potter-optimizer && cd prompt-potter-optimizer
python scripts/gate.py          # every check CI runs; the first run builds .venv from uv.lock

Five entry points share one engine: the webapp, /potter-run, the CLI, the REST API, and embedded Python. Every optimizer runs end to end at zero spend (offline run), so a change can prove it moves no decision the loop makes. Start at the developer guide, then CONTRIBUTING.md.

Docs: the manual · docs index · architecture · roadmap

If PromptPotter saves you an afternoon of prompt fiddling, a ⭐ helps the next person find it.

Citation

@software{promptpotter,
  title  = {PromptPotter: LLM-Driven Evolution of Prompts and Pipelines},
  author = {Streuli, David},
  year   = {2026},
  url    = {https://github.com/PromptPotter/prompt-potter-optimizer}
}

About

LLM-driven evolution of prompts and pipelines. Evolves the prompt and the pipeline's parameters together against your labeled data, cuts losing candidates early, and shows every measurement behind the winner. Open source.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

7 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages