Skip to content

DSLPolicy

A single declarative policy rule expressed as a condition/action pair. DSL policies require no OPA installation or SDK — they are evaluated by the APS runtime directly from YAML or JSON.

Schema ID: https://agentpolicyspecification.github.io/schemas/v0.1.0/dsl-policy.schema.json

Properties

PropertyTypeRequiredDescription
conditionConditionYesThe condition evaluated against the context
action"allow" | "deny" | "redact" | "transform" | "audit"YesThe action to take when the condition matches
reasonstringNoHuman-readable reason, typically used with deny
redactionsRedaction[]When action is "redact"Redaction instructions
transformationobjectWhen action is "transform"Field transformation map

Conditions

EqualsCondition

Matches when the field value strictly equals the operand.

PropertyTypeRequired
fieldstringYes
equalsanyYes

ContainsCondition

Matches when the field value contains any of the given substrings (case-insensitive).

PropertyTypeRequired
fieldstringYes
containsstring[]Yes

NotInCondition

Matches when the field value is not present in the given list.

PropertyTypeRequired
fieldstringYes
not_inany[]Yes

GreaterThanCondition

Matches when the field value is numerically greater than the threshold.

PropertyTypeRequired
fieldstringYes
greater_thannumberYes

AlwaysCondition

Always matches, regardless of context.

PropertyTypeRequired
alwaystrueYes

Examples

Deny a disallowed tool

yaml
condition:
  field: tool_name
  not_in: [web_search, read_file, summarize]
action: deny
reason: Tool is not in the approved list.

Redact SSNs from model output

yaml
condition:
  field: response.content
  contains: ["SSN", "social security"]
action: redact
redactions:
  - field: response.content
    strategy: replace
    pattern: '\b\d{3}-\d{2}-\d{4}\b'
    replacement: "[REDACTED]"

Always audit

yaml
condition:
  always: true
action: audit
reason: Logging all interactions.

Download

dsl-policy.schema.json

Released under the Apache 2.0 License.