Skip to content

Amazon Bedrock Guardrails: what it covers and where it stops

Amazon Bedrock Guardrails checks prompts and responses against policies you configure. What each policy catches, how to apply it to any model, and its gaps.

Published
Reading time
14 min read

In short

  • Amazon Bedrock Guardrails is an AWS service that checks prompts and model responses against six policy types: content filters with prompt attack detection, denied topics, word filters, sensitive information filters, contextual grounding checks, and Automated Reasoning checks.
  • A guardrail runs either inside a Bedrock inference call (Converse or InvokeModel with a guardrail configuration) or through the standalone ApplyGuardrail API, which checks any text and so can guard models hosted outside Bedrock.
  • What gets evaluated depends on tags. Once a Converse request contains a guardContent block, only tagged content is checked, system prompts are skipped unless tagged, and InvokeModel prompt attack filtering needs input tags to run at all.
  • The largest gap is tool use. Inline guardrails do not evaluate tool results, tool call arguments, or tool definitions, so indirect prompt injection and PII inside agent tool traffic pass through unless you check that text yourself.

Amazon Bedrock Guardrails is an AWS service that checks prompts and model responses against policies you configure, then blocks the content, masks sensitive values in it, or reports what it found. Bedrock Guardrails runs either inside a Bedrock inference call or on its own through the ApplyGuardrail API, which accepts any text and so works for models hosted elsewhere.

It covers content moderation, topic restrictions, PII, and grounding well. It stops at tool traffic, reasoning blocks, and anything your request does not tag for evaluation. This article goes through each policy type, the ways to apply a guardrail, the pricing model, and the gaps, with every behavior checked against the AWS documentation as of November 2026. For where guardrails sit in a system in general, start with LLM guardrails.

The six policy types

A guardrail is a named, versioned resource that holds one or more policies. AWS lists six, and each can be enabled for prompts, responses, or both, with its own action on each side.

PolicyWhat it checksActionsKey limits
Content filtersHate, insults, sexual, violence, and misconduct, at a strength of none, low, medium, or high. Text and imagesBlock or detectPrompt attack detection is part of this policy
Prompt attacksJailbreaks, prompt injection, and, on Standard tier, prompt leakageBlock or detectInput only. Needs input tags with InvokeModel
Denied topicsSubjects you define in natural language, such as investment adviceBlock or detectUp to 30 topics. 200-character definitions on Classic, 1,000 on Standard
Word filtersA managed profanity list and your own words and phrasesBlock or detectUp to 10,000 items of up to three words each
Sensitive informationBuilt-in PII types such as EMAIL, US_SOCIAL_SECURITY_NUMBER, and AWS_SECRET_KEY, plus your own regular expressionsBlock, mask, or detectRegex patterns up to 500 characters, no lookaround
Contextual groundingWhether a response is grounded in a source you supply and relevant to the queryBlock or detectResponse only. 100,000-character source, 1,000-character query, 5,000-character response
Automated ReasoningWhether a response is consistent with formal rules extracted from your policy documentsDetect onlyEnglish (US) only, seven Regions, no streaming

Each policy has its own failure mode, and the docs say so plainly.

  • Content filters classify text by confidence. A high strength blocks more, including more legitimate requests, so the strength is a tuning decision you measure, not a default to accept.
  • Denied topics are matched by meaning, not keywords. AWS advises against negative definitions such as "everything except medical information" and against using topics to catch names or single words, which belong in word filters. The docs also note that the order of topics can change whether the same prompt is blocked.
  • Word filters match whole words and phrases, case-insensitively. competitor does not match competitors, so list each form you need.
  • Sensitive information filters are a probabilistic, context-dependent model. AWS notes that they perform better with more surrounding text, so a bare string of digits is harder to classify than the same digits in a sentence. PII redaction covers what detection of this kind misses.
  • Contextual grounding checks produce a grounding score and a relevance score between 0 and 1, and block responses below thresholds you set between 0 and 0.99. They only run on output, because they need the response.
  • Automated Reasoning checks translate a response into logic and test it against rules built from documents you upload. They return findings such as valid or invalid and never block, so your code has to act on the result.

