Skip to main content
Version: Dev

Guardrail Content Coverage

Guardrails inspect modeled content rather than every byte that crosses the gateway. Coverage depends on the route, hook point, and content shape; masking also requires a safe way to write the redacted value back into the protocol.

For shared hook, scope, and enforcement settings, see Guardrail Policy Behavior. For streamed output, see Streaming Guardrail Behavior.

Route Coverage​

Start with the route family to determine which request and response content reaches the guardrail chain. Provider- and protocol-specific exceptions follow the summary.

Route or SurfaceInput HookOutput Hook
Chat Completions, Completions, Messages, and ResponsesSupported text fields, tool names, arguments, and caller-supplied tool results.Returned message text, refusals, tool-call names and arguments, and other modeled text fields.
EmbeddingsText input. Token-ID input contains no text to scan.Not supported.
Image generation and editing, video generation, audio speech, and rerankText prompts and other modeled request text.Not supported. Generated media is not scanned.
Audio transcription and translationOptional text prompt.Returned transcript text. Generated audio bytes are not scanned.
RealtimeText frames in both directions.Text frames in both directions. Binary frames are not scanned.
MCP tools/callTool arguments.Tool result content, including supported structuredContent.
A2AMessage text.Not supported.
Batch and Fine-tuning jobsStructured request body.Structured response body. Referenced uploaded files are not scanned.
Passthrough routesText extracted from a recognized request envelope, or opaque-body handling for unrecognized content.Successful responses only. Recognized envelopes expose modeled text; opaque content follows passthrough rules.
Files API and decision endpointsNot supported.Not supported.

An output chain still runs when a supported response has no text. Text-matching guardrails match nothing, while a custom script receives the hook and decides its own result. A stream that failed upstream without producing text remains an upstream error rather than a guardrail refusal.

Messages Count Tokens runs the input hook over supported request text and has no output hook. Chat audio output scans returned message text, but not generated audio or its nested transcript. Generated images in message.images and streamed delta.images are not scanned.

On native Responses, AISIX scans message text, refusal parts, and tool-call names, arguments, or input. Hosted-tool output—such as mcp_call.output, File Search results, and Code Interpreter logs—is outside coverage, as are hosted-tool code and action text.

On passthrough routes, output guardrails run only for successful upstream responses. AISIX relays non-2xx buffered bodies and SSE streams without inspecting their content. A successful response with a non-identity Content-Encoding follows the applicable failure policy because AISIX cannot inspect it.

Choices, Refusals, and Log Probabilities​

Chat Completions can return several choices and optional token-level output. AISIX inspects each choice independently, including message text, refusal, legacy function_call arguments, and streamed tool-call arguments. Text from different choices is never joined for matching.

A masking guardrail does not rewrite logprobs. A caller that requests log probabilities can therefore receive upstream token text even when AISIX masks the same text in message content. Use a block action when that token text must not reach the caller.

Surfaces That Cannot Apply a Mask​

Inspection does not always imply safe redaction. The following surfaces have no write-back channel that can preserve the original payload contract:

  • Passthrough route requests and responses
  • A2A messages
  • Batch and Fine-tuning request and response bodies
  • Realtime text frames
  • Video-generation prompts

For the built-in PII guardrail, a mask match on these surfaces passes unchanged and is recorded on the usage event:

Enforcement ModeRecorded Action
blockmask_unsupported with detector counts. guardrail_blocked remains false because the content was not blocked.
monitorwould_mask_unsupported with detector counts.

Use a block action when matched content must not pass. Presidio, Lakera, AWS Bedrock, Alibaba Cloud AI Guardrails, and custom scripts refuse a mask outcome instead of forwarding it on a surface without write-back.

Inside structured tool arguments and results, AISIX can inspect object keys and numbers but cannot rewrite them without changing the payload contract. A built-in PII mask match on either therefore blocks rather than masking.

Routes without Guardrail Coverage​

Some route families bypass the guardrail chain entirely. Requests and responses on these routes carry no guardrail evidence because no policy ran.

The Decision Endpoints Are Not Screened​

Guardrails do not run on /v1/systemone or /v1/decisions. Neither input nor output checks apply, and their usage events contain no guardrail evidence.

The Files Routes Are Not Screened​

Guardrails do not run on POST /v1/files, GET /v1/files, GET /v1/files/{id}, DELETE /v1/files/{id}, or GET /v1/files/{id}/content.

Uploaded and downloaded files cross the gateway unchanged. Usage events for Files operations carry no marker for this gap, so empty guardrail evidence does not confirm screening. Screen files before upload when policy requires it.

Batch and Fine-tuning job bodies remain covered. These routes submit structured JSON rather than the uploaded file contents.

Reasoning and Thinking Content​

Reasoning coverage depends on whether the content enters as caller-supplied history or leaves as model-generated output. Signed and encrypted provider data adds further masking limits.

Caller-Supplied Reasoning​

Reasoning replayed in a request is input content and is available to input guardrails:

RouteScanned Text
/v1/responsesreasoning.content[].text and reasoning.summary[].text
/v1/chat/completionsAssistant reasoning_content and supported reasoning or thinking content parts
/v1/messagesText in thinking blocks

Signatures and encrypted provider content are never scanned.

AISIX does not rewrite signed reasoning. A mask match inside an Anthropic thinking block or a reasoning content part with a nonempty signature passes unchanged, because rewriting would invalidate the provider signature. A block action still applies. AISIX does not verify the signature, so a caller-supplied nonempty signature prevents masking but not blocking.

A redacted_thinking block contains encrypted provider data and exposes no text to the guardrail.

Model-Generated Reasoning​

Output guardrails inspect the visible answer, but not model-generated reasoning on Chat Completions, Messages, or Responses routes. This boundary is the same for streamed and buffered responses.

Use a block action on the input hook when reasoning replayed by a caller must not reach an upstream. Do not rely on raw-content scanning of an unrecognized response envelope as reasoning coverage.

Encrypted Reasoning Content Is Not Masked​

Responses reasoning can include an encrypted_content payload that AISIX cannot inspect. AISIX never scans or masks this provider data, and masking a readable summary does not remove sensitive text from the encrypted payload sent back to the provider.

Treat encrypted_content as content that crosses the gateway unmasked. Use a block action when that is unacceptable. See Keep Conversation Context Across Models for model compatibility handling.

How Keyword and PII Guardrails Read Structured Content​

Built-in keyword and PII guardrails inspect structured content one segment at a time. A block rule, monitor observation, and enforced mask use the same segment boundaries.

Each of the following is a separate segment:

  • One message or content-block text value
  • Each string value inside tool arguments, tool input, caller-supplied tool results, and MCP results
  • Each object key and number inside those structured payloads
  • A tool or function name

A pattern cannot span two segments. It cannot match across messages, a key and its value, a tool name and its arguments, or two content blocks. An anchored expression such as ^\d{4}$ can match one complete numeric segment such as the value 1234.

AISIX never rewrites tool-call IDs or tool names. A block rule can refuse a matching tool name; a mask match on a tool name passes unchanged. Tool-call IDs—including id, call_id, tool_use_id, tool_call_id, and Gemini thought signatures carried in an ID—are not scanned in either direction.

On native Messages responses, non-streaming server-tool blocks are outside built-in keyword and PII coverage. In a stream, AISIX can mask supported input_json_delta content, while tool-result blocks remain outside scanning.

Two text blocks in one message remain two segments. For example, a phone number split between "call 138001" and "38000" is neither blocked nor masked.

Passthrough routes use their own extraction rules rather than this segment model. See Passthrough Guardrail Scan Coverage.