direction on every call (input before
the model, output after). Defaults to input if omitted.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
trustguard-sdk — guard() with direction input/output.
direction on every call (input before
the model, output after). Defaults to input if omitted.
pip install trustguard-sdk
from trustguard import TrustGuard
client = TrustGuard("<your-trustguard-url>", api_key="<collector-api-key>")
inbound = client.guard(
{"input": user_input},
direction="input",
consumer_id="alex@acme.com",
session_id="sess-123",
)
if inbound.is_blocked:
raise PermissionError("Blocked by TrustGuard (input)")
prompt = inbound.transformed_payload or {"input": user_input}
# … model call …
outbound = client.guard(
{"input": model_completion},
direction="output",
consumer_id="alex@acme.com",
session_id="sess-123",
)
if outbound.is_blocked:
raise PermissionError("Blocked by TrustGuard (output)")