> ## Documentation Index
> Fetch the complete documentation index at: https://docs.swarmd.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Evaluate Rego source with test input (dry-run)

> **Security Requirements**

| Auth Types | Entities | Permissions | Required Roles |
|------------|----------|-------------|----------------|
| USER | TENANT | WRITE | TENANT:WRITE |



## OpenAPI

````yaml /openapi/swarmd.json post /relay/v1/policy-groups/evaluate
openapi: 3.0.1
info:
  title: OpenAPI definition
  version: v0
servers:
  - url: https://api.swarmd.ai
    description: Production
  - url: https://api.sandbox.swarmd.ai
    description: Sandbox
security: []
tags:
  - name: Policy Groups
    x-displayName: Policy Groups
  - name: Policy Bindings
    x-displayName: Policy Bindings
  - name: Webhooks
    x-displayName: Webhooks
  - name: Human JSON-RPC
    x-displayName: Human JSON-RPC
  - name: Channel JSON-RPC
    x-displayName: Channel JSON-RPC
  - name: HITL Approvals
    x-displayName: HITL Approvals
  - name: Agent JSON-RPC
    x-displayName: Agent JSON-RPC
  - name: Tasks
    x-displayName: Tasks
  - name: Push Notifications
    x-displayName: Push Notifications
  - name: Messaging
    x-displayName: Messaging
  - name: Conversations
    x-displayName: Conversations
  - name: Agent Discovery
    x-displayName: Agent Discovery
  - name: User Subscriptions
    x-displayName: User Subscriptions
  - name: MCP Servers
    x-displayName: MCP Servers
  - name: Kill Switches
    x-displayName: Kill Switches
  - name: Channels
    x-displayName: Channels
  - name: Channel Subscriptions
    x-displayName: Channel Subscriptions
  - name: Agents
    x-displayName: Agents
  - name: Agent Subscriptions
    x-displayName: Agent Subscriptions
  - name: Marketplace
    x-displayName: Marketplace
  - name: Identity Providers
    x-displayName: Identity Providers
  - name: Groups
    x-displayName: Groups
  - name: Authentication
    x-displayName: Authentication
  - name: Users
    x-displayName: Users
  - name: Tenants
    x-displayName: Tenants
  - name: Audit Integrity
    x-displayName: Audit Integrity
  - name: Audit Events
    x-displayName: Audit Events
  - name: Audit Traces
    x-displayName: Audit Traces
  - name: A2A Payments
    x-displayName: A2A Payments
paths:
  /relay/v1/policy-groups/evaluate:
    post:
      tags:
        - Policy Groups
      summary: Evaluate Rego source with test input (dry-run)
      description: |-
        **Security Requirements**

        | Auth Types | Entities | Permissions | Required Roles |
        |------------|----------|-------------|----------------|
        | USER | TENANT | WRITE | TENANT:WRITE |
      operationId: evaluatePolicyGroup
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EvaluateRegoRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EvaluateRegoResponse'
      security:
        - bearerAuth: []
