Skip to content

Guard

High-level verification API. Wraps the constraint engine with a simple check/block interface.

Module: munio.guard


Unified tool call security for Python agent frameworks.

Usage::

guard = Guard(constraints="generic")
# Check an action
result = guard.check(Action(tool="http_request", args={"url": "..."}))
# Universal decorator
@guard.verify()
def call_tool(url: str, method: str = "GET"):
return requests.get(url)

Args: constraints: Constraint pack name (default: “generic”). mode: Verification mode (enforce, shadow, disabled). config: Full ConstraintConfig (overrides constraints/mode if provided). registry: Pre-built ConstraintRegistry (for testing; skips disk loading). constraints_dir: Path to constraints directory (overrides config default).

Parameters:

NameTypeDefault
constraintsstr’generic’
modeVerificationModeVerificationMode.ENFORCE
config`ConstraintConfigNone`
registry`ConstraintRegistryNone`
constraints_dir`Pathstr
temporal_store`TemporalStoreNone`

Fields:

NameTypeDescription
verifierVerifierAccess the underlying Verifier (for advanced use/testing).

Methods:

  • check(action) -> VerificationResult Verify an action and return the result (does not raise on violations).
  • acheck(action) -> VerificationResult Verify an action asynchronously (does not raise).
  • verify(constraints) -> Callable[..., Any] Universal decorator for verifying function calls.

Raised when a decorated function is blocked by constraint verification.

Attributes: result: The VerificationResult that caused the block.

Parameters:

NameTypeDefault
resultVerificationResult

Fields:

NameTypeDescription
result

Auto-generated from source code. Do not edit manually.