Skip to main content

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 EXECUTE answer it reads in full, with the bytes the plane authorized, which differ from yours when a rule rewrote them;
  • sends one complete or one abort, never both, never twice;
  • reports UNKNOWN when the tool raised, since it cannot tell whether the effect happened; raise NotSent only when the bytes never left;
  • returns only when the tool ran and the closing record landed. Anything else raises. Only an EnforceError tells you, in answer.ran, whether the tool ran: entered, and not ended by NotSent. Any other exception is the tool's own, or an interrupt after it returned, raised again once the run was reported UNKNOWN; one your clock or an interrupt raised before the tool, raised again after the abort; or a TypeError or ValueError for a call misused before sending;
  • raises ToolRaised, an EnforceError with 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.15.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for guardana-control 0.15.0
File Size Uploaded Provenance Actions
guardana_control-0.15.0.tar.gz 22.1 kB Without provenance Details for guardana_control-0.15.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for guardana-control 0.15.0
File Interpreter ABI Platform Actions
guardana_control-0.15.0-py3-none-any.whl Python 3 none any Details for guardana_control-0.15.0-py3-none-any.whl

Total release size: 46.5 kB

Release files / guardana_control-0.15.0.tar.gz

Download URL guardana_control-0.15.0.tar.gz
Size 22.1 kB
Tags Source
SHA-256 checksum
How to use checksums
709e8dd807af9784e8ea14307f0b35c1802cb396a56b4b87e9e9a112ce53ff2e
BLAKE2b-256 checksum
How to use checksums
91d233b20b73ba53124b822bbd432e49b05057e6ce538eb93bb44dd45f08cdb4
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.15.0-py3-none-any.whl

Download URL guardana_control-0.15.0-py3-none-any.whl
Size 24.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3570c6622650a5beb6e880dc4974cfbd315e8a0da541b0aab12456d89acf1e36
BLAKE2b-256 checksum
How to use checksums
2c71ec4d89ba419518f994db2727716d7b629a009e30e3726cdf0a4dc5476f9a
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.15.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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page