Code examples for connecting your agent to ZeroPoint — governance that produces proof. All examples assume a local server at http://localhost:3000.
The primary integration point. Before your agent executes an action, ask the guard whether it's allowed.
curl# Evaluate an action against policy curl -X POST http://localhost:3000/api/v1/guard/evaluate \ -H "Content-Type: application/json" \ -d '{ "action": "execute shell command: rm -rf /tmp/cache", "action_type": "Execute", "trust_tier": "Tier1" }' # Response includes decision + signed audit entry # { "decision": "Allow", "allowed": true, "risk_level": "High", # "applied_rules": ["HarmPrincipleRule", "SovereigntyRule"], # "receipt_id": "rcpt-...", "audit_entry_hash": "a3f1..." }Python
import requests ZP = "http://localhost:3000/api/v1" def guard_check(action: str, action_type: str = "Execute", tier: str = "Tier1") -> dict: """Ask ZeroPoint whether this action is allowed.""" resp = requests.post(f"{ZP}/guard/evaluate", json={ "action": action, "action_type": action_type, "trust_tier": tier, }) return resp.json() # Use it before every tool call result = guard_check("execute shell command: pip install numpy") if result["allowed"]: # Safe to proceed — receipt_id proves the decision run_command("pip install numpy") else: # Blocked — rationale explains why log(f"Blocked: {result['rationale']}")TypeScript
const ZP = "http://localhost:3000/api/v1"; async function guardCheck(action: string, actionType = "Execute", tier = "Tier1") { const res = await fetch(`${ZP}/guard/evaluate`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ action, action_type: actionType, trust_tier: tier }), }); return res.json(); } // Wrap every agent tool call const decision = await guardCheck("write file: /etc/config.yaml", "Write"); if (decision.allowed) { await writeFile("/etc/config.yaml", data); } else { console.warn(`Blocked by ${decision.applied_rules.join(", ")}: ${decision.rationale}`); }
After executing an action, generate a signed receipt as cryptographic proof of what happened.
Pythondef generate_receipt(action: str, status: str = "Success") -> dict: """Generate a signed receipt proving this action occurred.""" resp = requests.post(f"{ZP}/receipts/generate", json={ "action": action, "status": status, "policy_decision": "Allow", }) receipt = resp.json() # receipt contains: receipt_id, content_hash, signature, # signer_public_key, trust_grade, chain_prev_hash return receipt # After a successful deployment receipt = generate_receipt("deployed model v2.1 to production") print(f"Receipt {receipt['receipt_id']} signed, grade {receipt['trust_grade']}")
Grant capabilities to sub-agents and verify the chain of authority.
Python# 1. Operator grants Execute capability to Agent A grant = requests.post(f"{ZP}/capabilities/grant", json={ "grantee": agent_a_hash, "capability": "Execute", "scope": ["python", "node"], "max_delegation_depth": 3, }).json() # 2. Agent A delegates a narrower scope to Agent B delegation = requests.post(f"{ZP}/capabilities/delegate", json={ "parent_grant_id": grant["grant"]["id"], "grantee": agent_b_hash, "capability": "Execute", "scope": ["python"], # narrower than parent }).json() # 3. Anyone can verify the chain chain = requests.post(f"{ZP}/capabilities/verify-chain", json={ "grant_ids": [grant["grant"]["id"], delegation["grant"]["id"]], }).json() print(f"Chain valid: {chain['valid']}, depth: {chain['current_depth']}/{chain['max_depth']}")
Query the tamper-evident audit trail and verify chain integrity.
Python# Get recent audit entries entries = requests.get(f"{ZP}/audit/entries?limit=10").json() for entry in entries["entries"]: print(f"{entry['timestamp']} | {entry['action']} | {entry['policy_decision']}") # Verify the entire chain hasn't been tampered with integrity = requests.get(f"{ZP}/audit/verify").json() assert integrity["valid"], f"Chain tampered! Issues: {integrity['issues']}" print(f"Chain intact: {integrity['entries_examined']} entries, all links valid")
Run ZeroPoint as an MCP tool server so Claude Code (or any MCP-compatible agent) calls the guard automatically.
MCP integration wraps the guard endpoint as a tool that the agent invokes before executing actions. The agent doesn't need to know it's being governed — the MCP server intercepts tool calls transparently.
# In your claude_desktop_config.json or .mcp.json { "mcpServers": { "zeropoint": { "command": "./target/release/zp-server", "args": ["--mcp"], "env": { "ZP_TRUST_TIER": "Tier1" } } } }
Everything an agent needs to discover and integrate with ZeroPoint programmatically.
# LLM discovery file (plain text, structured for AI consumption) https://zeropoint.global/llms.txt # OpenAPI 3.1 specification (all endpoints, schemas, examples) https://zeropoint.global/api/openapi.json # AI plugin manifest (ChatGPT/Claude agent discovery) https://zeropoint.global/.well-known/ai-plugin.json # Receipt JSON Schema (validate receipt structure) https://zeropoint.global/api/receipt.schema.json # Source code https://github.com/zeropoint-foundation/zeropoint