Open-source alternative to Amazon Bedrock Guardrails

Self-hosted NeMo Guardrails and Guardrails AI can replace most Bedrock Guardrails policies, but Automated Reasoning checks have no direct open-source equivalent. This page shows which policies map, what gaps remain and how to test the swap.

On this page

Open-source alternative to Amazon Bedrock Guardrails: the short answer

If a renewal, a data residency requirement or lock-in concern is pushing you to review Amazon Bedrock Guardrails, the short answer is that NeMo Guardrails and Guardrails AI cover most content, topic, word and PII policies when you self-host them. The gap is narrower but real: Automated Reasoning checks, which Bedrock offers as a logic-based verification feature, have no direct open-source equivalent that we can point to, so that control needs its own design or an accepted risk decision. Confirm the exact Bedrock policy types your application uses before you size the replacement, because the mapping depends on which of them you actually enable.

The replacement is a policy and validation layer that you run inside your own infrastructure. NeMo Guardrails sits around the model call as configurable input and output rails, configured in config.yml and Colang files, and can run as a guardrails server behind your gateway. Guardrails AI works through validators from Guardrails Hub that you install and chain into input and output guards. Both are Apache-2.0 licensed, so the software cost is zero, but you take on the work of writing policies, hosting the service, supplying the classifier models and keeping evidence of how each rail behaves. Ask your team to name the owner of each policy before work starts.

DeployOpen plans, implements, tests and documents this layer in your environment, and we prepare controls and evidence for your compliance assessments. We do not issue audit reports, attestations or certifications, and independent auditors remain responsible for those conclusions. Treat the first milestone as a side-by-side test: run a labeled sample of your own prompts and completions through Bedrock Guardrails and the open-source layer, then compare blocks, misses and false positives per policy. That comparison, not a feature checklist, will tell you whether the replacement is ready.

Which Bedrock Guardrails capabilities map to open-source options

This table compares each Bedrock Guardrails capability with the closest open-source option in NeMo Guardrails or Guardrails AI and notes where coverage is partial or missing. Read the coverage column first, then confirm every mapping against current Bedrock documentation and your own policy definitions before you decommission anything.

Bedrock Guardrails capabilityNeMo GuardrailsGuardrails AI and coverage notes
Content filtersSelf-check input and output moderation, plus NVIDIA content safety and topic safety models, can be configured as input and output rails in Colang.Toxicity and similar validators from Guardrails Hub can be chained on inputs and outputs. Confirm which categories your policy requires and test the thresholds on your own traffic.
Denied topicsTopic control via dialog rails and topic safety models. Expressing a denied topic list is a configuration task that needs testing against your own phrasing.Covered only if you write or select a validator for the topic. Hub validators are not topic-specific by default, so expect custom work.
Word filtersInput and output rails can match blocked terms or patterns through Python actions or Colang logic.Regex matching validators from Guardrails Hub map directly to word and pattern filters. Confirm case handling and exception lists in your own tests.
Sensitive information (PII) maskingPossible through custom actions or third-party integrations, but masking behavior depends on the detector you wire in and needs a full review.Depends on the PII validators your team selects, installs and tests. Coverage varies by language, entity type and data format, so measure recall and false positives on representative data.
Contextual groundingRetrieval rails and fact-checking or hallucination detection components cover related checks for RAG pipelines.Not a direct match. Grounding must be designed as a custom validator against your own source documents. Confirm how each check scores answers before relying on it.
Automated Reasoning checksNo open-source equivalent in the supplied facts. Treat this as a gap and document a compensating control or an accepted risk.No open-source equivalent in the supplied facts. Formal verification of policy rules is not described in either project, so plan a separate review or retain the Bedrock feature for those workloads.

NeMo Guardrails or Guardrails AI: when each fits

Both frameworks are Apache 2.0 and self-hostable, but they solve different parts of the problem. NeMo Guardrails controls conversation flow and rails across the whole pipeline, while Guardrails AI checks and shapes individual inputs and outputs. Read the cards to decide which fits your Bedrock Guardrails policies, and whether combining them is worth the added moving parts.