Classic and Standard tiers

Content filters, prompt attacks, denied topics, and contextual grounding come in two safeguard tiers. Classic supports English, French, and Spanish. Standard supports more languages, handles harmful content inside code (comments, identifiers, and string literals), adds prompt leakage detection, and allows longer topic definitions.

Standard tier requires cross-Region inference. AWS keeps those requests within the geography where they start, so a US request stays in US Regions, but it states that prompts and results "might move outside of your primary Region." If a data-residency commitment names a single Region, that rules out Standard tier. Pricing is the same for both tiers.

Two ways to apply a guardrail

You apply a guardrail inline, by naming it on a Bedrock inference call, or standalone, by sending text to ApplyGuardrail yourself. The inline path is less code. The standalone path works with any model and gives you control of what happens after a block.

1 · INLINE: CONVERSE OR INVOKEMODEL WITH GUARDRAILCONFIGYour appCONVERSE CALLInput checkRUNS IN PARALLELBedrock modelIF INPUT PASSESOutput checkBLOCK OR MASKResponseOR BLOCKED TEXTBLOCKED MESSAGE, NO MODEL CALL2 · STANDALONE: ONE APPLYGUARDRAIL CALL PER SIDEYour appANY RUNTIMEApplyGuardrailSOURCE INPUTAny modelANY PROVIDERApplyGuardrailSOURCE OUTPUTResponseAPP DECIDESNot evaluated on either pathTOOL RESULTS · TOOL CALL ARGUMENTS · TOOL DEFINITIONS · REASONING BLOCKS
Inline, Bedrock runs the input check, the model, and the output check in one call, and a failed input check returns the blocked message without calling the model. Standalone, the app calls ApplyGuardrail on each side of a model from any provider and decides what to return.

Inline with Converse or InvokeModel

Pass a guardrail ID and version on Converse, ConverseStream, InvokeModel, or InvokeModelWithResponseStream. AWS describes the sequence: the input is evaluated against every configured policy in parallel, a failed check returns your blocked message and the model is not called, and otherwise the model runs and its response is evaluated before it reaches you.

converse-params.json
{
  "modelId": "amazon.nova-micro-v1:0",
  "guardrailConfig": {
    "guardrailIdentifier": "gr-abc123",
    "guardrailVersion": "1",
    "trace": "enabled"
  },
  "system": [{ "text": "You answer questions about our checking accounts." }],
  "messages": [
    {
      "role": "user",
      "content": [{ "guardContent": { "text": { "text": "Should I move my savings into crypto?" } } }]
    }
  ]
}

On an intervention, Converse sets stopReason to guardrail_intervened and puts the blocked message in output. A masked response reports the same stopReason, with placeholders such as {NAME} in the text instead of the blocked message. To tell a block from a mask, enable the trace and read each entry's action, which is BLOCKED or ANONYMIZED.

Guardrails also attach to Bedrock Agents and Knowledge Bases. Embedding, reranking, and image generation models do not support them.

Standalone with ApplyGuardrail

ApplyGuardrail evaluates text against a guardrail without invoking any model. You set source to INPUT for user text or OUTPUT for model text, and the response returns action (GUARDRAIL_INTERVENED or NONE), the blocked message or masked text in outputs, and per-policy assessments.

Because it is decoupled from the model, it can guard a model on another provider or one you host yourself. The caller needs AWS credentials with bedrock:ApplyGuardrail on the guardrail, and the text travels to AWS for evaluation.

guard.py
import json
import boto3
 
bedrock = boto3.client("bedrock-runtime", region_name="us-east-1")
 
def guard(text: str, source: str) -> tuple[str, bool]:
    """Run the guardrail on one side of a call. Returns the text to use and whether it was blocked."""
    resp = bedrock.apply_guardrail(
        guardrailIdentifier="gr-abc123",
        guardrailVersion="1",
        source=source,  # "INPUT" or "OUTPUT"
        content=[{"text": {"text": text}}],
    )
    if resp["action"] != "GUARDRAIL_INTERVENED":
        return text, False
    # A block and a mask both intervene. Only the assessments tell them apart.
    blocked = '"BLOCKED"' in json.dumps(resp["assessments"])
    return resp["outputs"][0]["text"], blocked
 
