Bedrock Guardrails automatically rewrites user input on block
After setting up Bedrock Guardrails on a Strands Agents SDK agent and sending a blocked request, the user input disappeared from conversation history. Debugging why "my input text is gone" led to this:
Messages after block: 2
[0] user : [User input redacted.]
[1] assistant : Sorry, this request was blocked by guardrails.The original input ("What stocks should I buy?") was auto-replaced with [User input redacted.]. This prevents the same input from triggering the guardrail again in subsequent conversation turns.
This behavior is controlled by BedrockModel's guardrail_redact_input parameter (default True). The replacement message can be changed via guardrail_redact_input_message. There's also a guardrail_redact_output (default False) for the output side.
If user input disappears from conversation history during debugging, check for guardrail auto-redaction. Setting guardrail_redact_input=False preserves the original input, but risks the guardrail re-triggering on subsequent turns.
