Skip to main content

complyee-agent-guard

A customer-run companion that puts an Agent Control Room grant check in front of any Python agent tool — LangGraph, CrewAI, LangChain or plain functions. It does the repeatable work (fingerprinting, asking, waiting for a person, claiming, verifying the grant token, reporting the outcome); you supply the action name and the context facts your rules need.

Status: 0.1 (beta). Python 3.9 or later; depends only on httpx and cryptography.

pip install complyee-agent-guard

Agent Control Room is the decision point; this package is the enforcement point that runs inside your agent process. See agent-cr.com/plugins and agent-cr.com/enforcement-point.

Use

import os
from complyee_agent_guard import create_guard, ApprovalPending, ActionRefused, VerifiedGrant

guard = create_guard(
    workspace_url="https://acme.agent-cr.com",  # your workspace address (also the JWT audience)
    api_key=os.environ["ACR_API_KEY"],          # scopes: policy.decide, policy.read
    agent="finance-assistant",
    approvals={"mode": "poll", "poll_timeout_s": 30, "poll_interval_s": 2},  # the defaults
)

@guard.tool(action="refund.issue", context=lambda a: {"amount": a["amount"]})
async def issue_refund(payment_id: str, amount: float, acr_grant: VerifiedGrant = None):
    # Runs only after a verified grant for exactly these arguments.
    return await payments.refund(payment_id, amount, idempotency_key=acr_grant.decision_id)

A plain def tool works the same way, synchronously. Add a parameter named acr_grant to receive the verified grant; it is never part of the fingerprint.

Decorator options: name (tool name, default the function name), action (default the tool name), context, resource_ref, action_description, parent_decision_id (each a function of the arguments), and approvals to override the guard's approval settings for one tool.

When a person must approve

  • "poll" (default): waits up to poll_timeout_s, then claims the grant with the identical request. If nobody answers in time it raises ApprovalPending.
  • "raise": raises ApprovalPending at once — useful when a LangGraph workflow should checkpoint and resume later.
try:
    result = await issue_refund("pay_1", amount=40)
except ApprovalPending as held:
    store.save(held.to_checkpoint())                 # JSON-safe; arguments stay in your store
...
result = await issue_refund.resume(store.load())    # same request, same idempotency key

Fail closed

The tool body never runs when any of these is raised:

Exception Meaning
ActionRefused policy or a person refused, or the arguments cannot be fingerprinted
ApprovalPending a person has not approved yet
GrantInvalid the grant token is missing or failed verification (no fallback to any other format)
GuardUnavailable Agent Control Room could not be reached

Raw arguments never leave your process: they are hashed locally (sha256-canonical-json-v1, identical to ACR and the TypeScript MCP guard) and only the hash is sent. A failed outcome report never changes the tool result.

Tests

pip install -e ".[dev]" && pytest

tests/fixtures/grant.json and tests/fixtures/conformance-vectors.json are generated from Agent Control Room's own code and are shared with the TypeScript companion (complyee/mcp-guard), so all three hash and verify identically. Do not edit them by hand.

License

Apache License 2.0 — see LICENSE. Copyright Complyee AB.

Metadata

Release files for complyee-agent-guard 0.1.1

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

Source distribution (sdist)

Source distribution for complyee-agent-guard 0.1.1
File Size Uploaded Provenance Actions
complyee_agent_guard-0.1.1.tar.gz 24.1 kB With provenance Details for complyee_agent_guard-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for complyee-agent-guard 0.1.1
File Interpreter ABI Platform Actions
complyee_agent_guard-0.1.1-py3-none-any.whl Python 3 none any Details for complyee_agent_guard-0.1.1-py3-none-any.whl

Total release size: 44.9 kB

Release files / complyee_agent_guard-0.1.1.tar.gz

Download URL complyee_agent_guard-0.1.1.tar.gz
Size 24.1 kB
Tags Source
SHA-256 checksum
How to use checksums
96d0c203e90f9f58823e177afbd1d62da248bdbfed9f77961bb01ec4a9ff28b5
BLAKE2b-256 checksum
How to use checksums
f9eb149bc69c1d6add75fe64e992f93e626c470e0e187f8bc38b4ec1c0bf9c48
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Release files / complyee_agent_guard-0.1.1-py3-none-any.whl

Download URL complyee_agent_guard-0.1.1-py3-none-any.whl
Size 20.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6bad502e04dded119996c012c8e4128f81468e33257e137ed027daab6d80b456
BLAKE2b-256 checksum
How to use checksums
334052593c16739a023c7baa65c5ed836f125cc70385b6def7756f6843b9f7c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Security for complyee-agent-guard 0.1.1

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for complyee_agent_guard-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

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