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.

No release carries it yet. From a checkout of the repository:

pip install ./clients/python

That builds the package 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, raised again after its run was reported UNKNOWN, or a TypeError or ValueError for a call misused before anything was sent;
  • 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.12.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.12.0
File Size Uploaded Provenance Actions
guardana_control-0.12.0.tar.gz 21.6 kB Without provenance Details for guardana_control-0.12.0.tar.gz

Built distribution (wheel)

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

Total release size: 45.5 kB

Release files / guardana_control-0.12.0.tar.gz

Download URL guardana_control-0.12.0.tar.gz
Size 21.6 kB
Tags Source
SHA-256 checksum
How to use checksums
a0d770499a2ce5c55b94300c67b52a80e061ca00cc547b298eacc5e78674fb8d
BLAKE2b-256 checksum
How to use checksums
84d447102aa4e25c0e0e556184895bbc4e9fa5c132a4de2f2962c612265f2e9e
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.12.0-py3-none-any.whl

Download URL guardana_control-0.12.0-py3-none-any.whl
Size 23.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ef3724ecd7de68d294b7c8b23e565d45f8e8938b061667cd870bc636f7bba96e
BLAKE2b-256 checksum
How to use checksums
dca5433fe2caffc39181cac6f82b5a624f0c2f1a5cff71dd7d256da4b3e99792
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.12.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