Search documentation

Search all documentation pages

Python

Use the Aguardic REST API from Python applications.

Coming Soon

The Python SDK is under development. In the meantime, use the REST API directly with requests or httpx.

Using the REST API

import requests
 
AGUARDIC_API_KEY = "ag_live_..."
BASE_URL = "https://api.aguardic.com/v1"
 
headers = {
    "Authorization": f"Bearer {AGUARDIC_API_KEY}",
    "Content-Type": "application/json",
}
 
# Evaluate content
result = requests.post(
    f"{BASE_URL}/evaluate",
    headers=headers,
    json={
        "input": {"content": "User message to evaluate"},
        "targetKey": "chat-message",
    },
).json()["data"]
 
if result["outcome"] == "BLOCK":
    print("Blocked:", result["violations"])

Next Steps