NeMo Guardrails for conversation control

NeMo Guardrails uses five rail types: input, dialog, retrieval, execution and output. Dialog rails are the closest match to Bedrock denied topics, because they define what the assistant will and will not discuss. Policies are written in Colang, so the people who own the policy need to read and review that language. Check which rails your Bedrock Guardrails configuration actually uses before you port it.

Colang learning curve and migration review

Colang has two versions, and Colang 1.0 is the default. NVIDIA provides a nemoguardrails convert tool for moving to Colang 2.x, but NVIDIA states that converted configurations still need manual review. Budget engineering and reviewer time for that review and for test coverage of each rail. Ask your implementation partner or internal team to estimate this from your real policy count.

Python API or guardrails server

NeMo Guardrails can be called from Python or run as a server that loads configurations from a folder and exposes an HTTP API, with a Dockerfile provided for the server image. This fits a platform team that wants one guardrail service in front of several applications. Confirm how your gateway, such as LiteLLM, will call that HTTP API and where the configuration folder is versioned.

NeMo microservice for Kubernetes

NVIDIA also offers a NeMo Guardrails microservice, a production container image built on the same configuration model and deployed on Kubernetes with Helm. It is a separate offering from the open-source library. Ask NVIDIA which terms, support and image access apply before you plan a production rollout, and confirm that the chart runs in your air-gapped network if that is a requirement.

Guardrails AI validators from Guardrails Hub

Guardrails AI wraps checks in validators from Guardrails Hub, such as regex matching or toxicity detection, which you install separately and chain together. Validators map well to Bedrock word filters and PII masking, and you can write custom validators for rules specific to your business. Confirm that each validator you need is available and maintained, and check its license before adoption.

Structured output with Pydantic models

Guardrails AI can generate output that matches a Pydantic model, using function calling or prompt optimization. This matters when your application needs typed fields, not free text, and when a failed check should trigger a retry rather than a silent pass. Test how often structured generation fails on your chosen model, since results depend on that model's function calling behavior.

Flask REST service and combined use

Guardrails AI can run as a standalone Flask REST service started with guardrails start, and applications call it through the OpenAI SDK. Teams often run NeMo Guardrails for conversation flow and Guardrails AI validators for field-level checks. A combined design adds two services to operate, two upgrade paths and two sets of tests, so start with one framework and add the second only where a specific policy requires it.

How each Bedrock policy type translates into rails and validators

Denied topics translate most directly into NeMo Guardrails dialog and input rails. In Colang, you define the subjects a deployment must refuse, for example investment advice or medical diagnosis, as example user messages and flows that the rail matches before the model answers. The library's topic safety models can extend that matching to subjects you did not list, so confirm how their decisions are logged and how a false match is reviewed. Content filters map to the self-check input and output moderation and NVIDIA's content safety model, while jailbreak and injection detection covers prompt attacks that a harm category alone does not capture. Test each category against your own labeled prompts before assuming it matches the strength you set in Bedrock.

Word filters are the simplest translation. A Guardrails AI guard can chain validators from Guardrails Hub, and a regex matching validator covers blocked terms, internal identifiers and account number formats. PII masking is less direct. Guardrails Hub provides validators for detecting sensitive content, but you must confirm which entity types they cover, which languages they handle, and whether they redact or only flag matches. If NeMo Guardrails is your runtime, the same logic can run as a custom action in output or execution rails, so masking happens before a response leaves the service. Decide which runtime owns each check so the same control does not run twice with conflicting results.

Anything without a supplied model or validator becomes work for your team. Automated Reasoning checks have no open-source equivalent in this comparison, so policies that must be proven against formal business rules need to be reimplemented as tested Python actions, or accepted as a gap with human review in the workflow. Contextual grounding checks map most closely to the fact-checking and hallucination detection in NeMo Guardrails, but confirm their method and accuracy on your own documents. Before cutover, build a test set from prompts your current Bedrock guardrail blocks and allows, run both stacks against it, and record every disagreement with a named owner who decides whether the rail or the policy is wrong.

