guardrail_create_policy
Create a persistent governance policy that guardrail_check evaluates on every subsequent call. Define rules using and/or/not operators over action types, resource patterns, and budget thresholds. Call this before using guardrail_check — checks require at least one active policy. Policies persist until explicitly deleted. Duplicate policy names return an error. Returns the created policy with its ID and active status.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Unique policy name per org. Examples: 'no-delete-in-prod', 'budget-cap-50', 'pii-block'. | |
| rules | Yes | Array of rule objects evaluated against the proposed_action in guardrail_check. Leaf operators: eq, starts_with, contains, gt, lt (compare field to value). Compound operators: and, or, not (nest sub-rules in a rules array). Example: [{operator:'eq', field:'type', value:'file_write'}] blocks all file writes. Nested example: [{operator:'and', rules:[{operator:'eq',field:'type',value:'api_call'},{operator:'contains',field:'url',value:'prod'}]}] blocks prod API calls. | |
| priority | No | Optional. Evaluation order. Default: 0. | |
| description | No | Optional human-readable summary of what this policy enforces. Returned in guardrail_check responses and guardrail_list_policies output for auditability. | |
| action_types | No | Optional. Restrict this policy to only evaluate when proposed_action.type matches one of these values. Examples: ['file_write', 'api_call', 'db_delete']. Omit to apply the policy to all action types regardless of type field. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| policy | No | ||
| request_id | No | ||
| credits_used | No | ||
| credits_remaining | No | ||
| fallback_behavior | No |