Policy Reference

Policies are YAML documents that control what AI agents are allowed, denied, or rate-limited to do. The gateway evaluates every policy before each agent action.


Document Formats

The gateway accepts two formats.

Uses apiVersion / kind / metadata / spec wrapping — version-controlled and GitOps-friendly:

apiVersion: agent-assembly/v1
kind: Policy
metadata:
  name: my-policy         # shown in console and audit log
  version: "1.0.0"        # your policy revision
  description: ...        # optional
spec:
  scope: team:platform
  network:
    allowlist:
      - api.openai.com
  budget:
    daily_limit_usd: 25.0

Flat format

Minimal format without the envelope wrapper — useful for quick testing:

version: "1.0"
scope: global
network:
  allowlist:
    - api.openai.com

Top-Level Fields

FieldTypeRequiredDefaultDescription
versionstringNoSchema version tag (e.g., "1.0"). Informational; not validated.
scopestringNoglobalHierarchical scope this policy applies to. See Scope.
networkobjectNoNetwork egress policy. See network.
scheduleobjectNoActive-hours restriction. See schedule.
budgetobjectNoPer-day / per-month spend cap. See budget.
dataobjectNoPII / credential pattern detection. See data.
toolsmapNo{}Per-tool allow/deny/rate configuration. See tools.
capabilitiesobjectNoCapability allow/deny lists. See capabilities.
approval_timeout_secsintegerNo300Default seconds before an approval request expires. Must be > 0.
approvalobjectNoPer-policy approval escalation overrides. See approval.

Scope

The scope field determines which agents a policy applies to. Policies cascade from broadest to narrowest — Global → Org → Team → Agent → Tool — with most-restrictive-wins merging.

ValueExampleApplies to
globalscope: globalEvery agent in the workspace (default when absent)
org:<id>scope: org:acmeEvery agent inside the named organisation
team:<id>scope: team:platformEvery agent that belongs to the named team
agent:<uuid>scope: agent:01234567-89ab-cdef-0123-456789abcdefA single specific agent (UUID format)
tool:<name>scope: tool:slack-mcpA specific MCP tool, across all agents otherwise admitted by higher scopes

tool:<name> sits at the most-restrictive end of the cascade. A tool-scoped policy can deny slack-mcp for every agent in team:platform even when team- and agent-level policies would otherwise allow it.

Validation: The agent: variant requires a valid hyphenated UUID. The identifier after : must not be empty. Unknown scope kinds (e.g., project:foo) are rejected with a validation error.


network

Controls outbound network connections the agent may initiate.

FieldTypeRequiredDescription
network.allowlistlist of stringsNoDomain glob patterns the agent may connect to. Empty string entries are rejected.

When network is present but allowlist is absent or empty, no outbound connections are permitted.

network:
  allowlist:
    - "api.openai.com"
    - "*.slack.com"
    - "internal-api.corp.example"

schedule

Restricts the time window during which the agent is permitted to run.

schedule.active_hours

FieldTypeRequiredFormatDescription
schedule.active_hours.startstringYes (if active_hours present)HH:MM 24-hourWindow start time
schedule.active_hours.endstringYes (if active_hours present)HH:MM 24-hourWindow end time; must be later than start
schedule.active_hours.timezonestringYes (if active_hours present)IANA nameTimezone for window boundary (e.g., "Asia/Taipei", "UTC")

All three sub-fields are required when active_hours is present. start must be earlier than end.

schedule:
  active_hours:
    start: "09:00"
    end: "18:00"
    timezone: "America/New_York"

budget

Caps per-agent LLM spend. The gateway enforces the budget before allowing the agent action.

FieldTypeRequiredDescription
budget.daily_limit_usdfloatNoMaximum USD spend per calendar day. Must be > 0.
budget.monthly_limit_usdfloatNoMaximum USD spend per calendar month. Must be > 0 and ≥ daily_limit_usd.
budget.timezonestringNoIANA timezone for the daily/monthly reset boundary. Defaults to UTC when absent.
budget.action_on_exceed"deny" | "suspend"NoAction when budget is exceeded. deny (default): blocks individual requests but keeps the agent active. suspend: suspends the agent entirely until the budget resets.
budget:
  daily_limit_usd: 25.0
  monthly_limit_usd: 500.0
  timezone: "America/Los_Angeles"
  action_on_exceed: deny

data

Scans agent inputs and outputs for PII or credential patterns using regex.

FieldTypeRequiredDescription
data.sensitive_patternslist of regex stringsNoRE2-compatible regex patterns. A match causes the agent action to be blocked. Invalid regex is rejected at validation time.
data:
  sensitive_patterns:
    - "sk-[a-zA-Z0-9]{48}"               # OpenAI API key
    - "\\b\\d{3}-\\d{2}-\\d{4}\\b"       # US SSN
    - "(?i)password\\s*[:=]\\s*\\S+"     # password assignment

tools

Per-tool configuration keyed by tool name. Each key in the tools map is a tool name string; the value is a tool policy object.

FieldTypeRequiredDefaultDescription
tools.<name>.allowbooleanNotrueWhether this tool is permitted. Set to false to block the tool entirely.
tools.<name>.limit_per_hourintegerNounlimitedMaximum calls to this tool per hour.
tools.<name>.requires_approval_ifstringNoCEL expression that triggers human-in-the-loop approval when true. Valid governance level values: L0, L1, L2, L3.
tools:
  bash:
    allow: true
    limit_per_hour: 10
    requires_approval_if: "governance_level >= L2"
  execute_shell:
    allow: false
  file_write:
    allow: true
    limit_per_hour: 5

