> ## Documentation Index
> Fetch the complete documentation index at: https://docs.repello.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Types

### `Policy`

Represents a collection of security rules to be applied during a scan. **Structure:** `Dict[PolicyName, PolicyValue]`

* The dictionary keys are members of the `PolicyName` enum.
* The dictionary values (`PolicyValue`) are configuration objects, each requiring at least an `action` key.

#### Policy-Specific Configurations

The structure of the configuration object depends on the specific policy being configured.

| Policy Name          | Configuration Schema                                    |
| :------------------- | :------------------------------------------------------ |
| `BANNED_TOPICS`      | `{"action": Action, "topics": List[str]}`               |
| `SECRETS_KEYS`       | `{"action": Action, "patterns": List[Tuple[str, str]]}` |
| `COMPETITOR_MENTION` | `{"action": Action, "competitors": List[str]}`          |
| `POLICY_VIOLATION`   | `{"action": Action, "rules": List[str]}`                |
| `SYSTEM_PROMPT_LEAK` | `{"action": Action, "system_prompt": str}`              |
| *Other Policies*     | `{"action": Action}`                                    |

### `ApiResult`

The structured result from an Argus API scan.

| Key                 | Type                       | Description                                                                                       |
| :------------------ | :------------------------- | :------------------------------------------------------------------------------------------------ |
| `verdict`           | `Verdict`                  | **Required.** The definitive outcome of the scan.                                                 |
| `request_id`        | `str`                      | **Required.** A unique UUID (v4) for the scan request.                                            |
| `policies_applied`  | `List[AppliedPolicyInfo]`  | **Required.** A list detailing every policy that was evaluated by the backend.                    |
| `policies_violated` | `List[ViolatedPolicyInfo]` | **Required.** A list detailing policies that found a violation. Empty if `verdict` is `"passed"`. |

### `AppliedPolicyInfo`

Details of a policy that was evaluated by the backend. This model is used in the `policies_applied` list within `ApiResult`.

| Key           | Type         | Description                                            |
| :------------ | :----------- | :----------------------------------------------------- |
| `policy_name` | `PolicyName` | The name of the policy that was evaluated.             |
| `action`      | `Action`     | The configured action for this policy.                 |
| `metadata`    | `Metadata`   | Custom metadata associated with the policy evaluation. |

### `ViolatedPolicyInfo`

Details of a policy that found a violation. This model is used in the `policies_violated` list within `ApiResult`.

| Key            | Type             | Description                                                                 |
| :------------- | :--------------- | :-------------------------------------------------------------------------- |
| `policy_name`  | `PolicyName`     | The name of the policy that found a violation.                              |
| `action_taken` | `Action`         | The action (`FLAG` or `BLOCK`) that was taken as a result of the violation. |
| `details`      | `Dict[str, Any]` | Specific details of the violation, like scores or labels. See schema below. |

#### `details` Object Schema by Policy

The structure of the `details` object within `ViolatedPolicyInfo` is unique to the policy that was triggered.

| Policy Name                    | `details` Schema                                  |
| :----------------------------- | :------------------------------------------------ |
| `policy_violation_detection`   | `{'reason': str}`                                 |
| `secrets_keys_detection`       | `List[Dict]` with `{'text': str, 'score': float}` |
| `pii_detection`                | `List[Dict]` with `{'text': str, 'score': float}` |
| `toxicity_detection`           | `{'label': str, 'score': float}`                  |
| `competitor_mention_detection` | `{'detected_competitors': bool}`                  |
| `banned_topics_detection`      | `{'detected_topics': List[str]}`                  |
| `prompt_injection_detection`   | `{'score': float}`                                |
| `unsafe_prompt_protection`     | `{'safety_score': float}`                         |
| `unsafe_response_detection`    | `{'safety_score': float}`                         |
| `system_prompt_leak_detection` | `{'similarity_score': float}`                     |

### `GuardrailEvent`

A comprehensive event object captured by a guardrail. It contains the full context and result of a single analysis.

| Key              | Type                 | Description                                                          |
| :--------------- | :------------------- | :------------------------------------------------------------------- |
| `node_name`      | `str`                | The name of the decorated function or node (e.g., 'Policy\_Lookup'). |
| `payload`        | `str`                | The actual string content that was analyzed by the guardrail.        |
| `scan_result`    | `ApiResult`          | The raw `ApiResult` object returned from the Argus API scan.         |
| `request_policy` | `Optional[Policy]`   | The policy configuration sent by the client.                         |
| `node_metadata`  | `Optional[Metadata]` | User-provided metadata from the decorator for custom observability.  |
| `session_id`     | `Optional[str]`      | The session ID active during this check.                             |
