Python SDK

A zero-dependency, stdlib-only Python client for the PolicyVault REST API.

The Python client (python/policyvault_client/) is a thin, stdlib-only client (urllib.request + json, zero third-party runtime dependencies, Python ≥ 3.10) over the same REST API described in REST API. It implements none of the following — every one of these decisions is a server round trip into the same pipeline every client uses:

financial authority, transaction-policy semantics, successor-state derivation, governance authority or classification, risk decision composition, transaction verification, signer authorization, reconciliation truth, fee/mass computation, or key custody/signing.

The JS/Python asymmetry, stated honestly

The JavaScript SDK ships the portable deterministic core, so a browser using it can independently re-derive and verify an intent manifest before signing — catching a manipulated server without trusting it. The Python client has no port of that core and cannot perform that independent re-derivation. If your use case needs independent pre-sign verification (the strongest security property PolicyVault's clients offer), use the JavaScript SDK or the browser's own verification path; the Python client is documented honestly as not providing it.

Method surface

AreaMethods
health / discoveryhealth, readiness, capabilities, assert_compatible
networknetwork_status, fuel
vaultslist_vaults, get_vault, vault_status, vault_audit, reconcile_vault
audit / manifestsaudit, get_manifest
v0.4 requestssimulate, build_request, create_vault, list_requests, get_request, approve_request, finalize_request, submit_request, genesis_submit, reject_request
governancelist_proposals, get_proposal, create_proposal, approve_proposal, cancel_proposal
riskget_risk_evaluation, release_risk_evaluation

readiness() returns its body for both a healthy and an unready response — an unready server is a well-formed answer, not an error. create_vault() is the one method that forwards a caller-supplied mapping rather than a closed local schema, because the create route's normalization rules (KAS-to-sompi conversion, live-DAA-score-relative period math) are owned by the server; modelling them client-side would risk silent drift.

Credential handling

The client never logs, prints, or otherwise exposes a bearer token — verified by test coverage across repr/str/exceptions/tracebacks/ pickle/vars() and by asserting every import in the package is a Python standard-library import (no dependency could smuggle in logging behavior).

Amount hygiene

The same integer-sompi discipline as the JavaScript SDK: amounts are strings on the wire, parsed with rules ported from the canonical JavaScript amount parser, and a float anywhere in a request body is refused rather than silently rounded.

Status

DESIGNED + IMPLEMENTED + UNIT-TESTED + INTEGRATION-PROVEN — 75 tests passing, including an integration suite that starts a real PolicyVault server from this source tree and drives it over real HTTP with a real Schnorr-signed wallet session and real machine credentials (full-scope and read-only), proving deny-by-default scopes, idempotency replay/conflict behavior, and verbatim error-envelope pass-through. Not testnet-verified as a package, not production-hardened, not externally reviewed. Not published to a package index — publication of any PolicyVault artifact is a separate, deliberate decision.

python3 -m unittest discover -s tests -t .

See also: JavaScript SDK, Local intent verification.