Skip to main content
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:
Output:

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, or permissive
  • PII mode must be redact, mask, or block
  • Toxicity threshold must be a number between 0.0 and 1.0
  • YAML syntax is validated before any API calls
Invalid policies are rejected with clear error messages:

Workflow

Development Workflow

CI/CD Integration

Apply policies automatically on merge:

Best Practices

  1. Version everything: Keep policy.yaml in git alongside your application code
  2. Code review policies: Require PR approval for policy changes
  3. Diff before apply: Always run policy diff before policy apply
  4. Use dry-run in CI: Validate policies in CI before merging
  5. Environment-specific configs: Maintain separate policy files for staging and production

Next Steps

CLI Reference

Full CLI command reference

Security Overview

All security capabilities