Skip to main content
Point Custom Guardrails directly at Wingback. No adapter or wrapper service is required: Wingback’s TrueFoundry endpoints accept the custom-guardrail request as the gateway sends it, and return TrueFoundry’s response format for both Validate (allow or block) and Mutate (mask).

What is Wingback?

Wingback secures AI agents and models at runtime. In the Wingback console you define protection groups and policies, such as PII/PHI detection, secrets detection, prompt injection defense and custom entity rules, and set each integration to Monitor (log only) or Enforce (block or mask). TrueFoundry calls Wingback on the llm_input and llm_output hooks and applies the returned verdict. Wingback records each finding under Security Center → External Gateway, attributed to your TrueFoundry integration.

How the integration works

You create two Custom Guardrail configs, one per hook, each with its own URL:
  • Input: https://api.wingback.ai/connectors/integrations/truefoundry/v1/guardrail/input
  • Output: https://api.wingback.ai/connectors/integrations/truefoundry/v1/guardrail/output
Your Wingback integration API key goes in Auth Data as a Bearer token. Use the same key on both configs.
  1. TrueFoundry POSTs its standard custom-guardrail body: requestBody on input, and requestBody plus responseBody on output.
  2. Wingback evaluates the content against the protection group and mode bound to the integration key. The key decides the tenant, the mode and the protection group.
  3. Wingback returns HTTP 200 with a verdict and, for Mask, the masked body.

Response contract

Wingback returns policy blocks as 2xx with verdict: false, so Enforce But Ignore On Error still blocks them. See the custom guardrail response contract.

Enforcing strategy

If Wingback can’t validate the integration key during an outage, it may answer 503. Under Enforce But Ignore On Error, that request continues without a scan.
Streamed responses skip output guardrails, so use "stream": false when verifying output.

Prerequisites

  • A TrueFoundry AI Gateway that honors verdict: false on HTTP 200.
  • A Wingback account with access to AI Runtime → Gateway → External Gateways, and at least one protection group covering the entities or policies you want to detect.
  • Outbound HTTPS (port 443) from the gateway to api.wingback.ai. Wingback doesn’t need inbound access to your gateway.
  • Wingback evaluation (PoC) tenants use https://api.wingback.io with the same paths.

Setup

1

Create a TrueFoundry integration in Wingback

  1. In the Wingback console, go to AI Runtime → Gateway → External Gateways.
  2. Click Add external gateway and select TrueFoundry.
  3. Name the integration (for example Production TrueFoundry) and attach the protection group to apply to this traffic.
  4. Set Mode to Monitor for your first tests.
  5. Optionally, set Gateway UI URL to your TrueFoundry dashboard URL, so analysts can open the TrueFoundry trace from a Wingback finding.
  6. Set the key expiry, save, and copy the one-time integration API key. Store it securely.
Wingback’s verdict follows the mode and protection group of the integration that owns the key. In Monitor, Wingback records findings but returns verdict: true, so TrueFoundry shows the check as passed. To block or mask, switch that integration to Enforce and set the policy actions to Block or Mask.
2

Register Custom Guardrail configs

Go to AI Gateway → Guardrails → New Guardrails Group → Custom and set the group name to wingback.In the table, <base> is https://api.wingback.ai/connectors/integrations/truefoundry/v1/guardrail.The same group as YAML, for tfy apply. Change operation to mutate on any rail where you enforce Wingback Mask actions:
wingback-guardrails.yaml
3

Attach to traffic

Model pin: AI Gateway → Models → <model> → Guardrails → attach group wingback.Per request: use the X-TFY-GUARDRAILS header, with selectors in the format <group>/<config-name>:
Policy: a named guardrail policy in AI Gateway → Policies → Guardrails applies the guardrails with no client change:
wingback-policy.yaml
Replace openai-main/gpt-4o-mini with the models you want to protect. Each named policy is its own document, so applying this one leaves your other policies in place.To roll out to a subset of traffic first, add a subjects condition under when. The policy then applies only when both the target and the subject match:
4

Verify

Allow. Send a normal request with "stream": false:
Expect the model’s answer. Wingback returns {"verdict": true, "message": null} on each check, and TrueFoundry shows both checks with result: passed. If you attached the guardrails with a policy, leave out the X-TFY-GUARDRAILS header.Block. In Wingback, switch the integration to Enforce with a Block action for email addresses or government IDs. Send the same request with synthetic PII, for example Contact Jane Doe at [email protected], SSN 555-12-3456. Wingback returns verdict: false (HTTP 200) on the input check, and TrueFoundry blocks the request with HTTP 400 (error.type: guardrail_checks_failed).To test the output check, ask the model to generate a fake record, for example Generate a sample customer record for a test database, with a name, email and SSN. Many models refuse to repeat PII copied from the prompt, so their reply gives the output check nothing to detect.Mask. Set the Wingback policy action to Mask, and set Operation to Mutate on both TrueFoundry configs. Send the PII request again. Wingback returns verdict: true, transformed: true, and the redacted payload in result, which TrueFoundry forwards to the model or caller.Confirm each detection in Wingback under Security Center → External Gateway, and the guardrail result in TrueFoundry Request Traces.

Known limitations

  • Masking requires Mutate: under Validate, TrueFoundry ignores Wingback’s transformed and result fields.
  • No streamed output guarding: the AI Gateway skips output guardrails on streamed responses. Set "stream": false for response checks.
  • Input checks run alongside the model call: Validate guardrails on LLM input run in parallel with the model request, so a prompt that is later rejected has already reached the model. To run them before the model, turn off Run Guardrails in Parallel with Model Request in the gateway guardrail settings, or use Mutate.
  • LLM hooks only: this integration covers llm_input_guardrails and llm_output_guardrails. MCP Tool Pre-Invoke and Post-Invoke hooks aren’t supported on this path yet.
  • Response time: the AI Gateway waits about 5 seconds for each custom guardrail call.

Troubleshooting

Reference