- Newest
- Most votes
- Most comments
You can associate a guardrail with your Amazon Bedrock agent either when creating a new agent or when updating an existing one.
In the Amazon Bedrock console:
- Navigate to the Agent builder
- In the "Guardrail details" section, choose "Edit"
- Select your guardrail from the dropdown menu under "Select guardrail"
- Choose the version you want to use under "Guardrail version"
- You can select "View" to review your Guardrail settings
- Save your changes
Using the API, you can associate a guardrail by:
- Including a
guardrailConfigurationfield in the body of a CreateAgent or UpdateAgent request - The configuration should specify the guardrail identifier and version
Here's an example of how to associate a guardrail with an agent using the API:
gconfig = {
"guardrailIdentifier": 'your-guardrail-id',
"guardrailVersion": 'DRAFT'
}
response = bedrock_agent_client.create_agent(
agentName=agent_name,
agentResourceRoleArn=agent_role['Role']['Arn'],
foundationModel="your-chosen-model",
instruction=agent_instruction,
guardrailConfiguration=gconfig,
)
Important: If you associate a guardrail with your agent, you must also attach an identity-based policy to the agent's service role that includes permissions for the bedrock:ApplyGuardrail action with the appropriate guardrail resource.
Sources
Implement safeguards for your application by associating a guardrail with your agent - Amazon Bedrock
Use guardrails for your use case - Amazon Bedrock
Improve LLM application robustness with Amazon Bedrock Guardrails and Amazon Bedrock Agents | AWS Machine Learning Blog
Create and configure agent manually - Amazon Bedrock
Create a service role for Amazon Bedrock Agents - Amazon Bedrock
answered a year ago
Relevant content
- AWS OFFICIALUpdated 2 months ago
- AWS OFFICIALUpdated 7 months ago

I can't find the 'guardrail details' section in agent builder. Am i missing something?