Vizier Guard (Python SDK)
Python client for Vizier, a deterministic authorization service for AI agent actions. Calls go to a hosted (or self-hosted) Vizier service over HTTPS.
Vizier is a deterministic policy kernel that evaluates proposed AI agent actions before they cause external side-effects (payments, database mutations, external messages, code execution, worker deployments). The policy decision itself is local to the service and uses no model; every client call is still a network request to the service, so end-to-end latency includes your network round trip and has not been benchmarked here.
Installation
pip install vizier-guard==0.3.5
Zero external dependencies required out of the box (uses Python standard library).
Receipt verification requires the optional receipts extra.
Install it with pip install 'vizier-guard[receipts]==0.3.5'. A signed response
fails closed when the verifier is unavailable.
Model Context Protocol (MCP) Server (Claude Desktop, Cursor: untested examples)
vizier-guard includes a first-class MCP server that equips Claude Desktop, Cursor, Zed, and Windsurf with deterministic authorization and audit tools. The configurations below are examples and have not been tested on each of these clients; only the stdio MCP server itself is covered by this package's tests:
vizier_screen_actionreturns a signed, request-bound decision in connected mode. Remote failures returnBLOCK. A clean local check returnsREVIEWand grants no execution authority.vizier_verify_receiptverifies an ES256 RESTreceipt_jwsusing the configured service's public keys. Pass the exact normalized REST request asexpected_requestor its independently computed SHA-256 asexpected_request_hash. The tool accepts receipts within five minutes of issuance. Check the signed decision and enforce operation idempotency separately.vizier_check_policy: Scans inputs/parameters for leaked API keys (DLP), sanctions matches, or loop storms.
Claude Desktop Configuration (claude_desktop_config.json, untested)
Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"vizier": {
"command": "uvx",
"args": ["--from", "vizier-guard[receipts]", "vizier-guard", "mcp"],
"env": {
"VIZIER_BASE_URL": "https://vizier.agendamcp.dpdns.org",
"VIZIER_API_KEY": "your-vizier-api-key"
}
}
}
}
Or using an existing Python environment:
{
"mcpServers": {
"vizier": {
"command": "python",
"args": ["-m", "vizier.mcp"],
"env": {
"VIZIER_BASE_URL": "https://vizier.agendamcp.dpdns.org",
"VIZIER_API_KEY": "your-vizier-api-key"
}
}
}
}
The local stdio connector uses the initialize-based session lifecycle. It
preserves 2025-11-25, 2025-06-18, 2025-03-26 and 2024-11-05, and
counter-offers 2025-11-25 for an unsupported revision. It does not negotiate
stateless 2026-07-28 through initialize. Use the hosted HTTP endpoint's
server/discover sequence when you need that separate protocol era.
Cursor Configuration (.cursor/mcp.json, untested)
{
"mcpServers": {
"vizier": {
"command": "uvx",
"args": ["vizier-guard", "mcp"]
}
}
}
First BLOCK, with a checked receipt
Start with the local TypeScript + Python walkthrough.
It needs no production credential, runs a real local Worker, and checks that an
unsigned request hash or a signed receipt cannot be tampered with undetected.
It never calls a protected tool. The published-client path runs signed-receipt
verification against the previous PyPI release 0.3.4 and the current source path.
Before connecting a real tool
An API key identifies an integration; it does not grant the owner's permission.
In required-grant mode, a request without a valid owner-signed delegation is
BLOCK with GRANT_REQUIRED, even if the amount and target satisfy the policy.
Use VizierClient.verify() or check(..., grant=...) with the exact signed
authority after operator setup.
The decorator and framework examples below illustrate policy wiring. In
published version 0.3.4, vizier_guard,
VizierLangChainToolGuard and VizierCrewAIToolGuard take grant= (a signed
grant string, or a callable that receives the call arguments) and forward it to
the service. The grant comes from your configuration, never from the tool's own
parameters. With 0.3.3, or without grant=, these wrappers cannot produce an
ALLOW against a required-grant service. Do not work around this by disabling
grant requirements, and never treat a local HITL callback as an owner-signed grant.
LangChain Integration
Protect any LangChain BaseTool from agent hallucinations or runaway spending:
from vizier import VizierClient
from vizier.integrations.langchain import VizierLangChainToolGuard
from langchain_community.tools import DuckDuckGoSearchRun
client = VizierClient(api_key="...")
# Wrap your tool
safe_search = VizierLangChainToolGuard(
tool=DuckDuckGoSearchRun(),
client=client,
allowed_actions=["search"],
max_amount=0.0
)
# Pass safe_search into your LangChain or LangGraph agent
agent = create_react_agent(llm, tools=[safe_search])
CrewAI Integration
from vizier.integrations.crewai import VizierCrewAIToolGuard
guarded_tool = VizierCrewAIToolGuard(
tool=my_dangerous_payment_tool,
max_amount=250.0,
agent_id="finance_agent"
)
Standalone Verification
from vizier import VizierClient
vizier = VizierClient(api_key="...")
decision = vizier.check(
action_type="deploy_worker",
target="worker:payment-service",
parameters={"git_commit": "abcdef123..."},
allowed_actions=["deploy_worker"]
)
if decision.is_allowed:
print(f"Action permitted! Receipt ID: {decision.receipt.id}")
else:
print(f"Action rejected ({decision.decision}): {decision.explanation}")
Signed receipts (receipt_jws, vizier-guard 0.3.3+)
If the service signs its receipt, verify() checks the ES256 signature against the published keys (/.well-known/jwks.json) and confirms it covers the exact receipt returned. Failure raises VizierError with code RECEIPT_SIGNATURE_INVALID. A response without receipt_jws is accepted as before. Pass request_receipt_jws=True to ask the service to sign (X-Vizier-Receipt: jws).
Published in 0.3.4+: pass require_receipt_jws=True to verify() to refuse a response that has no receipt_jws (VizierError with code RECEIPT_SIGNATURE_REQUIRED). It implies request_receipt_jws=True; the default is unchanged. The helper check() does not take this option.
This needs cryptography (pip install "vizier-guard[receipts]"). Without it, a signed response fails closed with RECEIPT_VERIFICATION_UNAVAILABLE rather than being trusted unchecked. The base package stays dependency-free.
⚡ Asynchronous Support (AsyncVizierClient)
For asynchronous agent runtimes (FastAPI, LangGraph, AutoGen):
from vizier import AsyncVizierClient, vizier_guard
client = AsyncVizierClient(
base_url="https://vizier.agendamcp.dpdns.org",
api_key="your-api-key"
)
# Protect async coroutine functions
@vizier_guard(client=client, action_type="fetch_data", max_amount=100.0)
async def fetch_async(target: str, amount: float):
return {"status": "success", "target": target}
# In async context:
result = await fetch_async("api.service", amount=50.0)
🧑💼 Human-in-the-Loop (HITL) Approval
When a proposed action returns REVIEW (e.g., sensitive operations like money transfers, database drops, or large payments), Vizier can halt and request interactive human approval:
1. Telegram Bot (Interactive Buttons)
Send an approval request with [ Approve ] and [ Reject ] buttons directly to your Telegram:
from vizier import VizierClient, vizier_guard, TelegramHITLHandler
telegram_approver = TelegramHITLHandler(
bot_token="123456789:ABCdefGHIjklMNOpqrsTUVwxyz",
chat_id="987654321",
timeout=60.0 # Wait up to 60s for operator response
)
@vizier_guard(
action_type="transfer_funds",
max_amount=1000.0,
hitl_handler=telegram_approver
)
def transfer(amount: float, target: str):
# Executes ONLY if operator clicks [Approve] in Telegram
print(f"Transferred ${amount} to {target}")
2. Terminal / CLI Prompt
For local development or command-line agent runs:
from vizier import CliHITLHandler
@vizier_guard(
action_type="delete_table",
hitl_handler=CliHITLHandler()
)
def drop_database(table: str):
print(f"Dropped {table}")
3. Webhook (Slack / Internal Dashboard)
from vizier import WebhookHITLHandler
@vizier_guard(
action_type="deploy_worker",
hitl_handler=WebhookHITLHandler("https://hooks.slack.com/services/...")
)
def deploy(service: str):
print(f"Deployed {service}")
🛑 Agent Circuit Breaker & Loop Killer
AI agents can get stuck in infinite retry loops, repeatedly invoking tools with identical parameters, burning API rate limits, and draining thousands of dollars in LLM tokens.
The Vizier CircuitBreaker provides deterministic client-side protection:
1. Loop Detection & Budget Capping with @vizier_guard
from vizier import CircuitBreaker, vizier_guard
# Trip if called 3 times with identical parameters within 30 seconds,
# or if more than 20 total actions are performed in this session.
breaker = CircuitBreaker(
max_repeated_calls=3,
time_window_seconds=30.0,
max_session_actions=20,
cool_off_seconds=60.0
)
@vizier_guard(
action_type="query_database",
circuit_breaker=breaker
)
def query_db(query: str):
return db.execute(query)
# Calls with identical query parameters:
query_db(query="SELECT * FROM users") # 1st: OK
query_db(query="SELECT * FROM users") # 2nd: OK
query_db(query="SELECT * FROM users") # 3rd: OK
query_db(query="SELECT * FROM users") # 4th: Raises CircuitTrippedError (LOOP_DETECTED)
2. Standalone Circuit Breaker Usage
from vizier import CircuitBreaker, CircuitTrippedError
cb = CircuitBreaker(max_repeated_calls=2, max_session_actions=50)
try:
cb.check(action_type="api_call", parameters={"endpoint": "/charge"})
# Perform external action...
except CircuitTrippedError as err:
print(f"Safety tripped: {err.reason}") # CIRCUIT_TRIPPED:LOOP_DETECTED
cb.reset() # Reset when starting a new agent task
Pre-Action Sanctions & Anti-Fraud Gate (snapshot-based, not a clearance)
Reduce the chance that autonomous agents interact with sanctioned entities, flagged crypto mixers (Tornado Cash, Lazarus, Garantex, SUEX), rogue vendor domains, or blacklisted IBANs.
Screening is deterministic and runs inside the Vizier service with no outbound lookup at decision time. It matches against a built-in static list plus, where enabled, a periodically synced snapshot of the OFAC SDN list; it is not a live feed. The built-in list is small and hand-picked (one EU entry, a few dozen OFAC entries) and does not cover the EU or UN lists in full, so a clean result is not a sanctions clearance. Check the service's snapshot date and coverage before relying on it for compliance. The Python client itself makes an HTTPS request for each screen.
1. Screening via @vizier_guard
from vizier import VizierClient, vizier_guard
client = VizierClient(api_key="your-api-key")
@vizier_guard(
client=client,
action_type="crypto_payout",
sanctions_check=True,
blocked_entities=["rogue-vendor.com"] # Optional custom blocked entities
)
def send_crypto(recipient_address: str, amount: float):
# Safe to execute:
print(f"Transferring {amount} ETH to {recipient_address}")
# Clean transfer: ALLOW
send_crypto("0x71c6bfb764b85770f4ac626088409617329fe24a", 0.5)
# Sanctioned entity (e.g. Tornado Cash): raises ActionBlockedError with SANCTIONED_ENTITY_MATCH
send_crypto("0xd90e2f925da726b50c4ed8d0fb90ad053324f31b", 10.0)
2. Pre-flight Screening Queries
result = client.screen_sanctions("garantex.org")
if not result["clean"]:
print(f"Blocked match: {result['match']['entity_name']} on {result['match']['list']}")
🔒 PII & Secret Leak Firewall (DLP for Tool Calls)
AI agents invoking external tools (Google search, Slack, email, external APIs) risk exfiltrating sensitive credentials or personal data—either via prompt hallucinations or Indirect Prompt Injection attacks.
Vizier provides deterministic pattern-based Data Loss Prevention (DLP) screening for tool calls:
- API Keys & Secrets: OpenAI (
sk-...), Anthropic (sk-ant-...), AWS Access & Secret Keys, GitHub PATs, Stripe Live Keys, Slack tokens, Google Cloud keys, Private Key PEM blocks, and JWT tokens. - PII: Payment Cards (validated via Luhn algorithm to prevent false positives), US Social Security Numbers (SSN).
- Entropy Anomaly Detector: Shannon entropy analysis for unstructured passwords and raw tokens.
- Privacy by Design: Leaked secrets are automatically masked (
sk-p******1234) in receipts and audit logs.
1. Protect Tool Calls with @vizier_guard(dlp_check=True)
from vizier import VizierClient, vizier_guard
client = VizierClient(api_key="your-api-key")
@vizier_guard(
client=client,
action_type="web_search",
dlp_check=True,
)
def search_online(query: str):
# This runs ONLY if no secrets or PII are found in query
return external_search_api(query)
# Allowed: regular query
search_online("latest AI research papers")
# Blocked: raises ActionBlockedError with SECRET_LEAK_PREVENTED
search_online("debug prompt with sk-proj-1234567890abcdef1234567890")
2. Standalone DLP Scanner
scan_result = client.scan_dlp(text="Look at this key: AKIAIOSFODNN7EXAMPLE")
if not scan_result["clean"]:
print(f"Prevented {scan_result['total_leaks_prevented']} secret leak(s):")
for finding in scan_result["findings"]:
print(f" - {finding['category']} ({finding['detector']}): {finding['snippet_masked']}")
Quorum approval
The operator creates a proposal with propose_quorum and shares the result with the
enrolled approvers. Each approver reviews the action and signs the vote locally.
node scripts/mint-grant.mjs quorum-vote --key reviewer.jwk.json \
--proposal proposal.json --approver security-auditor --decision APPROVE > vote.json
The operator submits that JSON to POST /v1/quorum/approve, through the console
or using VizierClient.approve_quorum.
import json
with open("vote.json", encoding="utf-8") as signed_vote:
vote = json.load(signed_vote)
client.approve_quorum(proposal_id=vote["proposal_id"], **vote["approval"])
Send the proposal ID and the same action and agent with the enforcement request. Each proposal is consumed once across REST, MCP and A2A. See the operator setup and migration notes.
Numeric consistency preflight
client = VizierClient(base_url="https://vizier.agendamcp.dpdns.org")
scan = client.scan_numeric_consistency(
text="Target price: $100\nCurrent price: $80\nUpside: 25%"
)
print(scan["consistent"], scan["findings"])
# AsyncVizierClient supports: await client.scan_numeric_consistency(...)
The anonymous scan accepts text, parameters, or both. It compares labeled
numbers and recomputes upside, not factual truth. The optional scan receipt
is returned as an opaque token, not verified by this method. No authorization is granted.
For /v1/verify, use AuthorityConstraints(numeric_consistency=True) or
client.check(..., numeric_consistency=True) (also supported by the async client).
Findings add REVIEW / NUMERIC_INCONSISTENCY, never BLOCK from this rule;
other authorization rules can still block. Default requests are unchanged.
Metadata
Release files for vizier-guard 0.3.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| vizier_guard-0.3.5.tar.gz | 56.6 kB | Without provenance | Details for vizier_guard-0.3.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| vizier_guard-0.3.5-py3-none-any.whl | Python 3 | none | any | Details for vizier_guard-0.3.5-py3-none-any.whl |
Total release size: 98.8 kB
Release files / vizier_guard-0.3.5.tar.gz
| Download URL | vizier_guard-0.3.5.tar.gz |
|---|---|
| Size | 56.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
acbae1b93e80b266464e0840a42380d2054b9eefcfaf7e4a1afa640b318715cf
|
|
BLAKE2b-256 checksum How to use checksums |
9a1b0c3cea56901b015b6cafabbb5ffa2a6df649dc04e711e0e2423adaec1d93
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / vizier_guard-0.3.5-py3-none-any.whl
| Download URL | vizier_guard-0.3.5-py3-none-any.whl |
|---|---|
| Size | 42.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
be42350fe1780bd14816817c48517d7705cba0a512148e3d30edacb994e29ce7
|
|
BLAKE2b-256 checksum How to use checksums |
03e5990bdc639a72fac12264049f5655c33d6e85e401500a6cae513e991b2ef5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Security for vizier-guard 0.3.5
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.