Running the replacement alongside Bedrock during a transition

In the first situation, your applications keep calling Bedrock for model inference, and the open-source guardrail sits in front of that call. The guardrail service receives the user prompt, runs the input rails or validators, and only forwards the request to Bedrock if it passes. The same service then checks the model's response before it returns to the user. This pattern lets you keep existing model IDs and Bedrock contracts while moving the policy logic you control into your own network. Each application needs one extra network hop to the guardrail endpoint, and the call must return a clear pass, block or rewrite result that the application can handle.

  • Call order: Put the guardrail check before the Bedrock invocation and again on the response, so a failed input never reaches the model.
  • Failure behavior: Decide whether an unreachable guardrail blocks the request or lets it through, and write that choice into the application's runbook.
  • Logging: Bedrock invocation logging still records prompts and completions in your account, so confirm which copy is the system of record for audits.
  • Trace linkage: Pass a shared request ID from the guardrail call into the Bedrock call so both records can be joined in Langfuse or your existing tracing stack.
  • Retention: Bedrock retention still follows the model's retention mode, so the guardrail does not change what AWS stores.

Before cutover, confirm with your security team which blocked events must be retained and for how long, since the guardrail and Bedrock will each hold part of the record.

Migrating Bedrock Guardrails policies step by step

This sequence turns each Bedrock Guardrails policy into a tested, self-hosted equivalent, with a documented gap list and a rollback path before any traffic moves.

  1. Export the current guardrail configuration

    The platform or security team exports every Bedrock guardrail in use: content filter strengths by category, denied topics with their definitions and sample phrases, word filters, sensitive information (PII) entities and their actions (block or mask), and the guardrail version attached to each application. Record which model and application call each guardrail, because the same policy can behave differently across applications. Done means you hold a versioned, written inventory that another engineer could read without access to the AWS console.

  2. Classify each policy by equivalence

    For each item in the inventory, assign one of three labels: direct map, partial equivalent or no equivalent. Word filters and regex-style PII patterns usually map directly to validators such as regex matching in Guardrails AI. Denied topics and content filters are partial matches that need a topic model or a self-check prompt in NeMo Guardrails, and their thresholds will not match Bedrock's. Automated Reasoning checks have no open-source equivalent in the researched sources, so mark them as gaps and decide whether to accept, replace with tests or keep a managed control. Done means every policy has a label and a short reason.

  3. Write the self-hosted rail or validator configuration

    Build the replacement in the framework that fits each policy. Use Guardrails AI validators for pattern checks and structured output validation, installed from Guardrails Hub and chained in a guard. Use NeMo Guardrails for dialog and topic control, which means a config.yml file with Colang files and optional Python actions; Colang 1.0 is the default and Colang 2.0 is also supported. Pin library versions in your lockfile and record them with the configuration. Done means each mapped policy has a working config in version control and a one-line note on what it blocks.

  4. Convert existing Colang 1.0 files where needed

    If your team already has Colang 1.0 files from a previous NeMo Guardrails project, run NVIDIA's nemoguardrails convert tool to move them to Colang 2.x, following the migration guide. Treat the output as a draft. NVIDIA states that converted configurations still need manual review, so a reviewer should compare each converted flow with the original intent, check that rails still trigger in the same order and confirm no flow was silently dropped. Done means a signed-off review record exists for every converted file.

  5. Build a labeled test set from your own traffic

    Sample prompts and completions from your own logs, after applying your data handling rules, and label each item as should-block, should-mask or should-pass. Include attempts that Bedrock currently catches, borderline phrasing for each denied topic, PII variants your users actually send and benign requests that resemble blocked ones to measure false positives. Keep a held-out split that no one tuned against. Done means the test set is versioned, labeled by two reviewers where possible, and stored inside your own environment.

  6. Run both guardrails against the same test set

    Execute the labeled set through the existing Bedrock guardrail and the new self-hosted rails, in the same order and against the same model responses where possible. Record per-policy results: true blocks, misses, false blocks and masked outputs that differ from expected. Review each miss and false block against the policy label from step two, and tune thresholds or validators only on the tuning split. Done means you have a comparison report that shows each policy's behavior side by side, with the gaps you accepted listed explicitly.

  7. Cut over in stages with a rollback path

    Route a small share of non-critical traffic through the self-hosted guardrail first, keep the Bedrock guardrail attached and deployable, and watch block rates, masking counts and user-reported false blocks. Keep the Bedrock guardrail version and the self-hosted configuration tagged together so either can be restored in one change. Widen traffic only after the monitored results match the comparison report. Done means each application runs on the new guardrail, the rollback has been rehearsed, and the decommissioning decision for Bedrock Guardrails is recorded with its open gaps.

