Skip to main content

Shared Synth container and environment runtime substrate

Project description

synth-containers

The task contract for Synth optimizers and evals — wrap any task as a small HTTP service that optimizers can target without touching your code.

PyPI · Optimizers · Cookbooks

A Synth container is a small HTTP service around a task. It owns the dataset, the scoring/verifier logic, the mutable prompt or policy fields, and the policy-model credential boundary. An optimizer like synth-optimizers GEPA sees one URL and a typed rollout contract — it never imports your task package or reads private evaluator state. The same contract works whether the task is a classifier, a coding agent, or a live game environment, and in Python, Rust, or TypeScript.

Install

pip install synth-containers
# or
uv add synth-containers

Latest daily dev build:

pip install --pre synth-containers==0.2.0.dev202605312141
uv add --prerelease allow synth-containers==0.2.0.dev202605312141

Local Better SDK Dev

This branch pair expects:

  • containers: package synth-containers==0.2.0.dev202605312141
  • optimizers: package synth-optimizers==0.2.0.dev202605312141

Install both editable checkouts with uv (sibling repos under your workspace):

cd optimizers
uv sync --group dev
uv pip install -e ../containers
uv pip install -e .

Verify import paths and versions:

uv run python -c "import importlib.metadata as m, synth_containers, synth_optimizers; print(synth_containers.__file__); print(m.version('synth-containers')); print(synth_optimizers.__version__)"

The SDK validation examples (Banking77, TBLite, Crafter, MiniGrid) live in local optimizers/dev_examples/ (gitignored — not shipped in the repo).

The contract

Route Method Purpose
/metadata GET contract version + capabilities
/program GET mutable prompt fields + seed candidate
/dataset GET split names + row counts
/dataset/rows POST rows for a requested seed list
/rollout POST run a candidate on a row → reward + usage
/health GET liveness

The Python SDK also provides Container, Container.serve(), ContainerHandle, and ContainerConnection for URL-only optimizer handoff. Use generic route hints and capability metadata here; optimizer-specific GEPA settings belong in synth-optimizers.

Example

from fastapi import Body, FastAPI
from synth_containers import GEPA_OPTIMIZER_CONTRACT_VERSION

app = FastAPI()

@app.post("/rollout")
def rollout(payload: dict = Body(...)) -> dict:
    candidate, row = payload["candidate"], payload["row"]
    # run the task with the candidate's mutable fields, score it with a real verifier
    return {"reward": ..., "usage": ...}

See the cookbooks for complete containers: Banking77, HotpotQA, MiniGrid, TBLite, and Crafter.

Links

License

MIT

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_containers-0.2.0.dev202605312141.tar.gz (64.4 kB view details)

Uploaded Source

Built Distribution

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

File details

Details for the file synth_containers-0.2.0.dev202605312141.tar.gz.

File metadata

File hashes

Hashes for synth_containers-0.2.0.dev202605312141.tar.gz
Algorithm Hash digest
SHA256 6397f7d2367dbe53f48a4603ab3add890e1c4eca52b4d894b2f967c0760c9dd5
MD5 111ff764c45ea6b844ad18000da35607
BLAKE2b-256 90e03eec07a8919e81a3739a8780e6e8df041bc01aeca4e425e3a67a59c88d6e

See more details on using hashes here.

File details

Details for the file synth_containers-0.2.0.dev202605312141-py3-none-any.whl.

File metadata

File hashes

Hashes for synth_containers-0.2.0.dev202605312141-py3-none-any.whl
Algorithm Hash digest
SHA256 559acf296090f292dd6e0e7b26ff73511ac083e6837c934df69b2352f7d0822b
MD5 8f52e93acc92072e922ff598421b41c0
BLAKE2b-256 e35059f3bf99af16ed315eb39eba6e4baa07c400ff31f5a80072dffcf2b2c8ca

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