Skip to main content

rootzerovault

Constitutional AI Governance SDK for Python — connects your AI agents and tools to the Root Zero Vault constitutional gateway.

Install

pip install rootzerovault

Quick start (live gateway)

from rootzerovault import RzvClient

rzv = RzvClient(gateway="http://localhost:8443")
result = rzv.validate(specimen)
print(result.outcome)  # 'ACCEPT' | 'REJECT'

Quick start (offline / demo mode)

For tests, demos, or offline development without a gateway, use demo_mode=True:

from rootzerovault import RzvClient

rzv = RzvClient(demo_mode=True)
# Governance calls return simulated outcomes instead of raising RzvNotConfiguredError.
# All adapters propagate this through their internal GovernanceClient.

Important: demo_mode is for tests and demos only — never use in production. Without gateway and without demo_mode=True, calls that need governance fail closed with RzvNotConfiguredError.

R&D sandbox vaults

RootZero017008_RAndDIDs of the constitution: "Anyone may create R&D IDs — free, deedless vaults that mimic Root Zero. They serve as sandboxes for education, AI training, and experimentation." The guarantee: "No R&D ID is authentic until converted into a Deeded Vault."

The SDK models this as two distinct, non-interchangeable types — RDVault (a deedless sandbox) and Deed (an authentic, Floor-bearing Deed). mypy rejects passing one where the other is expected, so a sandbox vault can never be silently treated as authentic. convert_to_deed() is the only declared bridge between them.

from rootzerovault import RzvClient

rzv = RzvClient(gateway="http://localhost:8443")

# Create a free, deedless R&D sandbox vault — no authorization required.
vault = rzv.create_sandbox_vault(requested_suffix="myproject")
assert vault.is_authentic is False          # constitutionally pinned
print(vault.ancestry_path)                  # ['(R&D)', '(R&D)myproject']
print(vault.constitutional_quote_blake3)    # pin this to detect deed drift

# Convert it into an authentic Deed when ready to commit. Per
# RootZero017005_CustodianAuthority + RootZero017009_MigrationAndUpgrades,
# conversion requires a Master-Custodian scoped-token credential.
deed = rzv.convert_to_deed(
    vault,
    target_namespace="myprojectcorp",
    master_custodian_auth="rzv-tok-v1:<token_id>:<sig>",
)
assert deed.is_authentic is True
print(deed.converted_from_vault)            # lineage link back to the vault

The conversion path is R&D → Standard → Premium → Trunk (RootZero017008_RAndDIDs). async variants — create_sandbox_vault_async() and convert_to_deed_async() — are also available.

Framework adapters

Out-of-the-box wrappers for common AI/agent frameworks. Each adapter constructs a GovernanceClient that propagates the demo_mode flag from the RzvClient you pass in.

  • LangChain — from rootzerovault.adapters import governed_langchain_tool, GovernedTool
  • CrewAI — from rootzerovault.adapters import governed_crewai_tool, GovernedCrew
  • OpenAI Agents — from rootzerovault.adapters import governed_openai_tool
  • Anthropic — from rootzerovault.adapters import GovernedAnthropic
  • AWS Bedrock — from rootzerovault.adapters import GovernedBedrockClient
  • Google Vertex / Gemini — from rootzerovault.adapters import governed_vertex_tool
  • Azure OpenAI — from rootzerovault.adapters import GovernedAzureOpenAI
  • Cohere — from rootzerovault.adapters import GovernedCohereClient
  • MCP (Model Context Protocol) — from rootzerovault.adapters import GovernedMCPServer, governed_tool
  • A2A (Agent-to-Agent) — from rootzerovault.adapters import GovernedA2AAgent
  • ANP (Agent Network Protocol) — from rootzerovault.adapters import GovernedANPAgent
  • ACP — from rootzerovault.adapters import governed_acp_agent
  • Agno — from rootzerovault.adapters import GovernedAgnoAgent
  • Semantic Kernel — from rootzerovault.adapters import governed_kernel_function
  • Smolagents — from rootzerovault.adapters import GovernedSmolTool
  • PydanticAI — from rootzerovault.adapters import governed_pydantic_tool
  • HTTP — from rootzerovault.adapters import HttpAdapter
  • Database / SQL — from rootzerovault.adapters import GovernedSQLAlchemy
  • gRPC — from rootzerovault.adapters import GovernedGrpcChannel

Optional dependencies are listed under pyproject.toml [project.optional-dependencies]. Install with the framework you need:

pip install rootzerovault[langchain]
pip install rootzerovault[crewai]
pip install rootzerovault[mcp]
# or all at once:
pip install rootzerovault[all]

Genesis

Constitutional anchor — frozen since March 14, 2026. Backdating is detectable by any independent verifier recomputing the hash chain; because the CVID is the deed's own BLAKE3 hash, any alteration yields a different CVID and is immediately detectable.

cvid:blake3:1544ff7dd978d911083bd60a7a4e6ba9647996bfdefb62aa8a045ccb63158867

Testing

pip install -e ".[dev]"
python -m pytest tests/

Tests fall into three implicit categories: unit tests (no optional deps required), adapter tests (each requires its framework's optional dep installed; skipped otherwise), and live-gateway tests (require a running gateway at http://localhost:8443).

License

Dual MIT OR Apache-2.0.

Metadata

Release files for rootzerovault 4.1.0

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

Source distribution (sdist)

Source distribution for rootzerovault 4.1.0
File Size Uploaded
rootzerovault-4.1.0.tar.gz 121.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rootzerovault 4.1.0
File Interpreter ABI Platform
rootzerovault-4.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 224.5 kB

Release files / rootzerovault-4.1.0.tar.gz

Download URL rootzerovault-4.1.0.tar.gz
Size 121.8 kB
Tags Source
SHA-256 checksum
How to use checksums
80117388b51dc1ef6405b7ff1c1da795e734e80a8c7a1e202022bb11669d7d03
BLAKE2b-256 checksum
How to use checksums
411a7bfc5ac37e4fad94f79748f0f0797ecfeb446fa06268c29ef3bf0d814f53
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

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 Jul 14, 2026.

Transparency log

Release files / rootzerovault-4.1.0-py3-none-any.whl

Download URL rootzerovault-4.1.0-py3-none-any.whl
Size 102.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d7892ac6fc38f70bdfee264fc06965dd38a70b3a30f6ff751f5b54d5f8fffc27
BLAKE2b-256 checksum
How to use checksums
a73f1674896300767f7c6132a806a816e17d923047dc7f1c5cddaf79b50283c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

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 Jul 14, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

4.1.0 This release

2 release files

4.0.0

2 release files

3.9.27

2 release files

3.9.10

2 release files

3.9.6

2 release files

3.9.1

2 release files

3.8.2

2 release files

3.8.1

2 release files

3.8.0

2 release files

3.7.0

2 release files

3.6.3

2 release files

3.5.0

2 release files

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