Proposed Content
Update the bedrock model page to cover the guardrail_latest_message parameter added in this commit: strands-agents/sdk-python@08bf563
Location
https://strandsagents.com/latest/documentation/docs/user-guide/concepts/model-providers/amazon-bedrock/
Rationale
Missing functionality
Content Outline (Optional)
No response
References
No response
Implementation Requirements
Based on analysis of the referenced commit and existing documentation structure.
New Parameter Details
| Parameter |
Type |
Default |
Description |
guardrail_latest_message |
Optional[bool] |
False |
When enabled, sends only the latest user message to guardrails instead of the entire conversation |
Technical Behavior
When guardrail_latest_message=True:
- Only the last user message is evaluated by guardrails
- Text content is wrapped as:
{"guardContent": {"text": {"text": "message"}}}
- Image content is wrapped as:
{"guardContent": {"image": {...}}}
- Earlier messages in the conversation are not evaluated by guardrails
Use Cases
This parameter is useful when:
- Performance optimization: Evaluate less content per request
- Cost reduction: Fewer tokens processed by guardrails
- Targeted checking: Only evaluate the newest user input, trusting that previous messages have already been validated
Files to Modify
docs/user-guide/concepts/model-providers/amazon-bedrock.md
- Add
guardrail_latest_message parameter to the Guardrails section (around line 421-431)
- Include the parameter in the existing code example with a brief comment explaining its purpose
Documentation Changes
Update the existing Guardrails code example in amazon-bedrock.md to include the new parameter:
# Using guardrails with BedrockModel
bedrock_model = BedrockModel(
model_id="anthropic.claude-sonnet-4-20250514-v1:0",
guardrail_id="your-guardrail-id",
guardrail_version="DRAFT",
guardrail_trace="enabled", # Options: "enabled", "disabled", "enabled_full"
guardrail_stream_processing_mode="sync", # Options: "sync", "async"
guardrail_redact_input=True, # Default: True
guardrail_redact_input_message="Blocked Input!",
guardrail_redact_output=False, # Default: False
guardrail_redact_output_message="Blocked Output!",
guardrail_latest_message=True, # Only evaluate the latest user message (default: False)
)
Add a brief explanation below the code block:
Note: When guardrail_latest_message=True, only the most recent user message is sent to guardrails for evaluation. This can improve performance and reduce costs in multi-turn conversations where earlier messages have already been validated.
Acceptance Criteria
Proposed Content
Update the bedrock model page to cover the
guardrail_latest_messageparameter added in this commit: strands-agents/sdk-python@08bf563Location
https://strandsagents.com/latest/documentation/docs/user-guide/concepts/model-providers/amazon-bedrock/
Rationale
Missing functionality
Content Outline (Optional)
No response
References
No response
Implementation Requirements
Based on analysis of the referenced commit and existing documentation structure.
New Parameter Details
guardrail_latest_messageOptional[bool]FalseTechnical Behavior
When
guardrail_latest_message=True:{"guardContent": {"text": {"text": "message"}}}{"guardContent": {"image": {...}}}Use Cases
This parameter is useful when:
Files to Modify
docs/user-guide/concepts/model-providers/amazon-bedrock.mdguardrail_latest_messageparameter to the Guardrails section (around line 421-431)Documentation Changes
Update the existing Guardrails code example in
amazon-bedrock.mdto include the new parameter:Add a brief explanation below the code block:
Acceptance Criteria
guardrail_latest_messageparameter is documented in the Guardrails section ofamazon-bedrock.mdmkdocs build