Skip to content

docs(guardrails): skip_system_message_in_guardrail skips only the top-level system prompt on /v1/messages - #2530

Merged
yucheng-berri merged 2 commits into
mainfrom
litellm_guardrail_skip_system_messages_scope
Oct 26, 2026
Merged

yucheng-berri merged 2 commits into
mainfrom
litellm_guardrail_skip_system_messages_scope

Conversation

@yucheng-berri

@yucheng-berri yucheng-berri commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Two changes left the guardrail docs behind for Claude clients on Anthropic /v1/messages

Since BerriAI/litellm#40984 (first in v1.103.0) guardrails also scan the top-level system prompt there. Claude Desktop and Cowork send a system prompt of about 69k chars with every request, and a strict Bedrock PROMPT_ATTACK filter blocks it even for a harmless question. skip_system_message_in_guardrail: true already removes it, but the docs never said the prompt is scanned now

Since BerriAI/litellm#34290 (first in v1.98.0) the skip flag removes only that top-level prompt, and role: system entries inside messages are always scanned as client input. Claude Code sends such an entry mid-conversation (an environment block of about 9k chars), and on its own that entry trips the same filter, so the skip flag does not help Claude Code users. experimental_use_latest_role_message_only: true keeps it out of the scan. The docs said the flag omits role: system on /v1/messages

Both PRs declared these changes on purpose, so the code stays and the docs catch up. This updates the config_settings.md row, adds two paragraphs to the quick start skip section, and adds a pointer in the Bedrock experimental section

Evidence

Real clients through a real LiteLLM proxy to a real Bedrock guardrail with PROMPT_ATTACK on input at LOW, prompt "What are three tips for running an effective leadership meeting?", read from the proxy's Bedrock request log

Claude Desktop 2.19675.0 Cowork (agent SDK 0.3.286), driven through the macOS accessibility API

LiteLLM default skip_system experimental_use_latest_role_message_only
v1.93.0 passes the input scan not run not run
v1.102.2 passes passes not run
v1.104.2 blocked, 2 of 2 runs passes, 3 of 3 runs passes
main 66c8f5b1a9c blocked not run not run

Claude Code 2.1.306 and 2.1.304 (claude -p)

LiteLLM default skip_system skip_system + skip_tool experimental_use_latest_role_message_only
v1.93.0 blocked passes the input scan, mid-turn entry skipped passes the input scan passes the input scan
v1.102.2 blocked blocked, mid-turn entry still scanned not run not run
v1.104.2 passes blocked, mid-turn entry still scanned blocked passes
main 66c8f5b1a9c passes blocked, mid-turn entry still scanned blocked passes

A direct ApplyGuardrail call with only the Claude Code mid-turn entry returns PROMPT_ATTACK, and with only the Claude Code top-level system prompt returns NONE, 3 out of 3 times each. Bedrock's verdict depends on what is sent together, which is why the Claude Code default passes on v1.104.2

Linear ticket

LIT-9984

Checks

npm run lint:writing and npm run lint:docs pass locally

…-level system prompt on /v1/messages

role: system entries inside messages, which Claude Code sends mid-conversation, are still scanned. Point Bedrock users at experimental_use_latest_role_message_only to keep them out of the scan.
@vercel

vercel Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
litellm Ready Ready Preview Oct 24, 2026 12:59am UTC

Request Review

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

…tem prompt since v1.103.0

skip_system_message_in_guardrail keeps it out of the scan.
@yucheng-berri
yucheng-berri merged commit bfd31df into main Oct 26, 2026
6 checks passed
@yucheng-berri
yucheng-berri deleted the litellm_guardrail_skip_system_messages_scope branch October 26, 2026 18:37

This branch was previously deployed

1 inactive deployment
Preview — 3a89a0d4 Deployed Oct 24, 2026 by vercel[bot]
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