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.17.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.17.0
File Size Uploaded Provenance Actions
guardana_control-0.17.0.tar.gz 22.1 kB Without provenance Details for guardana_control-0.17.0.tar.gz

Built distribution (wheel)

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

Total release size: 46.6 kB

Release files / guardana_control-0.17.0.tar.gz

Download URL guardana_control-0.17.0.tar.gz
Size 22.1 kB
Tags Source
SHA-256 checksum
How to use checksums
6dd3de947224a8c8eb13d4e73c8020c443b183a1ac4f746f7ca2762545cf467d
BLAKE2b-256 checksum
How to use checksums
cbc814c1c91260ccf329c07d33eb796c46908294d0cda20195025587f2c58146
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.17.0-py3-none-any.whl

Download URL guardana_control-0.17.0-py3-none-any.whl
Size 24.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3a071c75755e826b0e4fd54040283ccb32583e46806831ca1f6037f091686612
BLAKE2b-256 checksum
How to use checksums
e833bfbc6cb064de5c2c18aadaca1a4787d21d103a9b2abe6155860d2ef63a6d
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.17.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