How to test the replacement before cutover

What should a labeled corpus for testing guardrails contain?

A labeled corpus is a set of prompts and model responses, each tagged with the outcome you expect from the guardrail, such as allow, block, mask or refuse. Build it from your own production-like traffic with sensitive data removed, and cover every policy you currently enforce on Bedrock Guardrails. Include benign prompts that look risky, such as security questions from staff or medical terms in a healthcare workflow, so you measure over-blocking as well as missed content. Have two reviewers label each item and record disagreements, because the labels become the baseline every candidate is scored against. Keep the corpus versioned so you can rerun it after each configuration change in NeMo Guardrails or Guardrails AI.

How do I measure false positives and false negatives for each policy?

Score each policy separately, because a single overall accuracy number hides the failures that matter. For every policy such as denied topics, word filters or content filters, count the cases where the guardrail blocked content that should pass (false positives) and let through content that should be blocked (false negatives). Report both rates against the labeled corpus, and show the examples behind each error so product owners can decide which trade-off is acceptable. Run the same corpus against your current Bedrock Guardrails configuration so the comparison is like for like. Expect the open-source policies to need tuning, for example through Colang flows in NeMo Guardrails or validator thresholds in Guardrails AI, and rerun the corpus after each change.

Which adversarial prompt sets should I run for jailbreak and injection?

Use adversarial sets that cover known attack families, including role-play jailbreaks, instruction overrides, encoded or obfuscated payloads, multi-turn escalation and indirect injection in retrieved documents or tool outputs. Maintain the set as a separate file from the general corpus so that you can refresh it without changing the baseline. NeMo Guardrails includes jailbreak and injection detection in its library, and you can test that detection with the same set you use for your own rails. Guardrails AI relies on validators you select, so test whether the validators you install actually catch these patterns. Add red team findings from your own security testing to the set after each engagement, and record which attack families each candidate blocks and which it misses.

How should I check PII detection on sample data?

Test PII detection with synthetic records that resemble your real data formats, such as account numbers, national identifiers, card-like numbers, dates of birth, addresses and free-text names inside customer messages. Never copy production personal data into test sets without an approved basis and access controls. For each entity type, record whether the candidate detects it, whether it masks or redacts the correct span, and whether it changes text that should remain readable for the downstream model. Check PII in both prompts and completions, because output rails and input rails often need separate configuration. Confirm which entity types each open-source validator or rail supports, since coverage varies, and document any type you must handle with a custom detector.

How do I measure latency for a guardrail replacement?

Measure the added time per request at the percentiles your application uses, not as an average, and measure it with and without the guardrail on the same prompts. Include every rail that runs on the request path, such as input checks, a self-check model call, and output checks, because each model-based rail adds a round trip. Test under concurrent load that matches your peak traffic, and record how the guardrail server behaves when it is saturated. If the candidate calls an LLM for moderation, the latency and cost of that model become part of the guardrail budget. Compare results against the Bedrock Guardrails baseline measured from your own region and network path.

What test evidence should I keep for assessors?

