← All docs

Python SDK

The Sentinela Python SDK exposes both sync and async clients (over httpx), plus framework helpers for FastAPI/Starlette and Flask, and Twilio/Meta/Telegram middleware. One dependency (httpx).

Install

pip install merchantguard-sentinela

Sync screening

screen.py
from merchantguard_sentinela import Sentinela

client = Sentinela(api_key="sk_live_...")

result = client.screen(
    message="dame tu yappy y te mando $200 ya",
    locale="es-PA",
    preset="moltferia",
)

print(result.verdict, result.score, result.reasons)

Async screening

screen_async.py
import asyncio
from merchantguard_sentinela import SentinelaAsync

async def main():
    async with SentinelaAsync(api_key="sk_live_...") as client:
        result = await client.screen(message="...", locale="es-PA")
        print(result.verdict)

asyncio.run(main())

FastAPI / Starlette middleware

from fastapi import FastAPI
from merchantguard_sentinela.asgi import SentinelaMiddleware

app = FastAPI()
app.add_middleware(SentinelaMiddleware, api_key="sk_live_...", preset="strict")

@app.post("/webhook/twilio")
async def twilio_webhook(request):
    # request.state.sentinela has the verdict
    return {"ok": True}

Flask decorator

from flask import Flask
from merchantguard_sentinela.flask_helpers import protect_twilio

app = Flask(__name__)

@app.post("/twilio")
@protect_twilio(api_key="sk_live_...")
def twilio_webhook():
    return ("ok", 200)

Failure modes

All middleware is fail-open by default: if the Sentinela API is unreachable, the host application proceeds and applies its own fallback policy. This matches the architectural principle that compliance tooling should never bring the host down.

Nothing on this page is legal advice. Trademarks pending: MerchantGuard™ (Serial 99051215), GuardScore™ (Serial 99030125), AgentGuard™ (Serial 99462472). Patents 63/983,615 / 63/983,621 / 63/983,843 / 63/984,626 (provisional, filed Feb 17 2026). See LEGAL.md, PATENTS.md, DISCLAIMER.md.