Skip to main content

Policy Decisions

The Policy Engine evaluates every action request and returns one of three decisions: ALLOW, DENY, or ESCALATE.

Decision Types

DecisionMeaningResult
ALLOWRequest passes all checksAction is executed
DENYRequest violates policyAction is blocked
ESCALATERequest requires human reviewApproval task is created

Evaluation Order

The policy engine evaluates requests through a series of checks:

Check Details

CheckDescriptionPossible Outcomes
Manifest ValidationIs there a valid, active manifest?Pass / Deny
Capability TokenIs the token valid and not expired?Pass / Deny
Action TypeIs this action type allowed?Pass / Deny
Tool AuthorizationIs the specific tool authorized?Pass / Deny / Escalate
Amount LimitsDoes the value exceed thresholds?Pass / Escalate
JurisdictionIs the counterparty in an allowed region?Pass / Deny
CounterpartyIs the counterparty on a blocklist?Pass / Deny / Escalate
BudgetHas the budget been exceeded?Pass / Deny

Policy Trace

Every decision includes a policy trace showing which checks ran and their results:

{
"decision": "DENY",
"reasons": [
{
"code": "BUDGET_EXCEEDED",
"message": "Daily action limit exceeded",
"details": {
"current": 501,
"limit": 500
}
}
],
"policy_trace": {
"checks": [
{"check": "manifest_validation", "result": "pass"},
{"check": "capability_token", "result": "pass"},
{"check": "action_type", "result": "pass"},
{"check": "tool_authorization", "result": "pass"},
{"check": "budget_check", "result": "fail", "details": {"current": 501, "limit": 500}}
]
}
}

Reason Codes

When a request is denied or escalated, the response includes reason codes:

DENY Reasons

CodeDescription
MANIFEST_NOT_FOUNDNo manifest registered for this agent
MANIFEST_INACTIVEManifest is suspended or revoked
INVALID_TOKENCapability token is invalid
TOKEN_EXPIREDCapability token has expired
TOKEN_REVOKEDCapability token was revoked
ACTION_NOT_ALLOWEDAction type is not permitted
TOOL_NOT_AUTHORIZEDTool is not in manifest
CAPABILITY_MISSINGRequired capability not in token
BUDGET_EXCEEDEDRate limit or budget exceeded
JURISDICTION_BLOCKEDCounterparty in blocked region
COUNTERPARTY_BLOCKEDCounterparty on blocklist

ESCALATE Reasons

CodeDescription
REQUIRES_APPROVALAction requires human approval
AMOUNT_THRESHOLDValue exceeds auto-approve threshold
NEW_COUNTERPARTYFirst interaction with counterparty
HIGH_RISK_ACTIONAction flagged as high risk

Example Responses

ALLOW

{
"interaction_id": "int-abc123",
"decision": "ALLOW",
"reasons": [],
"executed": true,
"result": {
"success": true,
"data": {"message_id": "msg-789"}
},
"timestamp": "2024-12-14T10:30:00Z"
}

DENY

{
"interaction_id": "int-def456",
"decision": "DENY",
"reasons": [
{
"code": "BUDGET_EXCEEDED",
"message": "Hourly action limit exceeded (100/100)"
}
],
"executed": false,
"timestamp": "2024-12-14T10:31:00Z"
}

ESCALATE

{
"interaction_id": "int-ghi789",
"decision": "ESCALATE",
"reasons": [
{
"code": "REQUIRES_APPROVAL",
"message": "Action 'kubernetes:deploy' requires human approval"
}
],
"approval_id": "appr-xyz789",
"executed": false,
"timestamp": "2024-12-14T10:32:00Z"
}

Configuring Policies

Policies are configured per organization. See API: Policies for configuration options.

Example: Require Approval for Deployments

{
"name": "require-deploy-approval",
"policy_type": "require_approval",
"scope": "action",
"rules": {
"actions": ["kubernetes:deploy", "github:merge"]
},
"enabled": true
}

Example: Block After Hours

{
"name": "business-hours-only",
"policy_type": "deny",
"scope": "global",
"rules": {
"time_window": {
"deny_outside": {
"start": "08:00",
"end": "18:00",
"timezone": "America/New_York",
"days": ["mon", "tue", "wed", "thu", "fri"]
}
}
},
"enabled": true
}

Risk Snapshot

Each decision includes a risk snapshot capturing metrics at evaluation time:

{
"risk_snapshot": {
"budget_current": 45,
"budget_limit": 100,
"budget_percent": 45.0,
"request_amount": null,
"max_amount": 1000.0
}
}

This helps with audit and debugging.