---
title: Guardrails prebuilt policies
description: Apply ready-to-use Coralogix Guardrails policies for prompt injection, PII detection, and toxicity to protect your LLM applications in real time.
url: https://coralogix.com/docs/user-guides/ai/guardrails/prebuilt_policies/
product: ai
feature: AI Guardrails
feature_id: ai-app-guardrails
feature_identifier: ai/ai-app-guardrails
last_updated: '2026-09-27'
---

# Guardrails prebuilt policies

Coralogix Guardrails includes prebuilt policies that you can apply immediately to protect your LLM applications. Each policy performs a real-time, deterministic check on model inputs or outputs and throws an exception when a violation is detected.

## Available prebuilt policies

| Policy                                | What it detects                                                                                                              | When to use                                                                 |
| ------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- |
| [Prompt Injection](#prompt-injection) | Attempts to manipulate model behavior by injecting malicious instructions into user prompts                                  | All production AI applications that accept user input                       |
| [PII Detection](#pii-detection)       | Personally identifiable information such as email addresses, phone numbers, credit card numbers, and Social Security Numbers | Data privacy compliance (GDPR, HIPAA) and sensitive data leakage prevention |
| [Toxicity](#toxicity)                 | Toxic, harmful, or offensive content including hate speech, threats, harassment, and abusive language                        | Customer-facing AI and brand safety                                         |

For domain-specific protection beyond the prebuilt options, see [Custom Policies](https://coralogix.com/docs/user-guides/ai/guardrails/custom_policies.md).

[![The Policy Catalog filtered to Guardrails, showing the PII, Prompt Injection and Toxicity policies](/docs/assets/images/guardrail-policies-e9b11c7a118f9dc7c58e765ab8f35b09.webp)](https://coralogix.com/docs/assets/images/guardrail-policies-e9b11c7a118f9dc7c58e765ab8f35b09.webp)

Filter the Policy Catalog to **Guardrails** to see the policies you can enforce in real time, as opposed to the larger set available as evaluations.

A policy that works both ways offers both on its card. Hover a card in the Policy Catalog and it shows **Guardrail** and **Eval**, so you can apply the same policy as a real-time guardrail, as an evaluation, or as both.

[![The Policy Catalog with the PII card hovered, showing its Guardrail and Eval actions](/docs/assets/images/policy-catalog-ed722571f87e7e9981aebb1c106784a3.webp)](https://coralogix.com/docs/assets/images/policy-catalog-ed722571f87e7e9981aebb1c106784a3.webp)

## What you need

* `cx-guardrails` installed. See [Getting Started with Guardrails](https://coralogix.com/docs/user-guides/ai/guardrails/getting_started.md).
* The `AI-GUARDRAILS:MANAGE` [permission](https://coralogix.com/docs/user-guides/aaa/access-control/permissions/permissions-list.md).
* A [Team API key](https://coralogix.com/docs/user-guides/account-management/api-keys/api-keys.md) with the **AiObservability** role preset, used as `CX_GUARDRAILS_TOKEN`. The AiObservability preset includes `AI-GUARDRAILS:MANAGE` and all other permissions required to use Guardrails.

## Understanding thresholds

All prebuilt policies return a score between 0 and 1.

| Score range | Meaning                                 | Action taken?         |
| ----------- | --------------------------------------- | --------------------- |
| Closer to 1 | Violation detected with high confidence | Yes, exception thrown |
| Closer to 0 | Low severity, probably not a violation  | No                    |

Guardrail policies use **configurable thresholds** in the code. The threshold defines the value from which a guardrail action is triggered, when the score meets or exceeds the threshold you set, the policy throws an exception, blocks the interaction, and the system marks the event as an issue.

## Prompt injection

The prompt injection detection policy identifies and blocks attempts to manipulate model behavior through malicious instructions injected into user prompts, such as attempts to ignore system instructions, leak system prompts, or perform unintended actions.

### Configuration

**Custom threshold**

Adjust detection sensitivity (0.0 to 1.0, default 0.7):

```
# Lower threshold — more sensitive

await guardrails.guard_prompt(

    prompt=user_input,

    guardrails=[PromptInjection(threshold=0.5)],

)



# Higher threshold — less sensitive

await guardrails.guard_prompt(

    prompt=user_input,

    guardrails=[PromptInjection(threshold=0.9)],

)
```

For full setup including SDK installation and environment variables, see [Prompt Injection Detection](https://coralogix.com/docs/user-guides/ai/guardrails/prompt_injection.md).

## PII detection

The PII detection policy identifies personally identifiable information in prompts or responses, preventing sensitive personal data from being processed or exposed by your LLM applications.

### Available PII categories

| Category      | Enum value                  | Description                |
| ------------- | --------------------------- | -------------------------- |
| Email Address | `PIICategory.EMAIL_ADDRESS` | Email addresses            |
| Phone Number  | `PIICategory.PHONE_NUMBER`  | Phone numbers              |
| Credit Card   | `PIICategory.CREDIT_CARD`   | Credit/debit card numbers  |
| US SSN        | `PIICategory.US_SSN`        | US Social Security Numbers |

### Configuration

**Specific categories**

Detect only specific PII types:

```
await guardrails.guard_prompt(

    prompt=user_input,

    guardrails=[PII(categories=[PIICategory.EMAIL_ADDRESS, PIICategory.CREDIT_CARD])],

)
```

**Custom threshold**

Adjust detection sensitivity (0.0 to 1.0, default 0.7):

```
# Lower threshold — more sensitive

await guardrails.guard_prompt(

    prompt=user_input,

    guardrails=[PII(threshold=0.5)],

)



# Higher threshold — less sensitive

await guardrails.guard_prompt(

    prompt=user_input,

    guardrails=[PII(threshold=0.9)],

)
```

For full setup including SDK installation and environment variables, see [PII Detection](https://coralogix.com/docs/user-guides/ai/guardrails/pii.md).

## Toxicity

The toxicity detection policy identifies harmful, offensive, or inappropriate content (including hate speech, threats, harassment, and abusive language) in prompts or responses before they reach users.

### Configuration

**Custom threshold**

Adjust detection sensitivity (0.0 to 1.0, default 0.7):

```
# Lower threshold — more sensitive

await guardrails.guard_prompt(

    prompt=user_input,

    guardrails=[Toxicity(threshold=0.5)],

)



# Higher threshold — less sensitive

await guardrails.guard_prompt(

    prompt=user_input,

    guardrails=[Toxicity(threshold=0.9)],

)
```

For full setup including SDK installation and environment variables, see [Toxicity Detection](https://coralogix.com/docs/user-guides/ai/guardrails/toxicity.md).

## Next steps

Set up prompt injection detection for your LLM applications with [Prompt injection](https://coralogix.com/docs/user-guides/ai/guardrails/prompt_injection.md).
