Home/Docs/Policy DSL

Policy DSL Reference

AgentSentry policies are defined using a YAML-based domain-specific language that supports conditions, actions, and escalation rules.

Basic Structure

policy.yaml
# AgentSentry Policy v1.0
name: treasury-protection
version: 1.0.0
agent: trading-agent-001

rules:
  - name: max-transaction-value
    type: SPENDING_CAP
    condition:
      field: value
      operator: gt
      threshold: 1000
    action: BLOCK
    message: "Transaction exceeds 1000 SOL limit"

  - name: velocity-limit
    type: VELOCITY
    condition:
      window: 60 # seconds
      maxCount: 5
    action: ESCALATE
    escalateTo: telegram

  - name: whitelist-only
    type: WHITELIST
    condition:
      field: destination
      allowlist:
        - "So11111111111111111111111111111111111111112"
        - "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
    action: BLOCK
    message: "Destination not in whitelist"

alerts:
  telegram:
    botToken: ${TELEGRAM_BOT_TOKEN}
    chatId: ${TELEGRAM_CHAT_ID}
  discord:
    webhookUrl: ${DISCORD_WEBHOOK_URL}

Rule Types

SPENDING_CAP

Limit transaction value in SOL or USD

VELOCITY

Limit transactions per time window

WHITELIST

Restrict to approved addresses/tokens

BLACKLIST

Block specific addresses/tokens

SLIPPAGE

Maximum allowed price slippage %

TIME_WINDOW

Allow/block during specific hours

Was this page helpful? /