Skip to main content

Mizara - programmable authorization layer for AI actions

Project description

Mizara SDK - Python

PyPI Python License

Authorization layer for AI agents. Call authorize() before any consequential action. Sub-2ms evaluation, policy-as-data, cryptographic receipt on every decision.

Also available for TypeScript/Node.js: @mizara/sdk

Install

pip install mizara

Quickstart

Local policy file

from mizara import create_mizara_client

mizara = create_mizara_client(policy_path="./policy.json")

result = mizara.authorize(
    actor={"id": "agent_support_v4", "type": "autonomous_agent"},
    action={"name": "execute_refund"},
    resource={"type": "monetary_transaction", "id": "tx_99210",
              "attributes": {"amount": 75, "currency": "USD"}},
)

if result.status == "DENY":
    raise Exception(result.enforcement.user_facing_error)
# result.status                   -> 'ALLOW' | 'DENY' | 'REDACT' | 'RE_ROUTE'
# result.cryptographic_receipt.id -> 'rcpt_8f3c...'

Hosted API - sign up at mizara.ai/signup, skip the local file:

import os
from mizara import create_mizara_client

mizara = create_mizara_client(
    api_key=os.environ["MIZARA_API_KEY"],
    client_id="acme_corp",
)

result = mizara.authorize(
    actor={"id": "agent_1", "type": "autonomous_agent"},
    action={"name": "execute_refund"},
    resource={"type": "monetary_transaction", "id": "tx_1",
              "attributes": {"amount": 75}},
)

Policy format

Plain JSON. No Rego, no Cedar syntax.

{
  "policy_id": "pol_refund_v1",
  "client_id": "acme_corp",
  "rules": [
    {
      "id": "rule_max_refund",
      "target_action": "execute_refund",
      "condition": "resource.attributes.amount <= 50.00",
      "effect": "ALLOW",
      "fallback_effect": "DENY",
      "remediation_message": "Refund exceeds the $50 unapproved threshold."
    }
  ]
}

Condition expressions support comparisons, boolean logic, arithmetic, and .contains():

resource.attributes.amount <= 50.00
context.jurisdiction == 'EU' && context.data_classification.contains('PII')
context.session_total + resource.attributes.amount <= 500

Integrations

Framework Example
LangGraph examples/langgraph/
OpenAI Agents SDK examples/openai-agents/
Hosted API examples/hosted-api/

Design choices

Fail closed. No matching rule returns DENY, not ALLOW.

Most restrictive wins. When more than one rule matches an action, the most restrictive triggered outcome wins - DENY > RE_ROUTE > REDACT > ALLOW - regardless of rule order.

Policy as data. Rules live in a JSON file that non-engineers can edit without a deploy.

No Cedar or Rego. Conditions are plain boolean expressions. The engine compiles them safely without eval().

Receipt on every call. Even ALLOW decisions are signed and stored. The audit trail is part of the product, not an afterthought.

License

Apache-2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mizara-0.3.0.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mizara-0.3.0-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file mizara-0.3.0.tar.gz.

File metadata

  • Download URL: mizara-0.3.0.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for mizara-0.3.0.tar.gz
Algorithm Hash digest
SHA256 4952078284033f61e051a8ae3c5719300ebd2e0225d0331adae0b81365c3e5a8
MD5 8d161327a1f9a0f1e09dfd33ebf9eef1
BLAKE2b-256 6b8cedbfae62e3cd68a98a9f5c92decfdebc0206b0ae1b6c9cbf9a44102fef94

See more details on using hashes here.

File details

Details for the file mizara-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: mizara-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 10.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for mizara-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1c7e08f1cc275c8fcc2527385fc1409d1b614fc2c6216eea34adafae952c0f99
MD5 3381bfcf54b4f62a6c9846ee7eb8d592
BLAKE2b-256 56e5081b756a75be02431de5a129ad38648d3d25999c5cf849edb7b90b70bef2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page