Keep a dated record of the corpus version, the candidate versions (for example, the NeMo Guardrails release or Guardrails AI release you tested), the configuration files under version control, the scores per policy, the list of accepted residual risks, and the reviewer sign-off for each decision. Store raw results and the commands used to produce them so a reviewer can reproduce a run. This evidence supports your own control narrative and helps an assessor trace how a policy was chosen, but it does not constitute an audit, attestation or certification. Ask your assessor or certification body which artifacts they expect for the frameworks you are assessed against, and confirm retention rules for any test data that contains sensitive content.

Can my own team run these tests, or do we need outside help?

Your team can run the tests if it has someone who can write evaluation scripts, owns the labeled corpus and can interpret false positive and false negative results with product and compliance staff. The work that usually takes the longest is labeling and policy decisions, not running the tool. DeployOpen can help plan the test scope, build the corpus with your data owners, run security testing against the guardrail, and prepare evidence, under a fixed scope agreed in writing before work starts. Ask any provider to state which tests are included, what the deliverables are, and who keeps the corpus and results after the engagement.

What has no open-source equivalent today

The main gap is Automated Reasoning checks, the Bedrock Guardrails feature that tries to verify model responses against rules you formalize from your own policy documents. None of the open-source options in this topic supplies an equivalent. NeMo Guardrails and Guardrails AI both work by running rails or validators on text: NeMo Guardrails uses input, dialog, retrieval, execution and output rails written in Colang, and Guardrails AI chains validators from Guardrails Hub. Those checks catch patterns, topics and policy violations, but they do not prove that a response is consistent with a formal rule set. Plan to replace this capability with process controls rather than expect a drop-in tool.

The compensating controls are organizational as much as technical. Start with formal review: have a policy owner and a domain expert map each rule to a specific test case, and record who approved the mapping. Add deterministic tests: maintain a fixed regression suite of prompts and expected outcomes that runs on every change to the rails configuration, the model version or the system prompt, so a change in behavior is visible before release. Require human sign-off for high-impact outputs, such as customer-facing statements about fees, eligibility or medical guidance, and log the reviewer's decision. Where a single wrong answer carries legal weight, route the response through a rule-based check in your own application code instead of relying on a model-based rail.

Before you decide, confirm the current scope of each Bedrock Guardrails feature directly with AWS. Ask which Automated Reasoning capabilities are generally available, in which regions, and for which model families, and whether any check is limited to a preview. Ask how the feature is priced and what data it retains, because those answers affect the cost comparison and the data retention review. Also confirm how your own versions of NeMo Guardrails or Guardrails AI handle the policies you rely on, using the release notes for the version you plan to pin, since behavior can change between releases. Record the answers in the migration file so the replacement design and the audit evidence refer to the same facts.

How DeployOpen scopes and delivers a guardrail replacement

DeployOpen plans, implements, customizes, integrates, hardens, documents and supports self-hosted open-source platforms inside your own cloud accounts, data centers or air-gapped networks. For a Bedrock Guardrails replacement, that means turning your existing policies into a written, testable set of NeMo Guardrails rails or Guardrails AI validators running in your environment.

How we scope

  • Inventory which Bedrock Guardrails policies are in use, including content filters, denied topics, word filters and PII masking.
  • Mark which policies map to open-source rails or validators and which need a documented gap decision.
  • Agree scope, deliverables and timelines in writing before any work starts, as most engagements are fixed-scope.

How we build

  • Implement input, output and dialog rails or validator chains in the framework that fits your policies and runtime.
  • Connect the guardrail service to your model endpoints and gateway inside your own network.
  • Test each policy against your own prompts, including attempted jailbreaks and PII samples, and record the results.

How we hand over

  • Deliver configuration files, custom actions or validators, deployment manifests and an operating runbook.
  • Document the policy mapping, known gaps and the test evidence that compliance and security reviewers will ask for.
  • Walk your platform and security teams through upgrades, configuration changes and rollback procedures.

How we support

  • Offer ongoing support, upgrades and continuous testing as a retainer after handover.
  • Re-run the policy test suite when you change models, framework versions or guardrail configurations.
  • Confirm with your team which support level and response expectations belong in the retainer scope.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.