incant-sdk
Python client for Incant — render prompts through targeting, discover what to pass, and reproduce any render exactly.
pip install incant-sdk
Render
from incant_sdk import Incant
client = Incant() # reads INCANT_URL, INCANT_API_KEY, INCANT_ENVIRONMENT
# or: Incant("https://prompts.internal", key="incant_sk_...", environment="prod")
r = client.render(
"support/system",
flags={"user_id": "u_42", "tier": "pro", "region": "us"}, # who's asking → targeting
variables={"customer_name": "Acme", "history": []}, # template inputs
)
r.text # the rendered prompt (str(r) works too)
r.version, r.sha # exactly what was served
r.matched_rule # "default" or RuleMatch(scope="prompt", id="beta-gets-v3")
Reproduce exactly
Every result carries a pin — log it beside your LLM call, feed it back for a
byte-identical replay (same commits for the prompt and every included fragment,
same historical targeting):
trace.log(prompt_pin=r.pin)
r2 = client.render("support/system", flags=f, variables=v, pin=r.pin)
Discover
for p in client.prompts(): # everything this key can render
print(p.id, p.description, p.default_version)
spec = client.prompt("support/system") # what to pass
spec.variables # [Var(name="customer_name", type="string", required=True, ...), ...]
spec.flags # [Flag(name="tier", values=("enterprise", "pro")), ...]
spec.includes # fragments this prompt pulls in
Debug targeting
client.evaluate("support/system", flags={"user_id": "u_42"}) # version, no render
client.evaluate_all(flags={"user_id": "u_42"}) # every prompt at once
Async
from incant_sdk import AsyncIncant
async with AsyncIncant() as client:
r = await client.render("support/system", flags=..., variables=...)
Same surface, same wire behavior — both clients share one request/parse core.
Errors & resilience
Typed exceptions carry the server's message: PromptNotFound (distinguishes
unknown vs. not-yet-targeted-here), MissingVariable (.variable names it),
NotAuthorized, RenderError, and IncantUnavailable. Renders are pure reads,
so connection failures and 502/503/504 retry automatically (retries=2 with
backoff, configurable) before raising IncantUnavailable.
Release files for incant-sdk 1.0.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 | |
|---|---|---|---|
| incant_sdk-1.0.0.tar.gz | 7.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| incant_sdk-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.9 kB
Release files / incant_sdk-1.0.0.tar.gz
| Download URL | incant_sdk-1.0.0.tar.gz |
|---|---|
| Size | 7.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
161c60e2b9e2ab86d0699907dc7f374f3bb791d974963e65b6de064166386a9c
|
|
BLAKE2b-256 checksum How to use checksums |
712a458c921a597157ad663c19cee5b7f686987f1d6765e28ae5b78d3d83c30b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","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 / incant_sdk-1.0.0-py3-none-any.whl
| Download URL | incant_sdk-1.0.0-py3-none-any.whl |
|---|---|
| Size | 10.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7a94a33fd7b8b7cd2cd7a20de85c92210641a59e9efb1ca4303de5b0dbb2b7fc
|
|
BLAKE2b-256 checksum How to use checksums |
fe55324817d1d41027684044e7241fd24f6ba8d06fa2a67c15f16c6891a2a23f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","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}
|