Skip to main content

Policy Engine (Cage Rules)

The Policy Engine lets you define rules that govern what agents can and cannot do inside sandboxes. Policies are enforced at the MCP tool layer, LLM proxy, file system, network, and command execution levels.

How It Works

  1. You define policies with rules — each rule targets a scope (tool, file, command, network, llm) and specifies an action (allow, deny, audit, pause)
  2. When an agent attempts an operation, the engine evaluates all active policies
  3. The first deny or pause rule that matches blocks the operation immediately
  4. audit rules log a cage_break event but don’t block

Policy Inheritance

Policies support a three-level hierarchy:
  • Org-level policies apply to all sandboxes in the account
  • Team-level policies apply to a specific team
  • Project-level policies apply to a specific project
Child policies inherit parent rules. A child can override a parent rule by declaring the same rule ID with a different action.

Built-in Templates

Apply production-ready templates with a single command:

YAML Configuration

Add policies to your .caged.yaml:

API

CLI

Content Scanning

The engine includes built-in content scanners for LLM traffic:

PII Detection

Detects: email addresses, SSNs, credit card numbers, phone numbers, IP addresses, API keys, AWS secrets, private keys.

Prompt Injection Detection

12 heuristic signals with weighted scoring. Blocks content scoring above 0.7 threshold.

Dashboard

Manage policies from the web dashboard at /dashboard/policies:
  • View all active policies with level, priority, and rule counts
  • Apply templates with one click
  • Enable/disable policies