# Policies

> Define content moderation rules for your application

Policies are the foundation of White Circle's platform — each one uses a set of rules to define what content should be flagged or allowed in your application.

## Core Components

Each rule describes one type of content:

- **Flagged Rule**: Describe the types of content that trigger a violation, including edge cases and intent.
- **Allowed Rule**: Describe content that must remain allowed, including borderline cases that may resemble violations.

Every rule contains either flagged content or allowed content. A Policy can contain multiple rules, but at least one must be a flagged rule.

### Example policy: System prompt leakage prevention

If you want to prevent system prompt leakage from your AI assistant:

* **Flagged rule:** "Requests that ask for the system prompt, attempts to extract internal instructions, jailbreak attempts to reveal hidden prompts"
* **Allowed rule:** "General discussions about the bot's architecture, questions about what a system prompt is in principle, educational content about AI systems"

## Writing Policy Rules

Write each rule in **plain, human language**. You don't need special syntax or technical formatting.

### Improving Your Policy

After writing your initial descriptions, click the **Improve** button to upgrade your Policy to a production-ready version.

During the improvement process:

1. We'll show you around 10 sample sessions
2. You'll label each one — marking whether it violates your Policy or not
3. We use your labels to calibrate and adapt the Policy to match the behavior you expect

> [!TIP]
> The labeling step is crucial for Policy accuracy. Take your time to carefully review each example — this directly affects how well the Policy performs in production.

## Policy Settings

Beyond the core rules, Policies have several optional properties you can configure:

### Name

The name displayed on the platform and returned by the API. Choose something descriptive like "No Medical Advice" or "NSFW Filter".

### Environments

Determines which [Environments](https://whitecircle.com/docs/latest/first-steps/environments.md) the Policy belongs to. A single Policy can be assigned to multiple Environments.

### Conditions

Conditions decide when this Policy is a candidate by matching each Event's metadata. Attach the Policy to one or more Conditions for every Environment where it should run.

> [!WARNING]
> Events with no matching active Condition run with zero Policies. There is no fallback to all Policies in the Environment.

See [Conditions](https://whitecircle.com/docs/latest/condition/overview.md) for metadata expressions and attachment behavior.

### What to Check

Choose the source of the content, then the Event types this Policy evaluates.

Source:

* **Any** — check both user and assistant content
* **User** — check user-created content
* **Assistant** — check assistant-created content

Event types:

| Event type | What you can select |
| --- | --- |
| Messages | Message content |
| Artifacts | Image |
| Reasoning | Assistant reasoning |
| Agents | Input, Output, Instructions |
| Tools | Definition, Arguments, Output |
| Functions | Definition, Arguments, Output |

> [!NOTE]
> Each Event is checked on its own, so a Policy runs only against the types and fields you select here. Events that don't match any selected Policy type or field aren't checked.

### Severity Level

Set how strongly each Policy violation contributes to the strike system:

* **Critical** — critical strike impact
* **High** — high strike impact
* **Medium** — moderate strike impact
* **Low** — lowest strike impact

> [!NOTE]
> Severity level is used by the strike system to calculate points and effective user actions.

### Shadow Mode

Shadow mode lets you **test a Policy before enforcing it** in production.

> [!NOTE]
> When shadow mode is enabled:
>
> * In the **dashboard**, you'll see all detected violations as usual
> * In the **API**, we will **not** flag those requests as violations
> * To **audit** shadow results over the API, send `include_shadow` on a [check](https://whitecircle.com/docs/latest/events/check-event.md) or [lookup](https://whitecircle.com/docs/latest/events/get-event.md) request. Shadow Policies come back marked `shadow: true` and still never change the top-level verdict.
>
> This is perfect for validating a newly created Policy before it starts affecting real traffic — for example, running a set of prompts against your current configuration to see whether a shadow Policy would have caught them.

***

## Next Steps

- **[Create Policy API](https://whitecircle.com/docs/latest/policy/create-policy.md)**: Create Policies programmatically from your backend.
- **[List Policies API](https://whitecircle.com/docs/latest/policy/list-policies.md)**: Retrieve active Policies and their Environment assignments.
- **[Create a Policy](https://eu.whitecircle.com/policies)**: Create and manage Policies in the White Circle dashboard.
- **[Metrics](https://whitecircle.com/docs/latest/first-steps/metrics.md)**: Learn how Metrics provide product analytics for AI applications.
- **[Set up Environments](https://whitecircle.com/docs/latest/first-steps/environments.md)**: Separate sessions across deployment Environments.