def answer(prompt: str, call_model) -> str:
    prompt, blocked = guard(prompt, "INPUT")
    if blocked:
        return prompt  # the configured blocked message; no model call is made
    reply = call_model(prompt)  # any provider: OpenAI, Anthropic, vLLM
    reply, _ = guard(reply, "OUTPUT")
    return reply

The standalone path also lets you check text the inline path skips. In a RAG pipeline you can screen the user's question before retrieval runs, and in an agent loop you can send a tool result through ApplyGuardrail before the model sees it. The default response lists only detected content. Set outputScope to FULL to see every assessment, which helps when tuning thresholds.

InvokeGuardrailChecks for agent loops

AWS added a third option in June 2026. InvokeGuardrailChecks runs individual safeguards without a guardrail resource, so there is no ID or version to manage. It supports content filters, prompt attack detection as a separate check, and sensitive information filters.

It is detect-only. Each check returns a score between 0 and 1, and your code decides whether to block, redact, retry, or send the item for human review. AWS positions it for agent loops that need different checks at each step: prompt attacks on input, PII on the response, and a check on a tool result before it goes back to the model. At launch it is available in seven Regions: N. Virginia, Ohio, Oregon, London, Stockholm, Tokyo, and Sydney.

What a guardrail evaluates, and what it skips

On the inline path, tagging decides which parts of a request are evaluated, and the defaults are easy to get wrong.

With Converse, a guardrail evaluates every message and skips the system prompt. Add a guardContent block anywhere in the messages and the guardrail evaluates only content inside guardContent blocks, so earlier turns and untagged context are skipped. The system prompt is evaluated only if it has its own guardContent block. With InvokeModel, you wrap user input in amazon-bedrock-guardrails-guardContent_<suffix> tags.

Tagging is useful. It keeps a guardrail from flagging your own system instructions or retrieved documents, and it cuts the text you pay to evaluate. It is also a way around the guardrail, because whoever builds the request decides what is tagged.

Prompt attack detection has a narrower scope than its name suggests. It looks at user input for jailbreaks and direct injection. It does not evaluate tool results, which is where indirect injection arrives in an agent. As the prompt injection article explains, a classifier lowers the rate of successful attacks and does not remove them.

Streaming responses

Streaming guardrails run in one of two modes, set with streamProcessingMode.

  • Synchronous (the default) buffers response chunks, checks them, and then releases them. Every chunk is checked before the user sees it, and the buffering delays the stream, which shows up in time to first token.
  • Asynchronous sends chunks as they arrive and checks them in the background. Content can reach the user before the check finishes, and later chunks are blocked once a violation is found. AWS does not support masking sensitive information in this mode.

Two policies have their own streaming limits. Contextual grounding treats a response as relevant if any chunk is relevant, so an irrelevant streamed response can be flagged only after it has been fully sent. Automated Reasoning checks do not support streaming APIs at all and need the complete response.

Making a guardrail mandatory

A guardrail named in a request is optional for the caller unless you enforce it. AWS offers two ways.

IAM. The bedrock:GuardrailIdentifier condition key on Converse, ConverseStream, InvokeModel, and InvokeModelWithResponseStream denies any inference call that does not name the guardrail and version you specify. AWS lists the limits. Callers can still use input tags to keep content out of the input check, though the guardrail always applies to the response. A role constrained this way also gets access-denied errors from RetrieveAndGenerate, InvokeAgent, and InvokeInlineAgent, because those make internal model calls without a guardrail.

Enforcements. An account-level enforcement applies a guardrail version to every Bedrock model invocation in an account, set per Region. An organization-level enforcement does the same across accounts and OUs through an Amazon Bedrock policy in AWS Organizations. Enforcements have three properties to plan around:

  • When organization, account, and request guardrails all apply, the effective control is their union, with the most restrictive setting winning.
  • Selective content guarding lets administrators decide whether callers' tags are honored for system prompts and messages. Both default to comprehensive, which evaluates everything regardless of tags.
  • Automated Reasoning policies are not supported in enforced guardrails, and AWS warns that including one causes runtime failures.

