guardana-control
Python client for the Guardana Control enforcement API. Your tool asks a plane before acting and reports the outcome. The same policy, approvals and evidence trail apply as for an MCP call.
This client is experimental. Its v1alpha1 contract may change with any
release. Use the client from the plane's release. Python 3.11 or later, no
dependencies.
pip install guardana-control
From a repository checkout, pip install ./clients/python builds locally
with flit_core.
from guardana_control.enforce import (
CallBlocked,
CallPending,
Client,
Result,
Status,
)
client = Client(socket="/run/guardana/enforce.sock", token=run_token, timeout=5.0)
def refund(authorized: bytes) -> Result:
receipt = payments.refund(authorized) # send exactly these bytes
return Result(Status.SUCCESS, value=receipt)
try:
answer = client.call("refund", b'{"order_id":"ord-1"}', refund)
except CallBlocked as blocked:
... # the tool did not run; blocked.answer.decision says why
except CallPending as held:
... # an approver decides; ask again after held.answer.held.retry_after
What call does:
- Runs the tool only after reading an
EXECUTEanswer in full. It uses plane-authorized bytes, which differ from yours when a rule rewrites them. - Sends one
completeorabort, never both or twice. - Reports
UNKNOWNif the tool raises, since the effect is uncertain. RaiseNotSentonly when the bytes never left. - Returns only if the tool ran and the closing record was written. Otherwise
it raises. Among exceptions, only
EnforceErrorexposesanswer.ran, which says whether the tool was entered and did not exit viaNotSent. - For other exceptions,
callreportsUNKNOWNbefore reraising the tool's own exception or an interrupt that follows the tool's return. After sendingabort, it reraises an exception from your clock or an interrupt before the tool ran. Misuse raisesTypeErrororValueErrorbefore sending. - Raises
ToolRaised, anEnforceErrorwith the outer call's answer, if the tool lets an exception from its own call escape, alone or in a group.
It cooperates and is not a security boundary. It runs inside the process it
constrains, so a plane reports its calls as decided, not enforced.
Verify an evidence trail
guardana_control.trail is a second verifier based on
Trail verification.
It uses only the standard library to check evidence exports against
checkpoints offline and makes no decisions.
python -m guardana_control.trail verify --export <file>... \
--checkpoints <file> --plane <id>=<public-key-file>... \
--tenant <id> --project <id>
See the guide Decide a tool of your own. The cases in testdata/enforce show the rules clients follow.
Metadata
Release files for guardana-control 0.21.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 | Provenance | Actions |
|---|---|---|---|---|
| guardana_control-0.21.0.tar.gz | 45.2 kB | Without provenance | Details for guardana_control-0.21.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| guardana_control-0.21.0-py3-none-any.whl | Python 3 | none | any | Details for guardana_control-0.21.0-py3-none-any.whl |
Total release size: 98.5 kB
Release files / guardana_control-0.21.0.tar.gz
| Download URL | guardana_control-0.21.0.tar.gz |
|---|---|
| Size | 45.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a8dc92d906849c9c4554fcadb7bd8126695fb213dbe790af3f200faee5803126
|
|
BLAKE2b-256 checksum How to use checksums |
b3101b78e2fad9907e0d1449958f8ab96a936bb0f3a20b0286e0407084ff53f2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.9 {"installer":{"name":"uv","version":"0.12.9","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 / guardana_control-0.21.0-py3-none-any.whl
| Download URL | guardana_control-0.21.0-py3-none-any.whl |
|---|---|
| Size | 53.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7c3744cbf79341d9342b7a83d3ce10150c7429b3ffd3a4ac8c8a052dc247eff5
|
|
BLAKE2b-256 checksum How to use checksums |
d55832010b8c27e89011dae7068ce1297907c3d924fee6ecfca537b0f94720b3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.9 {"installer":{"name":"uv","version":"0.12.9","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}
|
Security for guardana-control 0.21.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.