Tutorial · 5 minutes

Add verifiable governance to your AI agent in 5 minutes

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.

1. Install

pip install meniw-protocol

2. Load the gate and wrap your tools

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(): ...

3. Enforce by construction

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

4. Or gate your provider directly

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.

5. Verify compliance (anyone can)

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).

More

PyPI · runnable examples · guardrails comparison · audit log · EU AI Act

By Chris Meniw — author of the Universal Declaration of AI Agents (The Meniw Protocol), creator of ZOE (agentic AI). DOI 10.5281/zenodo.20481373 · Software DOI 10.5281/zenodo.20583872 · chrismeniwfoundation.org