POST /v1/enforce/intercept
POST /v1/enforce/intercept¶
Intercept an AI action before execution. This is the primary endpoint, every action must pass through here.
POST /v1/enforce/intercept
Pre-execution interception with policy evaluation, trust scoring, and vault recording.
Request Body¶
| Field | Type | Required | Description |
|---|---|---|---|
action_type |
string | Yes | Action name: execute_trade, send_email, query_database, etc. |
action_content |
string | No | Content being actioned (e.g. email body, SQL query) |
metadata |
object | No | Arbitrary metadata (amount, recipient, etc.) |
agent_id |
string | No | Registered agent performing the action |
chain_id |
string | No | Multi-step chain identifier |
chain_step |
integer | No | Step number within the chain |
parent_decision_id |
string | No | Previous decision in this chain |
Example¶
import requests
API_KEY = "xb_your_api_key"
# Before executing a trade, intercept it
result = requests.post(
"https://www.xybern.com/api/v1/enforce/intercept",
headers={"X-API-Key": API_KEY},
json={
"action_type": "execute_trade",
"action_content": "Buy 1000 shares of AAPL at market price",
"metadata": {"symbol": "AAPL", "quantity": 1000, "side": "buy"},
"agent_id": "agent_abc123"
}
).json()
if result["decision"] == "allow":
execute_trade() # proceed
elif result["decision"] == "block":
log_blocked(result["reasoning"])
elif result["decision"] == "escalate":
notify_human(result["decision_id"])
Response¶
{
"ok": true,
"decision": "allow",
"decision_id": "enf_7c8f8c26e62c",
"decision_path": "fast",
"trust_score": 85,
"reasoning": "No policies triggered — default allow",
"policies_evaluated": ["policy_123", "policy_456"],
"policies_triggered": [],
"vault_entry_id": "ve_abc123",
"latency_ms": 5,
"created_at": "2026-03-13T21:48:54Z"
}