Policy Engine
The ABS Policy Engine is the core decision-making component of the ABS Kernel. It evaluates every agent action against a set of active policies to determine whether toALLOW, DENY, or ESCALATE the operation.
Architecture
The engine operates on a Fail-Close principle: if a policy cannot be evaluated or an error occurs, the default action is to block.Decision Flow
- Event Ingestion: The engine receives an
EventEnvelopecontaining the agent’s intent, payload, and metadata. - Sanitization: Input safeguards remove PII and check for prompt injection.
- Policy Evaluation: The active policy for the event type is executed.
- Risk Scoring: A risk score (0-100) is calculated based on:
- Static Rules: Regex matches, keyword blocks.
- Contextual Analysis: Velocity checks, anomaly detection.
- Sequence Analysis: Recognition of dangerous workflows.
- Trust Score: Historical reputation of the agent.
- Verdict:
- ALLOW: Risk score < 30.
- ESCALATE: Risk score 30-79 (requires human approval).
- DENY: Risk score >= 80 or explicit block.
- Immutable Log: The decision is signed and recorded in the Write-Ahead Log (WAL).
Policy Types
Static Policies (Scanner Mode)
Designed for high-performance, local execution.- Regex: Detect PII (CPFs, Credit Cards, API Keys).
- Keyword: Block “password”, “secret”, “groselha”.
- Structure: Validate JSON schemas and file types.
Dynamic Policies (Runtime Mode)
Leverage state and LLM intelligence.- Velocity: “User X sent > 5 messages in 1 second.”
- Anomaly: “This code commit style differs from User Y’s profile.”
- Semantic: “The user is trying to bypass authentication” (Intent detection).
