promptuna-server
Server surface for the
promptunaevaluation harness. See the main project README for the full overview, library API, and usage surfaces.
HTTP + SSE transport for promptuna jobs (run, evaluate, optimize).
This package is transport only. It does not define evaluation logic — that lives in the core promptuna library. On-disk projects are resolved via promptuna.projects; user projects do not belong in this directory.
Install (PyPI)
pip install promptuna-server
uvicorn promptuna_server.main:app --port 6969
Set PROMPTUNA_PROJECTS_ROOT to a directory of on-disk projects (see samples/README.md for layout). In a dev checkout, just server from the repo root is equivalent.
Development
From the repository root:
just server
Uses bundled samples/ by default. Override the projects root:
PROMPTUNA_PROJECTS_ROOT=/path/to/projects just server
The API listens on port 6969. All routes are under the /api prefix (e.g. GET /api/health). Interactive OpenAPI docs: http://127.0.0.1:6969/docs.
For the browser UI in a separate dev server, see frontend/README.md.
HTTP API
Authoritative definitions: main.py, schemas.py.
| Method | Path | Purpose |
|---|---|---|
GET |
/api/health |
Liveness ({"status":"ok"}) |
GET |
/api/catalog |
Projects and artifact names for selectors |
POST |
/api/run |
Start a run job → { "job_id": "…" } |
POST |
/api/evaluate |
Start an evaluate job |
POST |
/api/optimize |
Start an optimize job |
GET |
/api/jobs |
List persisted jobs (newest first) |
GET |
/api/jobs/{job_id} |
Replay: { manifest, events, summary } |
GET |
/api/jobs/{job_id}/events |
SSE stream until the job completes |
Constraints
- One job at a time in memory. A second
POSTwhile one is running returns 409 with{"detail":"another job is already running"}. modelandproposer_modelare free-text strings (provider:model-id); they are not in/api/catalog.repeats(default1) runs every example that many times to average out LM stochasticity; it applies to the whole dataset. Judge-side replication is not settable over HTTP — it lives on the metric in the project'smetrics.py.summaryinGET /api/jobs/{job_id}isnullwhilemanifest.status === "running".
Job persistence
Completed jobs are written under <projects_root>/jobs/<job_id>/ as manifest.json, append-only events.jsonl, and a terminal summary.json.
SSE events
Each streamed line is a JSON envelope (src/promptuna/serialize.py):
{
"seq": 0,
"job_id": "uuid",
"step_index": 0,
"type": "trial | scoring | step | proposal | error",
"payload": {}
}
For run and evaluate, step_index is always 0. For optimize, trials, scorings, and proposals within one optimization step share the same step_index; it increments only after a step event.
Clients and PUBLIC_API_URL
HTTP clients (including the SvelteKit frontend) set PUBLIC_API_URL to the API origin only — e.g. http://127.0.0.1:6969 — and append /api to each path. In the Docker image the UI is same-origin and PUBLIC_API_URL is left empty so requests go to /api/... on port 8080.
Docker (UI + API in one container)
From the repository root:
just docker-build
just docker-run
Open http://localhost:8080. The image bundles samples/; mount your own projects and pass API keys:
just docker-run -v /path/to/projects:/projects -e PROMPTUNA_PROJECTS_ROOT=/projects
Uses podman when available, otherwise docker. Rebuild after code changes — the image is a snapshot at build time.
Released images are published to GitHub Container Registry on each version tag:
podman pull ghcr.io/nachollorca/promptuna:latest
podman run --rm -p 8080:8080 --env-file .env ghcr.io/nachollorca/promptuna:latest
Set the package visibility to public in GitHub (Packages → promptuna → Package settings) so users can pull without logging in.
A future promptuna serve command will wrap uvicorn and accept --projects-root explicitly.
Metadata
Release files for promptuna-server 1.38.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| promptuna_server-1.38.0.tar.gz | 7.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| promptuna_server-1.38.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 16.1 kB
Release files / promptuna_server-1.38.0.tar.gz
| Download URL | promptuna_server-1.38.0.tar.gz |
|---|---|
| Size | 7.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
affb5b497f520150d07102e657bc0c641b916ec77b4d70744c4bef52fa7a6afb
|
|
BLAKE2b-256 checksum How to use checksums |
0437c6c67d6e8771ca5f5c148ad0dad4469ca5e54fb31cc32237352fc5d9f11a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.18 {"installer":{"name":"uv","version":"0.12.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / promptuna_server-1.38.0-py3-none-any.whl
| Download URL | promptuna_server-1.38.0-py3-none-any.whl |
|---|---|
| Size | 8.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
94b81f533891311fccd4715606e2a8c2f1b98a020510e70f9dc550459c937868
|
|
BLAKE2b-256 checksum How to use checksums |
dfebc3001ebc18ff31b0f99bee1166b27aaf6cb76f13547f0b694159a9b075ef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.18 {"installer":{"name":"uv","version":"0.12.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|