Make your AI agent enforce safety rules by construction and keep a verifiable audit log — works with OpenAI tool-calling, LangChain or MCP. Open source, no dependencies.
pip install meniw-protocol
from meniw_protocol import MeniwGate, Enforcer, ProhibitedActionError gate = MeniwGate.from_default(ledger_path="compliance.ledger.jsonl") agent = Enforcer(gate) @agent.tool(categories=["lethal"]) # an absolute prohibition def fire_actuator(): ... @agent.tool(irreversible=True) # two-person rule def wipe_database(): ...
fire_actuator() # raises ProhibitedActionError — never runs
wipe_database(_gov={"cosigners": ["alice"]}) # raises — one signer is not enough
wipe_database(_gov={"cosigners": ["alice","bob"]})# runs, and is recorded
from meniw_protocol.adapters import guard_openai_tool_call, governed_tool, guard_mcp_call # OpenAI tool-calls, LangChain tools, and MCP tools/call are all supported.
meniw-verify compliance.ledger.jsonl # [meniw-verify] VALID: OK — N receipts, chain intact (INVALID + exit 1 if tampered)
That's it. Every decision is now enforced before it runs and recorded in a tamper-evident, hash-chained ledger an auditor can verify — useful for EU AI Act record-keeping (Art. 12) and human oversight (Art. 14).
PyPI · runnable examples · guardrails comparison · audit log · EU AI Act