Enforcement covers Bedrock invocations only. A model called on another provider is guarded only if your code or a gateway calls ApplyGuardrail.

What Bedrock Guardrails costs

AWS charges per policy configured in the guardrail, per 1,000 text units, where a text unit is up to 1,000 characters. A 5,600-character input is 6 text units. On the Amazon Bedrock pricing page as of November 23, 2026, the prices are:

PolicyPrice
Content filters (text)$0.15 per 1,000 text units
Content filters (image)$0.00075 per image processed
Denied topics$0.15 per 1,000 text units
Sensitive information filters$0.10 per 1,000 text units
Sensitive information filters (regular expression)Free
Word filtersFree
Contextual grounding checks$0.10 per 1,000 text units
Automated Reasoning checks$0.17 per 1,000 text units per Automated Reasoning policy

Through InvokeGuardrailChecks, the same page lists content filters at $0.07, prompt attack at $0.08, and sensitive information filters at $0.10 per 1,000 text units, all text only.

Four details decide the bill more than the rates do.

  1. You pay per policy, per side. A guardrail with content filters and denied topics bills both on the prompt and again on the response.
  2. A blocked input skips the model charge, a blocked output does not. If the guardrail blocks the prompt, you pay for the evaluation and no inference. If it blocks the response, you pay for the evaluation of both sides and for the model output that was generated.
  3. Contextual grounding counts the source. Its text units combine the source, the query, and the response, so a RAG answer checked against 20,000 characters of retrieved context bills at least 20 units for that check alone.
  4. Guardrails stack. Under enforcement, consumption is counted per guardrail, so a request covered by an organization, an account, and a request guardrail is evaluated three times.

Tagging only the text that needs a check is the main way to lower the bill. The guardrailCoverage field in each assessment reports how many characters were guarded out of the total, which is a quick way to confirm your tags work.

Where Bedrock Guardrails stops

Most of these gaps are documented by AWS. They matter most for agents and for regulated data.

  • Tool traffic is not evaluated. On the inline path, content filters, prompt attack detection, denied topics, word filters, and sensitive information filters skip tool results (toolResult), tool definitions (toolSpec), and the arguments the model writes into tool calls (toolUse.input). A customer's email address that the model passes to a write tool is not masked, and an instruction planted in a fetched web page is not screened. Check that text with ApplyGuardrail or InvokeGuardrailChecks yourself.
  • Reasoning content is excluded. The service evaluates inputs and responses "excluding reasoning content blocks."
  • Masking does not reach the logs. If model invocation logging is on, CloudWatch Logs keeps the original, unmasked request. The trace's match fields and modelOutput also hold the original values, so the trace you need to tell a mask from a block is itself sensitive data.
  • Language coverage depends on tier. Classic supports English, French, and Spanish. Automated Reasoning supports English (US) only.
  • Automated Reasoning has narrow inputs. Encoded or obfuscated text anywhere in a submission can leave the whole submission unevaluated, and AWS says outright that the checks provide no prompt injection protection and no off-topic detection.
  • Detection models change under you. AWS updates the models behind each policy automatically and recommends you keep testing. A threshold tuned today can behave differently next quarter.
  • The draft is mutable. DRAFT changes whenever someone edits the guardrail. Pin a numeric version in production, as the enforcement docs instruct, so the configuration cannot change under live traffic.

For checks the service does not offer, such as business rules or output format validation, you still need your own code or another provider. The guardrails comparison covers how these layers combine.

Calling Bedrock Guardrails from a gateway

A gateway can call ApplyGuardrail once for every application, which closes the gap for models outside Bedrock without changing each service's code. Bifrost, an open-source AI gateway by Maxim AI, documents an AWS Bedrock Guardrails integration in its Enterprise guardrails: a profile holds the guardrail_arn, guardrail_version, and AWS credentials (static keys, a Bedrock API key, or an IAM role), and rules written in CEL decide which requests the profile checks on input, output, or both. The same profile can be linked to MCP rules, so tool arguments and tool results are checked as text at the gateway. That covers part of the tool-traffic gap described above. When an output rule can block a streamed response, Bifrost holds the whole stream until the check finishes, so expect the same latency trade-off as Bedrock's synchronous mode. What an LLM gateway does covers the rest of that layer.

