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

# Prompt Guard: Stop Injection and Jailbreak Attacks

> Prompt Guard inspects every prompt and retrieved context in real time to detect and block injection attacks, jailbreaks, and system prompt leakage.

Prompt Guard operates at the Application / Prompt layer of the BeyondGuard stack, acting as the first line of defense before any user input or retrieved context ever reaches your model. It analyzes the full content and intent of every prompt in real time, detecting adversarial patterns ranging from classic jailbreak attempts to sophisticated multi-modal attacks embedded in images and documents. Because Prompt Guard is structurally independent from the model it protects, it cannot itself be manipulated through the prompts it evaluates.

## What Prompt Guard Detects

Prompt Guard covers the full range of input-layer threats that attackers use to subvert AI application behavior.

* **Prompt Injection:** Malicious instructions embedded inside user input — for example, hidden directives appended to a pasted document — that attempt to override your system prompt or redirect the model's behavior.
* **Jailbreak Attempts:** Adversarial prompts carefully crafted to bypass your model's safety constraints, such as role-play framings, hypothetical scenarios, or encoded payloads designed to make the model ignore its guidelines.
* **System Prompt Leakage:** Requests that try to extract the contents of your confidential system prompt through direct interrogation, reflection tricks, or indirect inference attacks.
* **Scope Violations:** Requests that fall entirely outside your application's defined purpose — for example, asking a customer-support bot to write legal contracts — which may signal misuse or an active probing attempt.
* **Multi-modal Attacks:** Malicious instructions embedded invisibly or visibly inside images, PDFs, or other documents passed to multi-modal models, exploiting the model's document-reading capabilities to inject commands.

## How It Works

Prompt Guard intercepts every inbound prompt before it is forwarded to your model and runs it through a structured inspection pipeline.

<Steps>
  <Step title="Input Capture">
    The prompt — including any retrieved context from RAG pipelines, tool outputs, or conversation history — is captured by Prompt Guard at the ingress point of your application.
  </Step>

  <Step title="Intent Extraction and Evaluation">
    Prompt Guard parses the full prompt structure, separates user-controlled content from trusted system content, and evaluates intent signals against its threat detection models. Each threat category (injection, jailbreak, leakage, scope, multi-modal) is scored independently.
  </Step>

  <Step title="Policy Decision">
    The scores are compared against your configured sensitivity thresholds. Based on the result, Prompt Guard issues one of three decisions: **allow** (forward the prompt to your model), **flag** (forward but log the event for review), or **block** (reject the prompt and return a safe response to the user).
  </Step>

  <Step title="Audit Logging">
    Every evaluated prompt — whether allowed, flagged, or blocked — is recorded in the BeyondGuard audit log with its threat scores, matched patterns, and the policy decision. This log is available in real time from the Control Plane dashboard.
  </Step>
</Steps>

## Configuring Prompt Guard

Enable and configure Prompt Guard from the BeyondGuard Control Plane.

<Steps>
  <Step title="Open Your Project">
    Navigate to the [Control Plane](https://app.beyondguard.io) and select the project you want to protect.
  </Step>

  <Step title="Open the Guards Tab">
    Inside your project, select the **Guards** tab from the left navigation panel.
  </Step>

  <Step title="Enable Prompt Guard">
    Locate **Prompt Guard** in the guard list and toggle it to **Enabled**.
  </Step>

  <Step title="Choose an Operating Mode">
    Select either **Observation Mode** or **Enforcement Mode** (see the section below). For new deployments, BeyondGuard recommends starting with Observation Mode.
  </Step>

  <Step title="Set Sensitivity Thresholds">
    Expand the **Advanced Settings** panel to adjust per-threat sensitivity thresholds. Each threat category can be tuned independently on a scale from 1 (permissive) to 10 (strict).
  </Step>

  <Step title="Save and Deploy">
    Click **Save Configuration**. Changes take effect within seconds for all active sessions on that project.
  </Step>
</Steps>

## Operating Modes

Prompt Guard supports two operating modes. You can switch between them at any time from the Control Plane without downtime.

|                         | **Observation Mode**                                                                | **Enforcement Mode**                                                                         |
| ----------------------- | ----------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
| **What it does**        | Inspects every prompt and logs detections, but never blocks traffic                 | Inspects every prompt and actively blocks or flags based on your policy                      |
| **Effect on users**     | No impact — all prompts are forwarded to your model as normal                       | Blocked prompts receive a safe rejection response; users do not see the model's output       |
| **Best used for**       | Baselining threat volume, tuning thresholds, evaluating Prompt Guard before go-live | Production enforcement once thresholds are tuned and you are confident in detection accuracy |
| **Audit logging**       | Full — all detections recorded                                                      | Full — all decisions (allow, flag, block) recorded                                           |
| **False positive risk** | Zero user impact even if misconfigured                                              | High-sensitivity thresholds may reject legitimate prompts                                    |

<Tip>
  Start in Observation Mode for at least one week before switching to Enforcement Mode. This gives you a realistic baseline of threat frequency and detection patterns in your specific application, and allows you to tune sensitivity thresholds so you are not blocking legitimate traffic on day one.
</Tip>

<Warning>
  Enforcement Mode may reject legitimate edge-case prompts if your sensitivity thresholds are set too high. Before enabling Enforcement Mode in production, review the flagged-but-legitimate events captured during Observation Mode and lower the relevant thresholds until the false-positive rate is acceptable. Pay particular attention to **Scope Violations** — these thresholds are highly application-specific and always require manual tuning.
</Warning>
