Skip to main content

promptuna-server

Server surface for the promptuna evaluation 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 POST while one is running returns 409 with {"detail":"another job is already running"}.
  • model and proposer_model are free-text strings (provider:model-id); they are not in /api/catalog.
  • summary in GET /api/jobs/{job_id} is null while manifest.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.

Download files

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

Source Distribution

promptuna_server-1.34.0.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

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

promptuna_server-1.34.0-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file promptuna_server-1.34.0.tar.gz.

File metadata

  • Download URL: promptuna_server-1.34.0.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","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}

File hashes

Hashes for promptuna_server-1.34.0.tar.gz
Algorithm Hash digest
SHA256 35e6dd7a05c5445fc85087e404adc20d49794f221e17ef7d4f6fb64cf0ebb4b6
MD5 3f4a6a03553107c616c11692aaa3a110
BLAKE2b-256 9e4146a8a67bf353fac37a237404c830ea501283f8b663a692eedec5b02dfbe2

See more details on using hashes here.

File details

Details for the file promptuna_server-1.34.0-py3-none-any.whl.

File metadata

  • Download URL: promptuna_server-1.34.0-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","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}

File hashes

Hashes for promptuna_server-1.34.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d24653fa397d57e142441688673cd7d5a87677b49aa8c5e77583bd97570d81b0
MD5 4cb555770fe5528e382c740fa9cb6331
BLAKE2b-256 34e7ba29efaa3b085c75e5c15173a20dadb34c29a6eee056697d04456835b79b

See more details on using hashes here.

Release history Release notifications | RSS feed

1.35.3

2 files

1.35.2

2 files

1.35.1

2 files

1.35.0

2 files

This release

1.34.0 This release

2 files

1.33.0

2 files

1.32.0

2 files

1.31.0

2 files

1.30.0

2 files

1.29.0

2 files

1.28.0

2 files

1.27.0

2 files

1.26.0

2 files

1.25.1

2 files

1.25.0

2 files

1.24.0

2 files

Supported by

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