Guardian is the enforcement point between your agents and the actions they attempt. Submit activity, receive a decision, and stream the outcome to your SOC.
Base URL
https://theaiguardians.com/functions
Send the key as a bearer token. Keys are scoped — ingest requires events:write and guard mode requires guard:write.
Authorization: Bearer gd_live_9f2c41d08b7a4e5c9a1b3d6f2e8c0a74Production keys are prefixed gd_live_ and sandbox keys gd_test_. Revoke a key at any time from the API keys page; revocations apply immediately.
Both SDKs wrap the endpoints below — guard() before an action executes, report() for batches of completed actions — with timeouts, typed errors and friendly field names. On a network failure they throw, so you choose whether to fail open or closed.
npm — JavaScript / TypeScript
npm install @theaiguardians/sdk
import { Guardian } from "@theaiguardians/sdk";
const guardian = new Guardian(process.env.GUARDIAN_API_KEY);
// Before your agent runs anything consequential:
const decision = await guardian.guard({
agentId: "agt_5d21aa91",
action: "Charge customer card via Stripe",
target: "stripe.charges.create",
dataClassification: "confidential",
});
if (!decision.execute) return; // blocked by policy — do not run the actionpip — Python
pip install ai-guardian
import os
from guardian import Guardian
guardian = Guardian(os.environ["GUARDIAN_API_KEY"])
# Before your agent runs anything consequential:
decision = guardian.guard(
agent_id="agt_5d21aa91",
action="Charge customer card via Stripe",
target="stripe.charges.create",
data_classification="confidential",
)
if not decision["execute"]:
... # blocked by policy — do not run the actionBoth read GUARDIAN_API_KEY from the environment (or take the key directly), and honor GUARDIAN_BASE_URL to point at another environment. The npm package ships its own TypeScript types; the pip package is a single module with no third-party dependencies.
Platform compatibility
Guardian runs anywhere Node.js or Python runs — Windows, macOS and Linux (Ubuntu, Debian, RHEL and derivatives). The console is a web app and works in any modern browser, on any operating system. On Ubuntu or Debian:
# Ubuntu / Debian
sudo apt update && sudo apt install -y python3-pip nodejs npm
pip install ai-guardian # Python SDK
npm install @theaiguardians/sdk # JavaScript / TypeScript SDK
export GUARDIAN_API_KEY="gd_live_..." # Windows: set GUARDIAN_API_KEY=gd_live_...Request body
curl -X POST "https://theaiguardians.com/functions/guardianIngest" \
-H "Authorization: Bearer gd_live_9f2c41d08b7a4e5c9a1b3d6f2e8c0a74" \
-H "Content-Type: application/json" \
-d '{
"events": [{
"agent_id": "AGENT_ID",
"event_type": "data_transfer",
"action": "Upload CRM export to personal storage",
"destination": "https://drive.user-content.xyz/upload",
"data_classification": "restricted",
"authorized": false,
"volume": 12480,
"summary": "Agent uploaded a restricted export outside the managed estate.",
"evidence": "bytes_out=41200000 host=user-content.xyz"
}]
}'Response
{
"received": 1,
"event_ids": ["evt_8c21f4a9"],
"threats_raised": 1,
"results": [{
"index": 0,
"decision": "blocked",
"risk_score": 100,
"matched_policies": [
"Restricted data egress",
"Unsanctioned external destination"
],
"risk_factors": [
"Restricted data in scope",
"Egress to a destination outside the corporate domain",
"Action outside the agent authorization scope"
]
}]
}Call the guard the moment your agent is about to run something consequential. Guardian scores the action, applies your enabled policies, records the decision and answers synchronously — blocked means the action must not run; execute carries the same signal for the loop in your runtime.
Requires a key with the guard:write scope and the Developer plan or above. Every guard call counts toward your monthly event quota, exactly like an ingested event, so the audit trail stays complete.
curl -X POST "https://theaiguardians.com/functions/guardianGuard" \
-H "Authorization: Bearer gd_live_9f2c41d08b7a4e5c9a1b3d6f2e8c0a74" \
-H "Content-Type: application/json" \
-d '{
"agent_id": "AGENT_ID",
"event_type": "tool_call",
"action": "Charge customer card via Stripe",
"target": "stripe.charges.create",
"data_classification": "confidential",
"summary": "Agent attempted to charge a card from the CRM thread."
}'Response
{
"decision": "blocked",
"execute": false,
"risk_score": 74,
"risk_factors": [
"Confidential data in scope",
"Block payment actions"
],
"matched_policies": ["Block payment actions"],
"agent_id": "agt_5d21aa91",
"event_id": "evt_8c21f4a9",
"quota": { "tier": "starter", "monthly_limit": 50000, "used": 1204 }
}Guardian scores every action 0–100 from its event type, data classification, destination, authorization scope, agent autonomy and trust score, and the volume of data involved. Then your enabled policies are evaluated.
A matched block policy always wins and cannot be downgraded. Each policy carries a score floor — the minimum score recorded when it matches — so the score, the matched policies and the decision always agree.
Verify the X-Guardian-Signature header against the endpoint secret before acting on any payload.
import crypto from 'node:crypto';
const expected = 'sha256=' + crypto
.createHmac('sha256', process.env.GUARDIAN_WEBHOOK_SECRET)
.update(rawBody)
.digest('hex');
const received = req.headers['x-guardian-signature'] || '';
if (expected.length === received.length &&
crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(received))) {
// authentic delivery — safe to act on
}Subscribed event names: guardian.event.blocked, guardian.event.alert, guardian.threat.opened, guardian.threat.resolved, guardian.agent.quarantined, guardian.usage.threshold.
Limits: 25 events per request, 60 requests per minute per key, and a maximum body of 512 KB. Events older than 30 days cannot be backfilled.