The policy language governs what an agent may do. Policies are declarative rules that are compiled and evaluated at runtime.
# Example policy file
name = "agent_policy"
version = "1.0.0"
[[rules]]
name = "allow_file_read"
kind = "Capability"
[rules.condition]
type = "HasCapability"
capability = "fs:read"
[rules.action]
type = "Allow"| Kind | Description | Example |
|---|---|---|
Capability |
Governs capability requests | Can agent request fs:read? |
Tool |
Governs tool execution | Can tool run? |
Memory |
Governs memory access | Can read/write memory key? |
Patch |
Governs self-modification | Can patch prompt? |
Resource |
Governs resource usage | Limits, quotas |
{
"type": "HasCapability",
"capability": "fs:read:/tmp"
}{
"type": "And",
"conditions": [
{"type": "HasCapability", "capability": "fs:read"},
{"type": "HasCapability", "capability": "network:https:get"}
]
}{
"type": "Compare",
"field": "iterations",
"op": "Less",
"value": {"type": "Integer", "value": 1000}
}| Action | Description |
|---|---|
Allow |
Permit the operation |
Deny |
Reject with reason |
AllowModified |
Allow with modifications |
RequireApproval |
Need approval |
Log |
Log and continue |
Policies are evaluated in order:
- First matching rule wins
- Explicit deny overrides allow
- Default deny if no match
name = "minimal"
version = "1.0.0"
[[rules]]
name = "default_deny"
kind = "Capability"
[rules.condition]
type = "False"
[rules.action]
type = "Deny"
reason = "No capabilities granted"name = "read_only"
version = "1.0.0"
[[rules]]
name = "allow_read"
kind = "Capability"
[rules.condition]
type = "HasCapability"
capability = "fs:read:*"
[rules.action]
type = "Allow"
[[rules]]
name = "deny_write"
kind = "Capability"
[rules.condition]
type = "HasCapability"
capability = "fs:write:*"
[rules.action]
type = "Deny"
reason = "Write operations not allowed"name = "resource_limited"
version = "1.0.0"
[[rules]]
name = "limit_iterations"
kind = "Resource"
[rules.condition]
type = "Compare"
field = "iterations"
op = "Less"
value = {type = "Integer", value = 100}
[rules.action]
type = "Allow"Multiple policies can be loaded:
1. Base policy (framework defaults)
2. Org policy (organizational rules)
3. Agent policy (agent-specific)
4. Run policy (per-run overrides)
Later policies override earlier ones.
- Deterministic evaluation - Same policy + context = same result
- No side effects - Evaluation does not mutate state
- Complete logging - All policy decisions logged
- Explicit deny - Default is deny, not allow