Skip to content

docs(guardrails): describe streaming and post-stage blocks as the gateway runs them - #884

Open
nik13 wants to merge 2 commits into
mainfrom
docs/guardrail-streaming-behaviour
Open

nik13 wants to merge 2 commits into
mainfrom
docs/guardrail-streaming-behaviour

Conversation

@nik13

@nik13 nik13 commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The guardrail pages described streaming and blocked responses differently from how the gateway behaves:

  1. Streaming. The pages said post-stage guardrails check a streamed response before it reaches the caller, and stop the stream when they block. In the gateway:
    • pre-stage checks run before the stream opens, so a block there returns 403;
    • only rules in the gateway's own config file with guardrails.streaming.enabled check a stream while it is generated, and only on /v1/chat/completions;
    • every other post-stage check, including those set up in the dashboard, runs after the last chunk and before data: [DONE], and can't stop or recall what was already sent.
  2. Block status codes. The pages said a Block always returns 403. Only a pre-stage Block does:
    • a post-stage Block from a dashboard guardrail returns 200 with the x-agentcc-guardrail-triggered header;
    • a synchronous config.yaml post rule makes /v1/chat/completions return 500.
  3. Stage. A guardrail's Stage setting isn't applied by the gateway today. Each check runs at its built-in stage: post for Data Leakage Prevention and Hallucination Detection, pre for the rest.

Every statement was checked against the gateway source on main, so these pages can merge now.

Related:

What changed

  • Command Center → Guardrails (command-center/features/guardrails.mdx):
    • the Streaming Guardrails section says what each stage does to a stream, and documents the self-hosted guardrails.streaming mode (check_interval, stop or disclaimer), which uses only config.yaml rules;
    • the Enforcement Modes table's Enforce row now applies to the pre stage only;
    • the Built-in Guardrail Types table shows each check's built-in stage, and says a config.yaml rule uses its own stage.
  • Command Center → Streaming (command-center/features/streaming.mdx): the guardrails paragraph and its Next Steps card, which now links to the streaming section.
  • Command Center → API reference (command-center/concepts/api-reference.mdx): the streaming note and the post-stage statuses.
  • Protect (protect/concepts/understanding-protect.mdx, protect/reference/guardrail-checks.mdx): the Stage note, and when the gateway returns 403, 200 with the triggered header, or 500.

Checks

  • node scripts/audit-links.mjs: 0 broken nav links, 0 broken content links. The orphan-page warnings were already on main.
  • node scripts/check-deleted-pages.mjs main: no pages deleted.
  • npx astro build: every page compiled.
  • git diff --check: clean.

🤖 Generated with Claude Code

nik13 and others added 2 commits September 30, 2026 16:17
…them

Post-stage guardrails were described as checking a streamed response
before it reaches the caller and ending the stream on a block. Only
config-file rules with guardrails.streaming.enabled act while a stream is
generated; other post-stage checks run once after it has been delivered.
Mask was also listed as a guardrail action, but the gateway runs it as
Log; masking PII is the PII check's remediation setting.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… change

Only a pre-stage Block returns 403. A post-stage Block from a dashboard
guardrail returns 200 with x-agentcc-guardrail-triggered, and a synchronous
config.yaml post rule makes /v1/chat/completions return 500. Update
api-reference, guardrail-checks, understanding-protect and the Enforcement
Modes table to match.

Note that the gateway doesn't apply a guardrail's Stage setting today (each
check runs at its built-in stage) and align the Built-in Guardrail Types
table with that. Revert the Mask action list change, which belongs with the
dashboard change that removes Mask.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nik13 nik13 changed the title docs(guardrails): describe streaming and actions as the gateway runs them docs(guardrails): describe streaming and post-stage blocks as the gateway runs them Oct 4, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant