How the integration works
On each non-streaming chat request, the gateway callsPOST {base_url}/fw/v1/analyze at the hooks you attach the guardrail to:
- Input, on the request the caller sent. In Mutate the result is applied before the model is called.
- Output, on the model’s response, before it is returned to the caller
model when it is known, the full messages array (including the system prompt), and tools when the caller declared any. On the output hook the model’s reply is appended to the conversation.
Cato answers with required_action.action_type:
A violation is handled by the enforcing strategy. When the request is rejected, the caller receives a
400 with type guardrail_checks_failed.
MCP tool calls
The guardrail can also be attached to MCP tool hooks. Tool arguments are sent to Cato asuser messages, one per argument, and the tool result is sent as a single assistant message. In Mutate, anonymized arguments and results are written back to the tool call.
The guardrail runs on the input and output of chat requests and on MCP tool calls. Output inspection is skipped for streamed responses.
Prerequisites
- An API key issued by Cato for the AI Security guard
- The Cato API base URL for your region, or the URL of a Cato Outpost in your environment
- Network access from the gateway to that URL
Add the Cato Networks guardrail
1
Select Cato Networks
In TrueFoundry, go to AI Gateway → Guardrails, create or open a guardrail group, and select Cato Networks under External Providers.
2
Configure the guardrail
- Name: A name such as
cato. - API Key: The key from the Cato guard. TrueFoundry stores it as a secret and sends it as
Authorization: Bearer. - Base URL: The Cato endpoint, for example
https://api.aisec.catonetworks.com, or your Outpost URL. Trailing slashes are ignored. This field is required. - Operation:
- Mutate (default) follows Cato’s contract. On
anonymize_actionthe messages are replaced with Cato’s redacted versions and the request continues. Mutate guardrails run one after another, before the model is called. - Validate never changes the payload. A
block_actionor ananonymize_actioncounts as a violation. Validate guardrails run in parallel with the model request.
- Mutate (default) follows Cato’s contract. On
- Enforcing Strategy: See Enforcing strategy.
- Priority: Order among other mutate guardrails. Lower values run first. Applies to Mutate only.
3
Attach the guardrail
Save the guardrail group, then attach it to the LLM input hook, the LLM output hook, or both through a guardrail policy.
Enforcing strategy
Verify the integration
Select the guardrail on a request with theX-TFY-GUARDRAILS header. The selector format is <group>/<guardrail-name>.
decision: allow.
transformed: true.
400. The message names the detection categories Cato reported, such as SSN, and never the text that matched. Cato’s detection_message is not returned, because it quotes the matched text. The analysis_result on the check keeps only each policy’s name and the category and certainty of each detection. The matched values, their positions and the entity lists are removed. If Cato reports no category, the message is Content blocked by Cato Networks.
anonymize_action produces the same kind of failed check with decision: anonymize, and the same category-only message and redacted analysis_result.
Per-application policy
Every analyze call sendsx-cato-gateway-key-alias. Cato uses that alias, not the key secret, to select a policy.
TrueFoundry takes the alias from the authenticated caller, never from the request:
- The personal access token name, when the request is authenticated with one
- Otherwise the virtual account, user, or agent name
x-cato- are forwarded to Cato unchanged, as Cato requires. The exceptions are headers that identify the caller or select a policy, which only the gateway sets: x-cato-gateway-key-alias, x-cato-gateway-key-name, x-cato-user-email, and x-cato-call-id. If a caller sends one of these, it is dropped.
Name the guard in Cato after the alias you expect, so each application can have its own policy.