Setting up Bedrock Guardrails
Bedrock Guardrails
Use Portkey to enforce structured inputs, safe outputs, and usage policies across all Bedrock requests. Configure verdict actions like async checks, request denial, and feedback logging, according to your enforcement needs.
Bedrock Guardrails
Amazon Bedrock gives you access to some of the most advanced foundation models from leading providers, but running them in production requires more than raw capability. With Portkey, you can apply customizable guardrails to every Bedrock request, ensuring safety, compliance, and control without changing your application code.
Bedrock supports models like Anthropic’s Claude, Meta’s Llama, Mistral, Amazon’s Titan, Cohere, and even OpenAI’s o3 and Whisper. These models are used across use cases like chat, summarization, document analysis, code generation, and multimodal tasks.
Portkey integrates seamlessly with all Bedrock-supported models via its gateway, helping you standardize guardrails, monitor usage, and route requests intelligently, without vendor lock-in.
With Portkey, you can:
- Protect your AI stack from security threats with built-in guardrails
- Route requests with precision and zero latency based on guardrail checks
- View guardrails verdicts, latency, and pass/fail status for every check in real time.
- Enforce org-wide AI safety policies across all your teams, workspaces, and models.
- Integrate existing guardrail infrastructure through simple webhook calls
- Secure vector embedding requests
Portkey supports all Bedrock models out of the box and can be deployed in hours, not weeks, making it the easiest way to bring enterprise-grade control to your AI stack.
World-Class Guardrail Partners
Integrate top guardrail platforms with Portkey to run your custom policies seamlessly — from content filtering and PII detection to moderation and compliance. Ensure every AI request is safe, auditable, and aligned with your enterprise standards.
Guardrail checks you can apply to Bedrock
Portkey offers both deterministic and LLM-powered guardrails that work seamlessly with Bedrock’s APIs. You can apply these checks to inputs, outputs, or both.
Input guardrails
- Regex Match: Enforce patterns on input prompts
- Sentence / Word / Character Count: Control verbosity
- Lowercase Detection: Control verbosity
- Ends With: Validate specific prompt endings
- Webhook: Enforce custom business logic
- JWT Token Validator: Verify token authenticity
- Model Whitelist: Allow only approved models per route
- Moderate Content: Block unsafe or harmful prompts
- Check Language: Enforce language constraints
- Detect PII: Prevent sensitive info in prompts
- Detect Gibberish: Block incoherent or low-quality input
Output guardrails
- Regex / Sentence / Word / Character Count: Ensure required words or phrases
- JSON Schema / JSON Keys: Ensure required words or phrases
- Valid URLs: Validate links in responses
- Contains Code: Detect code in specific formats
- Webhook: Post-process or validate output
How to add guardrails to Bedrock with Portkey
Adding Portkey Guardrails in production is just a 4-step process:
- Create Guardrail Checks
- Create Guardrail Actions
- Enable Guardrail through Configs
- Attach the Config to a Request
Guardrail action settings
- Async (TRUE): Run guardrails in parallel to the request.
- Deny Request (TRUE): Block the request or response if any guardrail fails.
Frequently Asked Questions
- Do guardrails add latency to requests?
- Can I block a request if a guardrail fails?
- What happens if I don’t want to block, just observe?
- What’s the difference between basic and pro guardrails?
Safeguard your Bedrock requests now.
Whether you're running production workloads, or scaling across teams, Portkey’s guardrails give you control without compromise.
Portkey, Inc.
2261 Market Street #5205, San Francisco, CA