Public Synth optimizer tooling with a Rust GEPA core.
Project description
synth-optimizers
Prompt optimizers for all AI applications — beginning with open-source GEPA on a language-agnostic task contract.
PyPI · Containers · Cookbooks
synth-optimizers runs GEPA — reflective prompt
evolution (paper) — against any task exposed through the
synth-containers HTTP contract.
Point it at a container and a TOML config; it proposes prompt changes, rolls them out,
scores them, keeps a Pareto frontier, and returns a deployable candidate with replayable
evidence.
- Container boundary — the optimizer only speaks HTTP. It never imports your task code or sees your model credentials.
- Inspectable runs — every candidate carries its prompt diff, per-seed scores, rollout traces, cache profile, and usage.
- Rust core, thin Python — the GEPA state machine is Rust (PyO3); configure runs with
GepaConfigor TOML.
Supported algorithms
| Algorithm | Status | In this repo | Paper & docs |
|---|---|---|---|
| GEPA — reflective prompt evolution | Supported | rust/crates/synth_gepa/ (Rust engine + service), src/synth_optimizers/gepa.py (Python API), skills/gepa/SKILL.md (agent runbook) |
Paper · gepa-ai docs |
More optimizers will land on the shared synth_optimizer_platform crate; GEPA is the first public algorithm.
Install
pip install synth-optimizers
# or
uv add synth-optimizers
Latest daily dev build:
pip install --pre \
synth-containers==0.2.0.dev202605312141 \
synth-optimizers==0.2.0.dev202606010003
uv add --prerelease allow \
synth-containers==0.2.0.dev202605312141 \
synth-optimizers==0.2.0.dev202606010003
Install uv for local development and editable installs.
Local development
Pair this repo with synth-containers
at matching dev versions, then sync and install editable:
cd optimizers
uv sync --group dev
uv pip install -e ../containers
uv pip install -e .
uv run maturin develop --manifest-path rust/crates/synth_optimizers_py/Cargo.toml
Quickstart
A run is defined by TOML (or GepaConfig): which container to talk to, which prompt
modules to optimize, and how to score them.
[container]
url = "http://127.0.0.1:8765"
command = ["uv", "run", "python", "banking77_container/synth_service_app.py", "--port", "8765"]
[candidate]
target_modules = ["stage2_system"]
[seed_candidate]
stage2_system = "Classify the query into exactly one Banking77 intent. Return only the label."
[dataset]
train_seeds = [0, 1, 2, 3, 4, 5, 6, 7]
heldout_seeds = [100, 101, 102, 103]
from synth_containers import Container
from synth_optimizers import GepaConfig, GepaRun, OptimizerRun, TasksetSelection
container = Container("my-task")
with container.serve() as handle:
result = OptimizerRun(
GepaConfig(
container=handle.connection(),
taskset=TasksetSelection(train_ids=["train:0", "train:1"], heldout_ids=["test:100"]),
program=None,
objectives=None,
policy=None,
)
).execute()
print(result.best_candidate)
print(f"cost: ${result.cost_usd:.2f}")
Or load TOML directly: GepaRun.from_toml("gepa.toml").execute().
CLI:
synth-optimizers gepa run --config gepa.toml
synth-optimizers gepa service --db service.sqlite
synth-optimizers events compare --left a.jsonl --right b.jsonl
Runnable task examples: GEPA cookbooks (Banking77, HotpotQA, MiniGrid, TBLite, Crafter).
Authentication and models
Policy models run inside your task container; the reflective proposer runs Codex on the host (or in Docker). Rollout requests never carry proposer keys.
Default OpenAI API key setup:
export OPENAI_API_KEY="sk-..."
export SYNTH_OPTIMIZERS_TERMINAL=1 # optional: live usage in the terminal
[policy]
provider = "openai"
model = "gpt-4.1-nano"
api_key_env = "OPENAI_API_KEY"
[proposer]
backend = "codex_app_server"
runtime_substrate = "local"
provider = "openai"
auth_mode = "api_key"
api_key_env = "OPENAI_API_KEY"
copy_host_auth = false
model = "gpt-5.4-nano"
sandbox_mode = "workspace-write"
approval_policy = "never"
timeout_seconds = 900
OpenRouter proposer (provider = "openrouter", api_key_env = "OPENROUTER_API_KEY") —
policy can stay on OpenAI. See skills/gepa/SKILL.md for full TOML.
Features
- OpenAI API key proposer — run-local Codex home; does not use your host
~/.codexlogin. - OpenRouter proposer — provider-aware Codex config and base URL; OpenRouter works for policy rollouts too.
- ChatGPT subscription proposer —
auth_mode = "chatgpt"with requiredcodex_home(OAuth via Codex CLI or opencode-openai-codex-auth); models includegpt-5.4-mini,gpt-5.3-codex,gpt-5.3-codex-spark,gpt-5.5; proposer usage is $0, policy rollouts still bill normally. - Live usage —
SYNTH_OPTIMIZERS_TERMINAL=1prints running token and cost splits (usage total=… policy=… proposer=…). - Docker proposer —
runtime_substrate = "docker"with[proposer.docker].image; workspaces stage under~/.cache/synth-gepa-docker-workspaces/, sync back, then cleanup; image:docker/codex-gepa-proposer/Dockerfile. - Gemini and other policy providers — supported on the policy side via
[policy].provider,base_url, and container env keys; proposer stays Codex. - DeepSeek direct —
provider = "deepseek"withbackend = "deepseek_chat"runs the proposer through DeepSeek Chat Completions; OpenRouter DeepSeek slugs remain supported throughprovider = "openrouter". - Preflight validation — missing keys, missing
codex_home/auth.json, or disallowed ChatGPT models fail before rollouts start.
Agent docs: skills/gepa/SKILL.md.
Links
- GEPA docs (gepa-ai) — algorithm overview, case studies, and adapter guides
- GEPA paper — GEPA: Reflective Prompt Evolution Can Outperform Reinforcement Learning
- Cookbooks — runnable GEPA examples
- synth-containers — the task contract
- uv — Python package and project manager
- GEPA service OpenAPI
License
Apache-2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file synth_optimizers-0.2.0.dev202606010003.tar.gz.
File metadata
- Download URL: synth_optimizers-0.2.0.dev202606010003.tar.gz
- Upload date:
- Size: 321.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
76f3a002f56b67f86073aa76fe90b800bf0f89f0a7d12e832e4c7ce6087c0009
|
|
| MD5 |
b671c55312f2381b815eaa54cfccfe96
|
|
| BLAKE2b-256 |
2ceb390e5eebda6c20791bfe378a6e252091d944338a776a026b7c394b2e00a8
|
File details
Details for the file synth_optimizers-0.2.0.dev202606010003-cp311-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: synth_optimizers-0.2.0.dev202606010003-cp311-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 5.5 MB
- Tags: CPython 3.11+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e65952b524bf2a764e1eda4a0bdd8a8a2661af197e3077713f903ec90e104627
|
|
| MD5 |
bdf4725ec1824d5660647e3045a24c71
|
|
| BLAKE2b-256 |
639ecba46390d700002daf7b7f10fd7320aedac5ca13cf57f8917f6a60620053
|