Skip to main content
Point Custom Guardrails directly at Straiker. No adapter or FastAPI wrapper is required: Straiker’s detect API accepts the TrueFoundry custom-guardrail request as the gateway sends it.

What is Straiker?

Straiker secures AI agents at runtime. You set controls for each agent in the Straiker console, and Straiker’s detect API returns an allow or block verdict for each prompt and response it receives. TrueFoundry calls Straiker on the llm_input and llm_output hooks and enforces the returned verdict.

How it works

  1. Both Custom Guardrail configs (input and output) use the same URL:
    Your Straiker key (sk_agt_...) goes in Auth Data as a Bearer token.
  2. TrueFoundry POSTs its standard custom-guardrail body. On the output config, the body also carries the model’s response.
  3. Straiker returns HTTP 200 with {"verdict": true} to allow or {"verdict": false} to block. The verdict follows the controls on the agent in the Straiker console.
  4. The input and output checks of one request return the same straiker.turn_id.

Response contract

Straiker returns policy blocks as 2xx + verdict: false, so Enforce But Ignore On Error still blocks them. See Custom guardrail response contract. Set Enforcing Strategy to Enforce or Enforce But Ignore On Error for block testing. Audit logs violations without blocking. Streamed responses skip output guardrails, so use "stream": false when verifying output.

Prerequisites

  • TrueFoundry AI Gateway that honors verdict: false on HTTP 200.
  • Access to the Straiker console, to create a TrueFoundry gateway integration with an sk_agt_ key and to set agent controls.
  • Outbound HTTPS from the gateway to api.prod.straiker.ai.

Setup

1

Get your Straiker key

In the Straiker console: Defend → Add Agent → type Gateway → TrueFoundry. Create a key under that integration. Straiker keys for this integration begin with sk_agt_.Straiker’s verdict follows the agent’s controls in the Straiker console. Set the detections you want enforced to block: a detection that isn’t set to block is logged in Straiker but returns verdict: true, so TrueFoundry shows the check as passed.
2

Register Custom Guardrail configs

AI Gateway → Guardrails → New Guardrails Group → Custom → group name straiker.The same group as YAML, for tfy apply:
3

Attach to traffic

Model pin: AI Gateway → Models → <model> → Guardrails → attach group straiker.Per request — X-TFY-GUARDRAILS header, selector format <group>/<config-name>:
Policy — a named guardrail policy in AI Gateway → Policies → Guardrails applies the guardrails with no client change:
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.If your application sends a session_id in X-TFY-METADATA, use a unique value for each conversation.
4

Verify

Allow. Send a normal request with "stream": false:
Expect the model’s answer. Straiker returns {"verdict": true, "straiker": {"turn_id": "<uuid>"}} on each check, and TrueFoundry shows both checks with result: passed.Output block. Send the same request, but ask for a fake customer record that includes a Social Security number, for example Generate a sample customer record for a test database, with a name, address and SSN. When the agent’s controls block that detection, Straiker returns verdict: false on the output check and the client receives HTTP 400. The body’s error object reads:
Confirm the detection in the Straiker console and the guardrail result in TrueFoundry Request Traces.

Known limitations

  • Validate only — this integration allows or blocks. It doesn’t redact or rewrite content.
  • No streamed output guarding — set "stream": false for response checks.
  • LLM hooks only — TrueFoundry hasn’t tested Straiker on the MCP Tool Pre-Invoke and Post-Invoke hooks.
  • 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.

Troubleshooting

Reference