Docs/Policies/MAPL Schema

MAPL Schema Reference

Complete syntax reference for MAPL (MACAW Access Policy Language). Hierarchical, composable policies with pattern matching and fine-grained constraints.

Policy Structure

Core policy fields. Only policy_id is required.

json
{
  "policy_id": "scope:name",
  "name": "Human-readable name",
  "extends": "parent:policy_id",
  "scope": "user",

  "resources": [...],
  "denied_resources": [...],

  "constraints": {
    "rate_limit": 100,
    "parameters": {...},
    "denied_parameters": {...}
  },

  "attestations": {...}
}

Fields Reference

FieldRequiredDescription
policy_idYesUnique ID with scope prefix: global:, company:, bu:, team:, user:, app:
extendsNoParent policy to inherit from. Child can only restrict, not expand.
resourcesNoArray of allowed resource patterns. Supports wildcards.
denied_resourcesNoArray of denied patterns. Overrides resources.
constraintsNoOperational constraints (rate_limit, parameters, denied_parameters).
attestationsNoBoolean capabilities granted to this principal.

Pattern Matching

PatternMatchesExample
*Any characters except /tool:* matches tool:search
**Any characters including /llm:** matches llm:openai/gpt-4
*text*Contains substring*sales* matches quarterly_sales.txt

Resource Types

TypeDescriptionExamples
llm:LLM operationsllm:openai/gpt-4*, llm:anthropic/*
tool:Tool invocationstool:query_*, tool:database/query
data:Data accessdata:analytics/**, data:sales/**
service:External servicesservice:database, service:api/*

Parameter Constraints

Allowed Parameters

Per-operation parameter validation with enumeration, range, and pattern constraints.

json
"parameters": {
  "llm:openai/*": {
    "model": ["gpt-4", "gpt-4-turbo"],
    "max_tokens": {"max": 4000},
    "temperature": {"min": 0, "max": 1.0}
  },
  "tool:*": {
    "query": {"max_length": 1000}
  }
}

Denied Parameters

Block specific parameter values. Pattern matching supported.

json
"denied_parameters": {
  "tool:*": {
    "include_credentials": [true],
    "output_path": ["*/etc/*", "*.key"]
  },
  "llm:*": {
    "system_prompt": ["*ignore instructions*"]
  }
}

Constraint Types

["a", "b", "c"]Enumeration

Value must be in the list. Pattern matching for strings.

{"max": 4000}Maximum

Numeric value must be <= max.

{"min": 0, "max": 1}Range

Numeric value must be in range [min, max].

{"pattern": "^[a-z]+$"}Regex

String must match regex pattern.

{"max_length": 1000}String length

String length must be <= max.


Policy Inheritance

When a policy extends another, fields are merged using monotonic restriction:

FieldMerge Behavior
resourcesIntersection - both parent and child must allow
denied_resourcesUnion - either parent or child denial applies
rate_limitMinimum - most restrictive rate applies
parametersMost restrictive constraint wins
attestationsAND - both parent and child attestations required
Scope Resolution: Policies resolve in order: global → company → bu → team → user → app. Each level restricts the previous. Deny always overrides allow.

Complete Example

json
{
  "policy_id": "team:analytics",
  "name": "Analytics Team Policy",
  "extends": "bu:data",
  "scope": "team",

  "resources": [
    "llm:openai/gpt-4*",
    "llm:anthropic/claude-3*",
    "tool:query_*",
    "data:analytics/**"
  ],

  "denied_resources": [
    "data:hr/**",
    "*.credentials"
  ],

  "constraints": {
    "rate_limit": 500,
    "parameters": {
      "llm:*": {
        "max_tokens": {"max": 4000}
      }
    },
    "denied_parameters": {
      "tool:*": {
        "include_pii": [true]
      }
    }
  },

  "attestations": {
    "can_export_reports": true
  }
}

Related