Integration guide
Send approved AI interaction metadata to an organisation’s AI-GUARDS workspace.
Public documentation; sign-in is only needed to create or manage credentials.
Setup
1. An organisation integration manager creates an event key in Settings → API keys and selects the AI system.
2. The key is shown once, is limited to that system, and expires within 90 days. Store it in a secret manager or protected environment variable.
3. Agree the event fields and retention boundary before sending production traffic. Use opaque IDs and metadata only.
python -m pip install ./ai-guards-sdk-0.2.0 export AI_GUARDS_SYSTEM_ID="<system-uuid>" export AI_GUARDS_EVENT_KEY="<secret-from-AI-GUARDS>"
Send an event
The SDK creates a versioned envelope and provides HTTPS delivery with idempotency. Use the same event identity when retrying.
import os
from ai_guards_sdk import AIGuardsSDK, HttpEventTransport
system_id = os.environ["AI_GUARDS_SYSTEM_ID"]
endpoint = (
"https://app-ai-guards-pilot-api-ai2026w.azurewebsites.net"
f"/api/v1/ai-systems/{system_id}/events"
)
sdk = AIGuardsSDK(source="zedpro", environment="staging")
event = sdk.event(
"model_call",
{"provider": "provider-name", "model": "model-name", "latency_ms": 340},
trace_id="opaque-interaction-id",
)
transport = HttpEventTransport(endpoint, os.environ["AI_GUARDS_EVENT_KEY"])
status = transport(event.to_dict()) # 201 created; 200 replayedThe endpoint is POST https://app-ai-guards-pilot-api-ai2026w.azurewebsites.net/api/v1/ai-systems/{system_id}/events. A new event returns 201; a replay returns 200. A repeated idempotency key with different content returns 409.
POST /api/v1/ai-systems/{system_id}/events
Authorization: Bearer <system-scoped-event-key>
Content-Type: application/json
Idempotency-Key: <stable-event-key>
{
"schema_version": "1.0",
"timestamp": "2026-11-26T10:00:00Z",
"event_type": "model_call",
"source": "zedpro",
"environment": "staging",
"trace_id": "opaque-interaction-id",
"payload": {
"provider": "provider-name",
"model": "model-name",
"latency_ms": 340,
"outcome": "completed"
}
}Authentication and limits
• Send the key as Authorization: Bearer … over HTTPS.
• An event key can submit single events to one AI system. It cannot read events, submit batches, or manage settings.
• Inspection keys have an organisation-admin-set monthly limit. Each accepted unique inspection_id counts once (input and output stages count separately); retries with the same ID do not count twice. When the cap is reached, requests return 429 until the UK calendar month resets.
• This is an inspection-count limit, not a request-rate or throughput guarantee. Agree expected traffic before load testing.
• Retry temporary network errors, 408 and 5xx with backoff. For a quota 429, use its resets_at date; investigate other 4xx responses rather than retrying them automatically.
• The SDK’s durable SQLite outbox is opt-in, single-worker, stores queued JSON in plain text, and removes delivered rows after seven days by default. Use encrypted storage and confirm retention.
Checks and data boundary
The generic /events endpoint records events; it does not run the configured checks or block model requests. SDK 0.2.0 sends metadata events only and does not call the inspection endpoint.
Check assessments use the separate POST /api/v1/ai-systems/{system_id}/inspections endpoint and inspection key. AI-GUARDS records the assessment and runs the assigned checks; the response is an ingestion receipt, not an allow/block decision or the final check results. Processing may be queued, and AI-GUARDS does not automatically hold or block the model response. Agree the call timing and payload before integration.
Do not send prompts, model responses, learner answers, personal information or provider credentials in payload, metadata or provenance. These JSON fields are flexible and AI-GUARDS does not detect private content hidden inside them. If an inspection excerpt is agreed, it must be source-approved and redacted; never send raw text.
Supported event types: user_input, model_call, retrieval, tool_call, tool_result, agent_decision, human_approval, final_response and error. Correlation IDs are limited to 256 characters; source and environment to 100; idempotency keys to 255.