requires_approval_if CEL expressions: The expression is evaluated against the tool call context. The identifier governance_level exposes the current agent's governance tier (L0L3). Referencing an unknown level (e.g., L4) is a validation error.


capabilities

Broad capability allow/deny lists that apply across all tools and actions.

FieldTypeRequiredDescription
capabilities.allowlist of capability stringsNoCapabilities explicitly permitted.
capabilities.denylist of capability stringsNoCapabilities explicitly denied. Deny takes precedence over allow.

Valid capability strings

StringDescription
file_readRead access to the filesystem
file_writeWrite access to the filesystem
network_outboundOutbound network connections
network_inboundInbound network connections
terminal_execExecute commands in a terminal/shell
agent_spawnSpawn child agents
mcp_tool:<name>Use a specific named MCP tool (e.g., mcp_tool:bash, mcp_tool:git)
model:<name>Use a specific named AI model (e.g., model:gpt-4o)

Unknown capability strings are rejected with a validation error. The mcp_tool: and model: prefixes require a non-empty name after the colon.

capabilities:
  allow:
    - file_read
    - network_outbound
    - mcp_tool:git
    - mcp_tool:bash
  deny:
    - terminal_exec
    - file_write

approval

Per-policy escalation overrides. When absent, team-level routing defaults are used.

FieldTypeRequiredDescription
approval.timeout_secondsintegerNoOverride the escalation timeout (seconds) for approvals triggered by this policy's rules.
approval.escalation_rolestringNoOverride the approver group or role name for this policy (e.g., "org-admin", "security-team").
approval:
  timeout_seconds: 600
  escalation_role: org-admin

The top-level approval_timeout_secs sets the default for the whole policy document; approval.timeout_seconds overrides it at the per-policy escalation level.


Validation Rules

The gateway validates every policy on upload. All errors are collected and returned together; the upload is rejected if any error is present.

FieldRule
network.allowlist[n]Entry must not be empty
schedule.active_hours.startRequired when active_hours is present; must be HH:MM 24-hour format
schedule.active_hours.endRequired when active_hours is present; must be HH:MM and later than start
schedule.active_hours.timezoneRequired when active_hours is present; must be a valid IANA timezone name
budget.daily_limit_usdMust be > 0 when present
budget.monthly_limit_usdMust be > 0; must be ≥ daily_limit_usd when both are set
budget.timezoneMust be a valid IANA timezone name when present
budget.action_on_exceedMust be "deny" or "suspend" when present
data.sensitive_patterns[n]Must be a valid RE2 regex
tools.<name>.requires_approval_ifMust not be empty; must reference only L0L3 governance levels
capabilities.allow[n] / capabilities.deny[n]Must be a known capability string
approval_timeout_secsMust be > 0 when present
scopeMust be global, org:<id>, team:<id>, agent:<uuid>, or tool:<name>; identifier after : must not be empty; agent: value must be a valid UUID

Unknown keys at any level produce a warning (not an error) — the policy is accepted and the unknown key is ignored. This allows forward-compatible policy files.


Examples

Minimal — budget cap only

apiVersion: agent-assembly/v1
kind: Policy
metadata:
  name: budget-only
  version: "1.0.0"
spec:
  budget:
    daily_limit_usd: 10.0
    action_on_exceed: deny

Network egress allowlist

apiVersion: agent-assembly/v1
kind: Policy
metadata:
  name: allowlist-openai-slack
  version: "1.0.0"
spec:
  scope: team:platform
  network:
    allowlist:
      - "api.openai.com"
      - "*.slack.com"

Capability control

apiVersion: agent-assembly/v1
kind: Policy
metadata:
  name: capability-example
  version: "1.0.0"
spec:
  scope: global
  capabilities:
    allow:
      - file_read
      - network_outbound
      - mcp_tool:git
      - mcp_tool:bash
    deny:
      - terminal_exec
      - file_write

Tool rate-limiting with approval gate

apiVersion: agent-assembly/v1
kind: Policy
metadata:
  name: guarded-tools
  version: "1.0.0"
spec:
  tools:
    bash:
      allow: true
      limit_per_hour: 10
      requires_approval_if: "governance_level >= L2"
    execute_shell:
      allow: false

Business-hours schedule

apiVersion: agent-assembly/v1
kind: Policy
metadata:
  name: business-hours-only
  version: "1.0.0"
spec:
  scope: team:ops
  schedule:
    active_hours:
      start: "09:00"
      end: "18:00"
      timezone: "America/New_York"

PII detection

apiVersion: agent-assembly/v1
kind: Policy
metadata:
  name: no-pii-in-output
  version: "1.0.0"
spec:
  data:
    sensitive_patterns:
      - "sk-[a-zA-Z0-9]{48}"
      - "\\b\\d{3}-\\d{2}-\\d{4}\\b"

Full policy — all sections

apiVersion: agent-assembly/v1
kind: Policy
metadata:
  name: production-full
  version: "1.0.0"
  description: Full example combining all policy sections.
spec:
  scope: team:platform
  network:
    allowlist:
      - "api.openai.com"
      - "slack.com"
  schedule:
    active_hours:
      start: "09:00"
      end: "18:00"
      timezone: "Asia/Taipei"
  budget:
    daily_limit_usd: 25.0
    monthly_limit_usd: 500.0
    action_on_exceed: deny
  data:
    sensitive_patterns:
      - "sk-[a-zA-Z0-9]{48}"
  tools:
    bash:
      allow: true
      limit_per_hour: 10
    file_write:
      allow: false
  capabilities:
    allow:
      - file_read
      - network_outbound
    deny:
      - terminal_exec
  approval_timeout_secs: 300
  approval:
    escalation_role: org-admin


Last reviewed: 2026-05-10 · AI Agent Assembly Team