Skip to main content

Public Synth optimizer tooling with a Rust GEPA core.

Project description

synth-optimizers

A shared optimizer platform for AI applications — starting with open-source GEPA on a language-agnostic task contract.

PyPI · Containers · Cookbooks

synth-optimizers provides a shared Rust optimizer core for running search algorithms against any task exposed through the synth-containers HTTP contract.

  • Shared platform core — reusable Rust machinery for container I/O, workspaces, cache profiles, budgets, telemetry, failure handling, and replayable evidence.
  • Algorithm layerGEPA is the first public optimizer; future algorithms can plug into the same platform contract.
  • GEPA runs today — configure GEPA with TOML or GepaConfig; it proposes prompt changes, rolls them out, scores them, keeps a Pareto frontier, and emits inspectable run evidence.

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

The shared synth_optimizer_platform crate is the substrate for optimizer implementations; GEPA is the first algorithm built on top of it.

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 ~/.codex login.
  • OpenRouter proposer — provider-aware Codex config and base URL; OpenRouter works for policy rollouts too.
  • ChatGPT subscription proposerauth_mode = "chatgpt" with required codex_home (OAuth via Codex CLI or opencode-openai-codex-auth); models include gpt-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 usageSYNTH_OPTIMIZERS_TERMINAL=1 prints running token and cost splits (usage total=… policy=… proposer=…).
  • Docker proposerruntime_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 directprovider = "deepseek" with backend = "deepseek_chat" runs the proposer through DeepSeek Chat Completions; OpenRouter DeepSeek slugs remain supported through provider = "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

License

Apache-2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

synth_optimizers-0.2.0.dev202606021646.tar.gz (337.1 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

synth_optimizers-0.2.0.dev202606021646-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.2 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ x86-64

synth_optimizers-0.2.0.dev202606021646-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (6.1 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ ARM64

synth_optimizers-0.2.0.dev202606021646-cp311-abi3-macosx_11_0_arm64.whl (5.6 MB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

File details

Details for the file synth_optimizers-0.2.0.dev202606021646.tar.gz.

File metadata

File hashes

Hashes for synth_optimizers-0.2.0.dev202606021646.tar.gz
Algorithm Hash digest
SHA256 92b03d98e14a2740e22703b319bb22bcc498c6af14e24167d8142996011a46ba
MD5 4b3f6adc5a48f5fb48343c7c113ce99b
BLAKE2b-256 34ee09c51f9beaf24c2b962f654f65b04e4f5163b3befdc2223051d5c0302c0c

See more details on using hashes here.

File details

Details for the file synth_optimizers-0.2.0.dev202606021646-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for synth_optimizers-0.2.0.dev202606021646-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 30b7d278a228ea3d8c2feaef918cb12fb6b6c38174265abbd87a7589c82889d4
MD5 994dde7e60b90003c484ec9cd60c4581
BLAKE2b-256 72558b09bb8ce0e45572e602619d6b3bf05ef04c14d0701fc114cc7a19d51899

See more details on using hashes here.

File details

Details for the file synth_optimizers-0.2.0.dev202606021646-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for synth_optimizers-0.2.0.dev202606021646-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ba8c8ccf7f0995df2e79118e14028f5d5a35f27be448eb8d9005c85b20626da3
MD5 24c3cc36530a17a4fd291e3b4c7d5a04
BLAKE2b-256 682031a0f522a8f77ae78efbbc8ba62fe2f218da424aabf09f00981067dda91d

See more details on using hashes here.

File details

Details for the file synth_optimizers-0.2.0.dev202606021646-cp311-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for synth_optimizers-0.2.0.dev202606021646-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 aa69b9d5e3a6914d077a0ce4c8bb290296bd456f245a772c649e6b61cfd7f581
MD5 f5c4aad49cc511b10a913ce08c550a87
BLAKE2b-256 db66983ec630b98b3940906eb8dd6c85948871777166d8def6f6d74c77e00945

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page