Skip to content
/docs
Sdk

Python SDK

Current Python status and API-backed receipt workflows.

Current status

The native Python SDK and CLI elevation work are in review. Until the claims manifest marks those package surfaces implemented and released, treat this page as the Python integration status page, not a general-availability package reference.

Use the hosted HTTP API for production decision records and the TypeScript veto-receipt-protocol package for offline receipt verification. The Python package examples will move here after the SDK release lands.

Guard a Python tool through the API

Call POST /v1/validate before executing an irreversible tool. The response includes the decision and, when the decision is recorded, a compact receipt summary.

import os
import httpx

async def validate_tool(tool_name: str, arguments: dict):
    async with httpx.AsyncClient(timeout=10) as client:
        response = await client.post(
            "https://api.veto.so/v1/validate",
            headers={"X-Veto-API-Key": os.environ["VETO_API_KEY"]},
            json={"toolName": tool_name, "arguments": arguments},
        )
        response.raise_for_status()
        return response.json()

decision = await validate_tool("issue_refund", {"amount_usd": 900})
if decision["decision"] != "allow":
    raise RuntimeError(decision.get("reason", "tool call denied"))

Export receipts

The platform receipt APIs are available to Python services through ordinary HTTP:

import os
import httpx

async with httpx.AsyncClient(timeout=30) as client:
    response = await client.get(
        "https://api.veto.so/v1/receipts/export",
        headers={"X-Veto-API-Key": os.environ["VETO_API_KEY"]},
        params={"format": "ndjson", "limit": 1000},
    )
    response.raise_for_status()
    receipts_ndjson = response.text

Verify the exported NDJSON with veto-receipt-protocol until Python receipt helpers are released.

CLI bootstrap

The Python CLI elevation work is in review. Until the claims manifest marks it implemented, use the HTTP API for hosted decision records and the TypeScript veto-receipt-protocol package for offline receipt verification.

Decision receipts

Hosted validation and MCP/approval paths can record canonical veto.receipt/1 payloads. Local Python receipt stores, Python-native verification helpers, and MCP import/restore commands remain pending package work and are not documented as generally available yet.

MCP import and restore

MCP import and restore belong to the CLI elevation work and are not documented as generally available Python package behavior yet.