Policy-as-Code lets you define your PromptGuard guardrail configuration in YAML files, version them in git, and apply them via the CLI. This enables code review, audit trails, and reproducible deployments for your security policies.
Overview
Instead of configuring guardrails through the dashboard UI, define them declaratively:CLI Commands
Export Current Config
Fetch the live guardrail config and output as YAML:Preview Changes
Compare a YAML file against the live config to see what would change:Apply Changes
Apply a YAML policy file to update the live config:Validation
The CLI validates your YAML before applying:- Level fields must be
strict,moderate, orpermissive - PII mode must be
redact,mask, orblock - Toxicity threshold must be a number between 0.0 and 1.0
- YAML syntax is validated before any API calls
Workflow
Development Workflow
CI/CD Integration
Apply policies automatically on merge:Best Practices
- Version everything: Keep
policy.yamlin git alongside your application code - Code review policies: Require PR approval for policy changes
- Diff before apply: Always run
policy diffbeforepolicy apply - Use dry-run in CI: Validate policies in CI before merging
- Environment-specific configs: Maintain separate policy files for staging and production
Next Steps
CLI Reference
Full CLI command reference
Security Overview
All security capabilities