Skip to content

Python SDK

INFO

The Python SDK is in development. Expected Q1 2026.

Preview

python
from sovr import SovrClient

sovr = SovrClient(
    tenant_id="tenant_abc123",
    api_key="sk_live_..."
)

result = sovr.gate.check(
    action="send_email",
    context={"recipient": "client@example.com"}
)

if result.decision == "allow":
    send_email(result.plan)

REST Alternative

python
import requests
import os

def sovr_gate_check(action: str, context: dict) -> dict:
    response = requests.post(
        "https://sovrapp.com/api/sovr/gate/check",
        headers={
            "Content-Type": "application/json",
            "x-api-key": os.environ["SOVR_API_KEY"],
            "x-tenant-id": os.environ["SOVR_TENANT_ID"],
        },
        json={
            "tenantId": os.environ["SOVR_TENANT_ID"],
            "action": action,
            "context": context,
        }
    )
    return response.json()["data"]

The AI Responsibility Layer