How to test a Bedrock guardrail

Test a guardrail with your own traffic before it blocks anything, because every policy above is a classifier with false positives.

  1. Start in detect mode. Set each policy's action to detect (NONE in the API). The guardrail returns assessments without blocking, so you can measure what it would have done.
  2. Replay real prompts. Send a sample of production prompts and responses through ApplyGuardrail with outputScope set to FULL, and record per-policy hits and scores.
  3. Review the blocks. Read every would-be block for a week. Raise or lower content filter strengths and grounding thresholds until the false positives are ones you accept.
  4. Test the bypasses. Send an untagged InvokeModel prompt attack, a prompt that hides the attack in a tool result, and a PII value in a tool call argument. Confirm which ones your setup catches.
  5. Version and switch. Create a numeric version, change the actions to block, and watch the CloudWatch guardrail metrics for the intervention rate after release.

Frequently asked questions

What is Amazon Bedrock Guardrails?

Amazon Bedrock Guardrails is a managed AWS service that evaluates prompts and model responses against configurable policies: content filters with prompt attack detection, denied topics, word filters, sensitive information filters, contextual grounding checks, and Automated Reasoning checks. It can block content, mask sensitive values, or return detections for your code to act on.

Can Bedrock Guardrails be used with models outside Bedrock?

Yes, through the ApplyGuardrail API, which evaluates any text without invoking a model. Call it on the prompt with source set to INPUT and on the response with source set to OUTPUT. The caller needs AWS credentials, and each call is billed per policy like an inline evaluation.

How is Bedrock Guardrails priced?

AWS bills each configured policy per 1,000 text units, where a text unit is up to 1,000 characters, and image content filtering per image. Word filters and regex-based sensitive information filters are free. Current rates are on the Amazon Bedrock pricing page.

Does Bedrock Guardrails stop prompt injection?

It detects some of it. The prompt attack filter catches jailbreaks and direct injection in user input, and on Standard tier also prompt leakage. It does not evaluate tool results, where indirect injection arrives in agents, and with InvokeModel it runs only on tagged input.

Does Bedrock Guardrails work with streaming?

Yes. In the default synchronous mode it buffers and checks chunks before sending them, which adds latency. Asynchronous mode streams without delay but can show content before a block and does not support masking. Automated Reasoning checks do not support streaming.

What is the difference between ApplyGuardrail and InvokeGuardrailChecks?

ApplyGuardrail evaluates text against a guardrail resource you created and versioned, and it can block or mask. InvokeGuardrailChecks runs individual checks without a guardrail resource and only returns scores between 0 and 1, leaving the action to your code. It supports content filters, prompt attacks, and sensitive information filters, in fewer Regions.

Sources

  1. 01Detect and filter harmful content by using Amazon Bedrock GuardrailsAWS docs
  2. 02How Amazon Bedrock Guardrails worksAWS docs
  3. 03Safeguard tiers for guardrails policiesAWS docs
  4. 04Use the ApplyGuardrail API in your applicationAWS docs
  5. 05Use the InvokeGuardrailChecks API in your applicationAWS docs
  6. 06Include a guardrail with the Converse APIAWS docs
  7. 07Detect prompt attacks with Amazon Bedrock GuardrailsAWS docs
  8. 08Remove PII from conversations by using sensitive information filtersAWS docs
  9. 09Use contextual grounding check to filter hallucinations in responsesAWS docs
  10. 10What are Automated Reasoning checks in Amazon Bedrock Guardrails?AWS docs
  11. 11Configure streaming response behavior to filter contentAWS docs
  12. 12Enforce the use of specific guardrails in model inference requestsAWS docs
  13. 13Apply cross-account safeguards with Amazon Bedrock Guardrails enforcementsAWS docs
  14. 14Distribute guardrail inference across AWS RegionsAWS docs
  15. 15Amazon Bedrock pricingAWS
  16. 16AWS Bedrock GuardrailsBifrost docs
  17. 17GuardrailsBifrost docs