guardana-control
A Python client of the Guardana Control enforcement API. A tool of yours asks a plane before it acts and reports how the call ended, so the policy, the approvals and the evidence trail that cover an MCP call cover it too.
experimental: the contract is v1alpha1 and may change with any release.
Use the client of the plane's own release. Python 3.11 or later, no
dependencies.
pip install guardana-control
From a checkout of the repository, pip install ./clients/python builds it
on your machine 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 for you:
- runs the tool only on an
EXECUTEanswer it reads in full, with the bytes the plane authorized, which differ from yours when a rule rewrote them; - sends one
completeor oneabort, never both, never twice; - reports
UNKNOWNwhen the tool raised, since it cannot tell whether the effect happened; raiseNotSentonly when the bytes never left; - returns only when the tool ran and the closing record landed. Anything else
raises. Only an
EnforceErrortells you, inanswer.ran, whether the tool ran: entered, and not ended byNotSent. Any other exception is the tool's own, or an interrupt after it returned, raised again once the run was reportedUNKNOWN; one your clock or an interrupt raised before the tool, raised again after the abort; or aTypeErrororValueErrorfor a call misused before sending; - raises
ToolRaised, anEnforceErrorwith the outer call's answer, when your tool lets out the exception of a call of its own, alone or in a group of exceptions.
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.
The guide is Decide a tool of your own; the rules a client keeps are the cases in testdata/enforce.
Metadata
Release files for guardana-control 0.16.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.16.0.tar.gz | 22.1 kB | Without provenance | Details for guardana_control-0.16.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| guardana_control-0.16.0-py3-none-any.whl | Python 3 | none | any | Details for guardana_control-0.16.0-py3-none-any.whl |
Total release size: 46.6 kB
Release files / guardana_control-0.16.0.tar.gz
| Download URL | guardana_control-0.16.0.tar.gz |
|---|---|
| Size | 22.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
eaf399b616c9099032974a50983d9c8100c4906b0aa71a558baeef7011a63d16
|
|
BLAKE2b-256 checksum How to use checksums |
e41d6d4e4a542717d9948b7e0e15523190a9d0d9c5f86bd232d0929f47304bb2
|
| 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.16.0-py3-none-any.whl
| Download URL | guardana_control-0.16.0-py3-none-any.whl |
|---|---|
| Size | 24.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
18ebaeae0d3f4ca6475c2ab5beeb5b61faa63116c3dbd2627131a74c249ccb90
|
|
BLAKE2b-256 checksum How to use checksums |
43c6da92e246c6f88f5be8027a7ed8ee660da41ad6288e729c3c0c39286a8309
|
| 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.16.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.