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

# F5 AI Security (CalypsoAI) Integration

> Add F5 AI Security (CalypsoAI) as a guardrail in TrueFoundry AI Gateway to scan LLM prompts and responses for injection, jailbreak, and PII risks.

This guide explains how to integrate [F5 AI Security (CalypsoAI)](https://docs.aisecurity.f5.com/api-docs/) with TrueFoundry to scan LLM prompts and responses for prompt injection, jailbreak, PII, and policy violations.

## What is F5 AI Security (CalypsoAI)?

[F5 AI Security](https://docs.aisecurity.f5.com/api-docs/) (powered by CalypsoAI) provides real-time scanners that inspect generative AI traffic — prompts and completions — for security and policy risks. Scanners and enforcement are managed in the F5 AI Security platform; the AI Gateway sends each guarded request for scanning and enforces the returned verdict.

In the TrueFoundry AI Gateway integration, F5 AI Security can run as either a **Validate** or **Mutate** guardrail. Validate inspects and can block; Mutate can also apply redacted content (for example, forwarding a `redactedInput`) before the request continues.

### Key capabilities

1. **Prompt and response scanning** — Evaluates both inputs to the model and outputs from the model through F5 AI Security scanners.
2. **Prompt injection and jailbreak detection** — Flags adversarial inputs designed to override system instructions or bypass model constraints.
3. **PII and policy violations** — Detects personally identifiable information and other policy breaches configured in your F5 project.
4. **Project-scoped scanners** — Scanner coverage depends on the API token you provide. A project token runs the scanners enabled on that project; a global token uses globally available scanners. Configure scanners in F5 AI Security — see [Getting started with AI Guardrails](https://docs.aisecurity.f5.com/api-docs/getting-started-defend.html).

## Adding F5 AI Security to TrueFoundry

F5 AI Security is a first-class guardrail in the AI Gateway — you configure it through the same form as any other built-in guardrail, no adapter service required.

<Steps>
  <Step title="Pick CalypsoAI (F5 AI Security) from the guardrail registry">
    From **AI Gateway → Guardrails → Registry**, select **CalypsoAI (F5 AI Security)** under **External Providers**. See [Get started with guardrails](/docs/ai-gateway/guardrails-getting-started) for the end-to-end flow of adding any guardrail.

    <Frame caption="Select CalypsoAI (F5 AI Security) from the guardrail registry">
      <img src="https://mintcdn.com/truefoundry/p0UwOnG3qG_SGsk6/images/f5-calypsoai-catalog.png?fit=max&auto=format&n=p0UwOnG3qG_SGsk6&q=85&s=6c7fc89df8aa305fd1cf178266887523" alt="TrueFoundry guardrail registry highlighting the CalypsoAI (F5 AI Security) card under External Providers" width="1504" height="698" data-path="images/f5-calypsoai-catalog.png" />
    </Frame>
  </Step>

  <Step title="Generate an API key in F5 AI Security">
    Create an API token in the F5 AI Security / CalypsoAI console. Prefer a **project-scoped** token so only the scanners enabled on that project run for each scan. Keep the key secure — it grants access to your F5 AI Security scan API.
  </Step>

  <Step title="Fill in the CalypsoAI (F5 AI Security) form">
    Provide the following fields:

    | Field                                | Required | Description                                                                                                                                                                                                                                        |
    | ------------------------------------ | :------: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
    | **Name**                             |     ✅    | Identifier for this guardrail (for example, `f5-ai-security`). Used when you reference the guardrail from rules.                                                                                                                                   |
    | **Description**                      |          | Free-form description shown in the dashboard.                                                                                                                                                                                                      |
    | **CalypsoAI API Key Auth → API Key** |     ✅    | F5 AI Security / CalypsoAI API token. Stored encrypted. The AI Gateway attaches it on every scan call.                                                                                                                                             |
    | **Operation**                        |     ✅    | `Validate` inspects and can block without modifying content (runs in parallel with other validate guardrails). `Mutate` can validate and also rewrite content — for example, forwarding a `redactedInput` for PII (runs sequentially by priority). |
    | **Priority**                         |          | Optional execution order for mutate guardrails. Lower values run first.                                                                                                                                                                            |

    <Frame caption="CalypsoAI (F5 AI Security) guardrail configuration form">
      <img src="https://mintcdn.com/truefoundry/p0UwOnG3qG_SGsk6/images/f5-calypsoai-form.png?fit=max&auto=format&n=p0UwOnG3qG_SGsk6&q=85&s=17edf47b0654e7a54f523f0ad7511e89" alt="TrueFoundry interface for configuring CalypsoAI (F5 AI Security) with fields for name, description, API key, operation, and priority" width="1662" height="1512" data-path="images/f5-calypsoai-form.png" />
    </Frame>

    <Note>
      Keep the CalypsoAI API key in TrueFoundry only — it should never appear in client code or model request bodies.
    </Note>

    <Tip>
      Use **Validate** when you only need to block unsafe prompts or completions. Use **Mutate** when F5 scanners are configured to redact (for example, PII) and you want the AI Gateway to continue with the redacted content instead of blocking.
    </Tip>
  </Step>

  <Step title="Bind the guardrail to models with a rule">
    Once the guardrail is saved, attach it to one or more models through a **Guardrail Rule**. Use `llm_input_guardrails` to scan prompts before they reach the model and `llm_output_guardrails` to scan completions before they're returned to the caller.

    For a step-by-step walkthrough, see [Getting Started](/docs/ai-gateway/guardrails-getting-started). For the full policy reference, see [Guardrails Configuration](/docs/ai-gateway/guardrails-configuration).
  </Step>
</Steps>

## Validation logic

TrueFoundry uses the F5 AI Security (CalypsoAI) scan response to decide whether content is safe:

* If CalypsoAI returns a blocked outcome (for example, `outcome: blocked`), the AI Gateway blocks the request and returns a **400** error to the caller — subject to your **Enforcing Strategy**.
* If scanners clear the content, the request is allowed to proceed. In **Mutate** mode, any redacted content returned by CalypsoAI can replace the original prompt or completion before the next step.
* If the scan API call fails (timeout, 5xx, auth error), behavior follows your **Enforcing Strategy**:
  * **Enforce** — fail closed; the request is blocked.
  * **Enforce But Ignore On Error** — fail open; the request proceeds and the failure is logged.
  * **Audit** — never block; violations and errors are logged only.

### Example blocked request

When a prompt triggers F5 scanners (for example, prompt injection and jailbreak), the Playground shows an input guardrail failure with the scanner IDs that fired:

<Frame caption="Playground blocked by CalypsoAI (F5 AI Security) on a prompt injection attempt">
  <img src="https://mintcdn.com/truefoundry/p0UwOnG3qG_SGsk6/images/f5-calypsoai-blocked.png?fit=max&auto=format&n=p0UwOnG3qG_SGsk6&q=85&s=58b95dcad9592105ce4e63f9ee0a76bc" alt="TrueFoundry Playground showing an Input Guardrail checks failed dialog for CalypsoAI (F5 AI Security) policy violation with blocked outcome and scanner IDs" width="3024" height="1654" data-path="images/f5-calypsoai-blocked.png" />
</Frame>

Example error detail:

```text theme={"dark"}
Input Guardrail checks failed for integrations: [my-group/f5-ai-security]
- Details: CalypsoAI (F5 AI Security) policy violation
  (outcome: blocked; scanners: <scanner-id-1>, <scanner-id-2>)
```

You can inspect the full guardrail evaluation in **AI Gateway → Monitor → Request Traces**, or use **View Raw Response** in the Playground dialog for scanner categories and scores.

### Example scan findings

When scanners flag a prompt, findings can look like:

```json theme={"dark"}
{
  "is_blocked": true,
  "results": [
    {
      "category": "prompt_injection",
      "engine": "calypsoai",
      "message": "Prompt injection detected",
      "scanner_id": "019514eb-a704-7025-b7b2-eb1333853e8b",
      "score": 0.99
    },
    {
      "category": "jailbreak",
      "engine": "calypsoai",
      "message": "Potential jailbreak attempt",
      "scanner_id": "019620d5-12a6-702f-8660-cb0d069cb054",
      "score": 0.95
    }
  ]
}
```

## Supported detections

Exact scanner enablement is configured in F5 AI Security (per project or globally, based on your API token). Typical coverage for this integration includes:

| Detection         | Description                                                                                        |
| ----------------- | -------------------------------------------------------------------------------------------------- |
| Prompt injection  | Malicious inputs designed to override system instructions or model constraints                     |
| Jailbreak         | Attempts to manipulate the model into generating prohibited content                                |
| PII               | Personally identifiable information in prompts or responses (can support redaction in Mutate mode) |
| Policy violations | Other organizational or safety policies enforced by your enabled scanners                          |

## Reference

* [F5 AI Security API — Getting started with AI Guardrails](https://docs.aisecurity.f5.com/api-docs/getting-started-defend.html)
* [About the AI Security API](https://docs.aisecurity.f5.com/api-docs/)
* [TrueFoundry guardrails overview](/docs/ai-gateway/guardrails-overview)
* [Get started with guardrails](/docs/ai-gateway/guardrails-getting-started)
* [Configure guardrail policies](/docs/ai-gateway/guardrails-configuration)