components:
  schemas:
    EvaluateRegoRequest:
      required:
        - regoSource
      type: object
      properties:
        regoSource:
          type: string
        tenantId:
          type: string
          format: uuid
        sourceAgentId:
          type: string
          format: uuid
        sourceUserId:
          type: string
          format: uuid
        sinkAgentId:
          type: string
          format: uuid
        channelId:
          type: string
          format: uuid
        timestamp:
          type: string
          format: date-time
    EvaluateRegoResponse:
      type: object
      properties:
        valid:
          type: boolean
        middlewareConfigs:
          type: array
          items:
            oneOf:
              - $ref: '#/components/schemas/ComprehendDetectionConfig'
              - $ref: '#/components/schemas/HitlConfig'
              - $ref: '#/components/schemas/PresidioDetectionConfig'
              - $ref: '#/components/schemas/RateLimitDetectionConfig'
              - $ref: '#/components/schemas/RegexDetectionConfig'
              - $ref: '#/components/schemas/SkillRestrictionConfig'
        validationErrors:
          type: array
          items:
            type: string
        evaluationTimeMs:
          type: integer
          format: int64
    ComprehendDetectionConfig:
      required:
        - enabledLegs
        - entity
      type: object
      allOf:
        - $ref: '#/components/schemas/MiddlewareConfig'
        - type: object
          properties:
            entity:
              $ref: '#/components/schemas/ComprehendEntity'
    HitlConfig:
      required:
        - enabledLegs
      type: object
      allOf:
        - $ref: '#/components/schemas/MiddlewareConfig'
    PresidioDetectionConfig:
      required:
        - enabledLegs
        - entity
      type: object
      allOf:
        - $ref: '#/components/schemas/MiddlewareConfig'
        - type: object
          properties:
            entity:
              $ref: '#/components/schemas/PresidioEntity'
    RateLimitDetectionConfig:
      required:
        - enabledLegs
        - strategy
      type: object
      allOf:
        - $ref: '#/components/schemas/MiddlewareConfig'
        - type: object
          properties:
            strategy:
              $ref: '#/components/schemas/RateLimitStrategyConfig'
    RegexDetectionConfig:
      required:
        - enabledLegs
        - pattern
      type: object
      allOf:
        - $ref: '#/components/schemas/MiddlewareConfig'
        - type: object
          properties:
            pattern:
              $ref: '#/components/schemas/RegexPattern'
    SkillRestrictionConfig:
      required:
        - action
        - enabledLegs
        - mode
      type: object
      allOf:
        - $ref: '#/components/schemas/MiddlewareConfig'
        - type: object
          properties:
            mode:
              type: string
              enum:
                - ALLOWLIST
                - BLOCKLIST
            skillIds:
              uniqueItems: true
              type: array
              items:
                type: string
            skillNames:
              uniqueItems: true
              type: array
              items:
                type: string
            skillTags:
              uniqueItems: true
              type: array
              items:
                type: string
            action:
              type: string
              enum:
                - LOG
                - WARN
                - BLOCK
    MiddlewareConfig:
      type: object
      properties:
        type:
          type: string
          enum:
            - COMMUNICATION_AUDIT
            - VALIDATION_RESULT
            - X402_PAYMENT_REQUIRED
            - X402_PAYMENT_SUCCESS
            - X402_PAYMENT_ATTEMPT
            - X402_PAYMENT_REJECTED
            - REGEX_DETECTION
            - PRESIDIO_DETECTION
            - COMPREHEND_DETECTION
            - RATE_LIMIT
            - SKILL_RESTRICTION
            - HITL
            - HITL_GUARD
            - HITL_RESOLUTION
            - POLICY_LIFECYCLE
            - REGEX_DETECTION
            - PRESIDIO_DETECTION
            - COMPREHEND_DETECTION
            - RATE_LIMIT
            - SKILL_RESTRICTION
            - HITL
        enabledLegs:
          $ref: '#/components/schemas/EnabledLegs'
      discriminator:
        propertyName: type
    ComprehendEntity:
      required:
        - action
        - scoreThreshold
        - type
      type: object
      properties:
        type:
          type: string
          enum:
            - BANK_ACCOUNT_NUMBER
            - BANK_ROUTING
            - CREDIT_DEBIT_NUMBER
            - CREDIT_DEBIT_CVV
            - CREDIT_DEBIT_EXPIRY
            - PIN
            - INTERNATIONAL_BANK_ACCOUNT_NUMBER
            - SWIFT_CODE
            - NAME
            - EMAIL
            - ADDRESS
            - PHONE
            - SSN
            - DATE_TIME
            - PASSPORT_NUMBER
            - DRIVER_ID
            - URL
            - AGE
            - USERNAME
            - PASSWORD
            - LICENSE_PLATE
            - VEHICLE_IDENTIFICATION_NUMBER
            - IP_ADDRESS
            - MAC_ADDRESS
            - AWS_ACCESS_KEY
            - AWS_SECRET_KEY
            - UK_NATIONAL_INSURANCE_NUMBER
            - UK_NATIONAL_HEALTH_SERVICE_NUMBER
            - UK_UNIQUE_TAXPAYER_REFERENCE_NUMBER
            - CA_SOCIAL_INSURANCE_NUMBER
            - CA_HEALTH_NUMBER
            - US_INDIVIDUAL_TAX_IDENTIFICATION_NUMBER
            - IN_PERMANENT_ACCOUNT_NUMBER
            - IN_AADHAAR
            - IN_NREGA
            - IN_VOTER_NUMBER
            - ALL
        scoreThreshold:
          maximum: 1
          exclusiveMaximum: false
          minimum: 0
          exclusiveMinimum: false
          type: number
        action:
          type: string
          enum:
            - LOG
            - MASK
            - BLOCK
            - WARN
            - HUMAN_REVIEW_REQUIRED
            - ERROR
    PresidioEntity:
      required:
        - action
        - scoreThreshold
        - type
      type: object
      properties:
        type:
          type: string
          enum:
            - CREDIT_CARD
            - CRYPTO
            - EMAIL_ADDRESS
            - IBAN_CODE
            - IP_ADDRESS
            - LOCATION
            - PERSON
            - PHONE_NUMBER
            - MEDICAL_LICENSE
            - US_BANK_NUMBER
            - US_DRIVER_LICENSE
            - US_ITIN
            - US_PASSPORT
            - US_SSN
            - UK_NHS
            - ES_NIF
            - IT_FISCAL_CODE
            - IT_DRIVER_LICENSE
            - IT_VAT_CODE
            - IT_PASSPORT
            - IT_IDENTITY_CARD
            - SG_NRIC_FIN
            - AU_ABN
            - AU_ACN
            - AU_TFN
            - AU_MEDICARE
            - IN_PAN
            - IN_AADHAAR
            - IN_VEHICLE_REGISTRATION
        scoreThreshold:
          maximum: 1
          exclusiveMaximum: false
          minimum: 0
          exclusiveMinimum: false
          type: number
        action:
          type: string
          enum:
            - LOG
            - MASK
            - BLOCK
            - WARN
            - HUMAN_REVIEW_REQUIRED
            - ERROR
    RateLimitStrategyConfig:
      type: object
      properties:
        strategyType:
          type: string
    RegexPattern:
      required:
        - action
        - regex
      type: object
      properties:
        regex:
          type: string
        action:
          type: string
          enum:
            - LOG
            - MASK
            - BLOCK
            - WARN
            - HUMAN_REVIEW_REQUIRED
            - ERROR
    EnabledLegs:
      type: object
      properties:
        requestFromSource:
          type: boolean
        requestToSink:
          type: boolean
        responseFromSink:
          type: boolean
        responseToSource:
          type: boolean
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: JWT token (USER, AGENT, or SERVICE auth)

````