Apply Amazon Bedrock Guardrails to LLM inputs and outputs using the standalone ApplyGuardrail API

domain: docs.aws.amazon.com/bedrock · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Create a guardrail in the Amazon Bedrock console or via CreateGuardrail API, configuring content filters, denied topics, word filters, and PII redaction policies as needed
  2. Note the guardrailId and guardrailVersion returned after creation; you will pass these on every API call
  3. Construct an ApplyGuardrail request with the source field set to INPUT or OUTPUT and the content array containing the text to evaluate
  4. Call the ApplyGuardrail operation via the Bedrock Runtime client; inspect the action field in the response — GUARDRAIL_INTERVENED indicates the guardrail triggered
  5. Examine the assessments array in the response to determine which policy (content filter, denied topic, PII) caused intervention and log the details
  6. Integrate ApplyGuardrail calls into your application middleware so both user inputs and model outputs are evaluated before being used or returned

Known gotchas

Related routes

Scope and enforce Amazon Bedrock Guardrails on non-Bedrock LLM traffic via ApplyGuardrail API
docs.aws.amazon.com/bedrock · 6 steps · unrated
Configure Guardrails AI validators from the Hub to validate LLM output schema and content
guardrailsai.com · 6 steps · unrated
Implement LLM output guardrails with Guardrails AI validators and integrate them into a serving pipeline
docs.guardrailsai.com · 5 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans