Priompt Python client
The piece your Python app imports to fetch its prompts. Instead of hard-coding prompt text in your source, your app asks a Priompt server for it by address — and can be notified the moment a prompt changes.
🐍 Your Python app
│
▼
PromptClient (this library) ──gRPC: get / list / diff──▶ 🗄️ Priompt server
│ ▲ │
│ └──────────── "prompt changed" push (NATS) ───────────┘
▼
Optional local cache (cache_ttl seconds)
Install
pip install priompt-sdk # published as priompt-sdk; imports as `priompt_sdk`
pip install "priompt-sdk[nats]" # add the [nats] extra if you use subscribe()
After install, import it as priompt_sdk:
from priompt_sdk import PromptClient
Five lines to your first prompt
from priompt_sdk import PromptClient
client = PromptClient(host="localhost:8443") # token=... if auth is on
prompt = client.get("priompt://acme/onboarding/welcome")
print(prompt.template) # Hi {name}, welcome to {org}!
text = prompt.template.format(name="Ada", org="Acme")
What comes back from get():
| Field | Example | Meaning |
|---|---|---|
template |
Hi {name}, welcome to {org}! |
The prompt text, with {placeholders} |
slots |
['name', 'org'] |
The blanks your app fills in |
version_hash |
80ec4e4d… |
Fingerprint of this exact content |
commit_hash |
1e8284… |
Set when you fetched a pinned ref — the commit you got |
Connecting
One environment variable configures everything:
PRIOMPT_URL=priompt://<token>@host:port carries the address and the
credential, so PromptClient() with no arguments just works — and moving
between local, self-hosted, and cloud is a one-variable change.
PromptClient(host=None, token=None, tls=False, ca_cert=None,
client_cert=None, client_key=None,
cache_ttl=0, nats_url=None, url=None)
| Parameter | What it does |
|---|---|
host |
address:port of the server. Optional if url or PRIOMPT_URL is set |
url |
a full priompt://<token>@host:port string; defaults to PRIOMPT_URL |
token |
sent as authorization: Bearer <token>; defaults to PRIOMPT_TOKEN, then the url's token |
tls / ca_cert |
use TLS, optionally pinning a CA certificate |
cache_ttl |
local cache lifetime in seconds (0 = off) — repeat gets within the TTL never touch the network |
nats_url |
endpoint for subscribe() |
Everything the client can do
client.get(uri, ref="") # fetch a prompt (ref = branch or commit hash to pin a version)
client.list(prefix="") # browse a repo (URI prefix) like a folder
client.diff(uri, new_template) # semantic diff: stored version vs. your draft
client.subscribe(uri, on_change, reload=None) # be notified when the prompt changes
client.close()
Browse a repo like a filesystem:
for e in client.list("priompt://acme/support/"):
print(e.uri, e.version_hash)
# priompt://acme/support/tier1/agent 1e8284f35650
# priompt://acme/support/tier2/agent 80ec4e4d88e6
Pin a version (ignore future changes until you decide to upgrade):
prompt = client.get("priompt://acme/support/agent", ref="1e8284f35650")
Live updates
When someone publishes a new version, the server pushes a notification that includes a semantic verdict — how far the change's meaning shift spreads through the prompt. Your app decides what to act on and what to hold:
✍️ Author ──publish new version──▶ Priompt server
│
"changed! verdict: localized tweak" (via NATS)
▼
🐍 Your app
│
┌────────────────────────────┴────────────────────────────┐
verdict within your policy verdict is structural, or absent
│ │
▼ ▼
re-fetch and reload keep current version, alert a human
client = PromptClient(host="…:8443", cache_ttl=30, nats_url="nats://…:4222")
# Which verdicts this app acts on by itself. Everything else waits for a human —
# including an empty verdict, which means the server could not classify the
# change and published anyway. "" does not mean "safe"; it means nobody checked.
AUTO_RELOAD = {"minor edit", "localized tweak", "new"}
def on_change(version, classification):
if classification in AUTO_RELOAD:
reload(version) # contained change — pick it up
else:
alert_a_human(version) # structural, or unclassified — hold it
# reload= is the same policy for the client cache: an accepted change is fetched
# into the cache before on_change runs; a held one is not, so get() keeps
# returning the old version until cache_ttl expires. Default: hold everything.
client.subscribe("priompt://acme/support/agent", on_change,
reload=AUTO_RELOAD) # needs the [nats] extra
The verdict measures spread, not risk. A one-line edit turning "offer a
refund when reasonable" into "never offer a refund" reads as a localized tweak — correctly, since the rest of the prompt still means what it did — and
is still a policy reversal worth a human's eyes. Where you draw the line is your
policy; the verdict is triage, not approval.
Treat the event as "something changed" and re-fetch with get() rather than
trusting the version in the payload.
Push is best-effort; the cache_ttl is the convergence guarantee — even a
missed notification only delays a refresh by one TTL.
For maintainers of this library
priompt_sdk/v1/ contains gRPC stubs generated from the shared proto repo
(../proto — the single source of truth for the contract; this repo carries
no copy). To regenerate after a proto change, install
buf and run:
buf generate
The proto package is priompt.v1, so buf writes the stubs under priompt/v1/.
Move them into priompt_sdk/v1/ and change the one generated Python import in
prompt_pb2_grpc.py from from priompt.v1 import ... to
from priompt_sdk.v1 import .... Leave the .priompt.v1.* service paths and
the serialized descriptor untouched — those are the gRPC wire contract. See the
note in buf.gen.yaml for the exact steps.
Tests: pip install -e . pytest && pytest -q.
TLS and mTLS
# TLS with a private CA (the usual self-hosted case)
PromptClient(host="prompts.internal:8443", token="…", tls=True, ca_cert="ca.crt")
# mTLS — for a server started with -client-ca, which refuses connections
# without a certificate signed by that CA, before authentication runs
PromptClient(host="prompts.internal:8443", token="…", tls=True,
ca_cert="ca.crt", client_cert="client.crt", client_key="client.key")
ca_cert, client_cert and client_key are file paths. client_cert and
client_key must be given together.
Metadata
Release files for priompt-sdk 0.7.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| priompt_sdk-0.7.1.tar.gz | 23.1 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| priompt_sdk-0.7.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 40.4 kB
Release files / priompt_sdk-0.7.1.tar.gz
| Download URL | priompt_sdk-0.7.1.tar.gz |
|---|---|
| Size | 23.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
641ff1e2ffb1de69d3c2762ae27a89c5949c13e4598443d69ba178baa7f4f924
|
|
BLAKE2b-256 checksum How to use checksums |
19a8579002e5d9bf3f9db3ca2d90e1e2cfa6aa6457d0c6406e92497f2c164cc5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.
Transparency logRelease files / priompt_sdk-0.7.1-py3-none-any.whl
| Download URL | priompt_sdk-0.7.1-py3-none-any.whl |
|---|---|
| Size | 17.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6df1ca7d0ba4530b3ca55f3689a37bbb05278f9b482fdf52150916a1bb7fd965
|
|
BLAKE2b-256 checksum How to use checksums |
2975098db3030a5a4ea9ffbfc11f6fdd9c330d5d8bf5a3a766f51e8ecf381a89
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.
Transparency logSecurity for priompt-sdk 0.7.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for priompt_sdk-0.7.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.