Open-source alternative to Lakera prompt defense

Self-hosted NeMo Guardrails and Guardrails AI can cover much of Lakera Guard's prompt attack detection, but detection quality must be measured before you switch. This page maps the capabilities, gaps, migration path and cost components.

On this page

Open-source alternative to Lakera prompt defense: the short answer

If your application calls Lakera Guard for prompt attack screening, the two main open-source options are NVIDIA NeMo Guardrails and Guardrails AI, both licensed under Apache 2.0. Neither is a drop-in replacement. NeMo Guardrails provides input and output rails, including jailbreak and injection detection, configured through a config.yml file and Colang files. Guardrails AI builds guards from validators published on Guardrails Hub, which you install separately and chain together. In both cases, your team owns the wiring into the application, the policies, the choice of detection models and the tuning that Lakera's managed console currently handles for you.

Archived LLM Guard is not a target for new rollouts. Because the project is no longer maintained, it should not anchor a new design, although teams with an existing deployment should plan their exit. Do not assume that any open-source option matches Lakera's detection coverage or accuracy on your traffic. Coverage differs by rail type and by model, and no published comparison in this context establishes equivalence. Ask Lakera for the detection categories you rely on today, then confirm with each candidate project which of those categories it covers out of the box and which you would need to build yourself.

Measure before you switch. promptfoo is the tool to run this check. It is MIT licensed, runs locally, and its red-teaming references include the OWASP LLM Top 10. Replay recorded or representative prompts through Lakera and each candidate, then compare verdicts on attacks and on benign traffic. Agree on your false positive tolerance and your miss tolerance in writing before the test starts, because those two numbers decide which configuration is ready for enforcement.

Which Lakera capabilities map to which open-source option

This table maps the main capabilities of Lakera Guard to NeMo Guardrails, Guardrails AI and promptfoo, and marks where coverage is partial or unknown. Read each row as a question to confirm in your own environment, since open-source detection quality depends on the models, rails and validators you configure and test. The main takeaway is that open-source options cover the request path and testing well, but threat intelligence updates and per-category detection quality are work you must own.

Lakera capabilityNeMo GuardrailsGuardrails AI and promptfoo
Prompt injection and jailbreak detectionJailbreak and injection detection is included in the library, applied as input rails. Confirm detection rates on your own prompts and languages.No built-in jailbreak model in the validator approach described for Guardrails AI. Validators from Guardrails Hub must be chosen and tested, and promptfoo can measure gaps through red-team probes.
Harmful content moderationSelf-check input and output moderation and NVIDIA content safety and topic safety models are part of the library. Content policies must be written and tuned.Toxicity and similar validators from Guardrails Hub can be chained into guards. Coverage per category varies by validator and must be confirmed.
Data leakage and PII checksOutput rails can block or rewrite responses, but PII detection depends on the models or actions you add. Confirm entity coverage.Regex and PII-style validators can be chained, which suits known formats such as account numbers. Free-text PII needs separate testing.
Policy configurationRails are defined in config.yml, optional Python actions and Colang files. Colang 1.0 is the default and 2.0 is also supported, so policy review is code review.Guards are defined in code and chained validators. Policies live with the application and version control rather than in a managed console.
Output and structured response checksOutput rails validate model responses before they reach users. Retrieval and execution rails cover RAG chunks and tool calls.Structured output matching Pydantic models is supported, and output guards validate generated content against chosen validators.
Latency and deployment modelRuns as a Python library or a guardrails server with an HTTP API, with a Dockerfile provided. Detection models may need GPU or CPU capacity you size yourself.Runs as a Python library or a standalone Flask REST service. Latency depends on the validators chained, so measure each guard on production-like traffic.
Red-team evaluation and testingNot a red-team tool by itself. Test rails with your own evaluation sets before enforcement.promptfoo runs locally and covers evaluation and automated red teaming, referencing the OWASP LLM Top 10 and NIST AI RMF. Its self-hosted app is not recommended for production use.
Managed threat intelligence updatesNot replicated. Detection models and rules are updated only when you pull new releases or retrain, and you must track that process.Not replicated. Validator updates come from Guardrails Hub and your own engineering, so define an owner and a review cadence.

NeMo Guardrails or Guardrails AI: when each fits

NeMo Guardrails and Guardrails AI both run in your own infrastructure under Apache 2.0, but they start from different questions. One asks how a conversation should be steered and filtered, the other asks how a model output must be validated and shaped. The cards below set out which team and which risk each one fits, and what testing each one needs before it replaces Lakera's prompt defense.

NeMo Guardrails for conversational control

NeMo Guardrails is built around five rail types: input, dialog, retrieval, execution and output. Its configuration lives in a config.yml file, optional Python actions and Colang files, and Colang 1.0 is the default while 2.0 is also supported. It fits teams that need jailbreak and injection detection plus dialog policy in one place. Check that the Colang version you choose matches the migration path you plan, since NVIDIA says converted configurations still need manual review.

NeMo Guardrails microservice on Kubernetes

For production, NVIDIA offers a NeMo Guardrails microservice: a container image built on the same configuration model and deployed on Kubernetes with Helm. The open-source library can also run as a guardrails server that loads configurations from a folder and exposes an HTTP API. Choose the microservice when platform engineering must own rollout, scaling and image provenance. Confirm with NVIDIA which microservice licensing and support terms apply to your environment, because the library and the microservice are not the same product.

Guardrails AI validators in Python

Guardrails AI builds input and output guards from validators published on Guardrails Hub, such as regex matching or toxicity detection. Validators are installed separately after pip install guardrails-ai and can be chained. It suits engineering teams that want each risk checked by a named, testable rule and that want structured output matched to Pydantic models. Expect to write and maintain your own validators for prompt-injection patterns that the hub does not cover.

Guardrails AI as a REST service

Guardrails AI can run as a standalone Flask REST service started with guardrails start, and applications call it through the OpenAI SDK. This keeps validation outside application code and lets one team serve many applications. Before you route production traffic through it, decide who owns the service, how it is authenticated and where its logs go. The quickstart asks whether to enable anonymous metrics reporting during guardrails configure, so set that answer deliberately for regulated environments.

Testing rails and validators

Both approaches need evidence that they block the attacks you care about without blocking legitimate traffic. For NeMo Guardrails, test each input and output rail against recorded prompts and dialog paths. For Guardrails AI, test each validator and each chain order on known-bad and known-good samples. Use promptfoo red teaming to probe both, referencing the OWASP LLM Top 10 and the NIST AI Risk Management Framework to structure the test set. Budget engineering time for this work, since it recurs with every model or policy change.

Ongoing tuning and ownership

Lakera maintains its detection models for you under a commercial contract. With either open-source option, your team or a partner owns detection quality over time: updating detection models, reviewing false positives, retiring rules and tracking releases. NeMo Guardrails v0.24.1 was released on 16 September 2026 and Guardrails AI v0.11.0 on 14 August 2026, so version pinning and upgrade testing belong in the run plan. Ask who on your side will review verdicts each month and who approves a rule change.

Why archived LLM Guard is not a target for new rollouts

Do not build a new deployment on LLM Guard. An archived repository normally stops receiving fixes, updated detection logic and compatibility work, so its protection and its dependencies fall behind over time. Treat it as a legacy component and plan a move to an actively maintained option. Before you decide, confirm the status yourself. Open the project repository and check for the archive banner, the date of the most recent release and commit, any open security advisories, and whether the maintainers name a successor project. Record what you found and when you checked, because repository status can change after your review.

For teams that already run LLM Guard, the decision is about migration timing and scope. Start with an inventory: find every place where the application imports LLM Guard scanners, list which scanners screen prompts and which screen model outputs, and document what the application does when a scanner flags content, such as blocking, logging or rewriting. Pin the currently deployed version so behavior does not change silently while you plan. Then map each scanner to a successor. NeMo Guardrails offers input rails with jailbreak and injection detection, and Guardrails AI offers validators from Guardrails Hub that can be chained. Mark every scanner with no equivalent, because those need a custom validator or a documented risk acceptance signed by the owner of the risk.

Measure before you switch enforcement. Run the same recorded prompt and response set through the existing scanners and the candidate controls, compare the verdicts, and review each disagreement by hand. Use red-team probes, for example those in promptfoo's red teaming documentation, to test injection and jailbreak cases that resemble your own traffic, and keep the old control in log-only mode during the comparison. The main recurring cost is your engineers' time to maintain rails, validators and tests, plus compute for any detection models. The one-time cost is inventory, mapping, comparison and tuning. When you request a quote from an implementation partner, ask for these phases to be written into the scope with their deliverables.

Running guardrails alongside Lakera during the transition

Most teams do not switch every prompt at once. A common pattern is to keep Lakera on the traffic that already has approved controls, such as customer-facing chat, while NeMo Guardrails or Guardrails AI takes a smaller slice first, such as internal tools or a single product line. The split should follow risk, data sensitivity and how much false-positive review capacity your team has, not the convenience of the routing rule.

  • Pick a low-stakes cohort first: internal assistants or test tenants with synthetic data are usually the safest place to observe verdicts.
  • Keep high-exposure flows on Lakera longer: public inputs and tool-calling agents with write access stay on the existing control until the new rails are tuned.
  • Route by application identifier: tag each request with the calling application so the split can be changed in configuration without a code release.
  • Define exit criteria per cohort: agree in writing which false-positive and miss rates allow a cohort to move.
  • Record the routing decision: log which guardrail handled each request so audits can reconstruct the enforcement path.

Confirm with your security team which flows carry regulated data before choosing the first cohort.

Moving prompt defense from Lakera to self-hosted rails

This sequence moves prompt attack detection from a hosted guardrail API to self-hosted rails in your own infrastructure, with measured evidence that the replacement blocks what Lakera blocked before any enforcement changes. Each step produces an artifact that a security review can check.

  1. Inventory current Lakera policies and categories

    Security engineering and the application owners export the current Lakera Guard configuration, including which detection categories are enabled, the thresholds or actions set for each, and every application or endpoint that calls the API. Record which categories cover prompt attacks, harmful content and data leakage, because each one needs a named owner on the new side. The step is done when every category has a row in a shared table with its current action (block, flag or log) and its calling application. Confirm the exact export format and policy fields with Check Point or your account contact, since the console and API output may vary by plan.

  2. Record representative prompts and responses

    The team collects a sample of real prompts and model responses from logs your own systems already keep, with personal data removed under your privacy controls before anything leaves the production environment. The sample should include traffic Lakera allowed, traffic it flagged or blocked, and borderline cases from each application. Store the set in a version-controlled, access-restricted location so the same traffic can be replayed later. The step is done when the set is labeled with the expected verdict for each item, reviewed by someone who did not write the labels, and documented with its collection dates and sources.

  3. Build a red-team baseline with promptfoo

    Security testers run promptfoo's red teaming against the current application so the team has a baseline before changing any guardrail. The test suite should map to the OWASP LLM Top 10 and the other frameworks promptfoo's red teaming documentation references, and should include the recorded attack prompts from the previous step. Run promptfoo locally or in a CI pipeline, and record the attack success rate per category. The step is done when the baseline report is saved with the promptfoo version, model and configuration used, so later runs can be compared like for like. Note that the Community edition's probe allowance and the self-hosted app's limits (a local SQLite store with no RBAC or SSO) affect where results are kept.

  4. Map policies to NeMo rails or Guardrails AI validators

    Engineers translate each Lakera category into a control on the new side. Jailbreak and injection checks map to NeMo Guardrails input rails, moderation checks to input and output rails, and output filtering to validators or output rails. Where a category has no direct match, the team records that gap and decides whether to build a custom action or accept the risk in writing. If Colang 1.0 configurations already exist, NVIDIA's migration guide says the nemoguardrails convert tool output still needs manual review, so plan time for that check. The step is done when a mapping document lists every Lakera category, its replacement rail or validator, and each unresolved gap with an owner.

  5. Run both systems side by side on recorded traffic

    Engineers replay the labeled traffic set through Lakera and the self-hosted rails in parallel, without letting the self-hosted verdict affect users. The replay records each verdict, the matched category and the latency for both paths. Compare results against the expected labels and against each other, and note every disagreement for review. The step is done when a comparison report shows detection rates, false positives and false negatives per category for both systems, and each disagreement has a recorded decision. Re-run the red-team baseline against the new rails at the same time so the attack results are comparable.

  6. Tune false positives and retest

    Engineers adjust thresholds, Colang flows or validator settings to reduce false positives found in the comparison, then rerun the replay and the promptfoo suite to confirm that tuning did not weaken detection. Each change is recorded with the reason, the affected category and the test results before and after. Security and application owners sign off on any category where the new rails are less strict than Lakera, because that change accepts a risk. The step is done when the agreed false positive and detection targets are met on the frozen test set, and the signed change log is complete.

  7. Switch enforcement and keep the baseline running

    The team moves enforcement to the self-hosted rails in stages, keeping the Lakera path available for rollback until the new path has run cleanly in production. Monitoring tracks blocked requests, errors and latency against the baseline, and promptfoo red-team runs repeat on a schedule and after every model or rail change. Ongoing ownership is assigned for detection quality, because the rails are maintained by your team or your implementation partner rather than a vendor policy console. The step is done when Lakera is removed from the enforcement path, the rollback plan is documented, and scheduled red-team runs are recorded as evidence for security reviews.

How to measure detection with promptfoo before switching

Before you turn off Lakera Guard, run the same attack set through both systems and compare verdicts. promptfoo is a practical tool for this because its red teaming documentation references the OWASP LLM Top 10, the NIST AI Risk Management Framework and the EU AI Act as frameworks that support systematic testing before deployment. That gives your security and compliance reviewers a common vocabulary for what was tested. The promptfoo documentation states that the software runs completely locally, so evals run on your machine and talk directly with the model. Your attack prompts and model responses do not need to pass through a third-party evaluation service, which matters when the test set itself contains sensitive material.

Set up the comparison as a single promptfoo configuration with two targets: one that calls your current Lakera Guard integration and one that calls your candidate NeMo Guardrails or Guardrails AI endpoint. Feed both the same red-team prompts and the same benign production samples, which protects against a rail that blocks everything. Record, for each prompt, whether each system blocked it, the category it was assigned and the latency. Then review the disagreements by hand, because a verdict mismatch shows where to tune, not which system is right. The Community edition is free, includes all evaluation features and includes red teaming with 10k probes per month, with community support. Confirm the current probe allowance and provider coverage on the promptfoo pricing page before you plan a larger run.

Plan the test environment carefully. The self-hosted promptfoo app is an Express server with a web UI and API, and it can run under Docker, Docker Compose or Kubernetes with Helm. However, it stores data in a local SQLite database that cannot be shared across replicas, has no RBAC, horizontal scaling, built-in authentication or SSO, and is not recommended for production use. Treat it as a workbench for the evaluation team, not as a shared control point for guardrail decisions. Keep the result files in your own storage under change control, and record the promptfoo version, the rail configuration hash and the attack set version with each run so the evidence can be reproduced during a security review.

Questions buyers ask before replacing Lakera Guard

Does NeMo Guardrails match Lakera Guard's detection coverage?

Not as a drop-in match, so verify it on your own traffic before you switch. NeMo Guardrails includes jailbreak and injection detection, self-check input and output moderation, NVIDIA content safety and topic safety models, and fact-checking, but Lakera's detection models and their update cadence are a different product. Build a labeled set of prompts drawn from your application, run both systems against it, and compare the miss and false positive rates for each risk class you must cover. Confirm with Lakera and NVIDIA which categories and model versions each product actually ships before you assume parity.

What does replacing Lakera Guard cost, and which components drive it?

The license is not the main line item. Cost comes from four components: engineering time to build and integrate the rails, capacity to run the detection models (CPU or GPU, depending on which models you enable), red-team testing of the rails, and ongoing tuning of thresholds and false positives by your own engineers. Lakera's SaaS fees or the Enterprise license its self-hosting requires are the recurring cost you are comparing against. Ask any vendor or consultant to split the quote into one-time implementation and recurring operation, and to state which hardware and model assumptions it uses.

How long does a migration from Lakera Guard take?

Duration depends on how many application paths call Lakera, how many policies you map to input and output rails, and how much recorded traffic you have to replay. The Colang configuration model also has a migration step if you start from Colang 1.0 configurations, because NVIDIA's migration guide says converted configurations still need manual review. Running both systems side by side on recorded traffic adds a comparison period before you move enforcement. No fixed duration is supplied here, so ask for a timeline tied to a written scope, with milestones for mapping, testing, tuning and cutover.

What does the migration need from our engineers?

Your team needs people who can write and review Python actions, maintain a config.yml file and Colang files, and operate a container-based service. Platform engineers will run the guardrails server or the NeMo Guardrails microservice on Kubernetes with Helm, and security engineers should own the attack corpus and acceptance criteria. Python 3.10 through 3.13 are supported by NeMo Guardrails, so check your runtime versions early. Expect application developers to change how they call the guardrail, from a hosted API to a local or internal HTTP endpoint.

Can our own team do this in-house?

Often yes, if you already run Python services on Kubernetes and have people who can design attack test cases. The hard parts are not the installation. They are building a representative labeled dataset, deciding which false positives are acceptable for your users, and keeping detection tuned as attack techniques change. Teams that lack a security testing function usually underestimate the red-team work. A practical check is to ask whether your staff can explain every rail's verdict on a sample of blocked and allowed prompts before cutover.

What should we ask a consultant for in a fixed-scope quote?

Ask for a written scope that lists the applications and Lakera policies in scope, the rails to be built, the models and hardware assumed, the red-team test plan and its pass criteria, and the cutover and rollback steps. Request separate line items for implementation, testing, documentation and any post-cutover support or retainer. Ask how the consultant will hand over tuning knowledge to your team and what evidence they will provide for your security review. DeployOpen works from a written scope and provides a quote from it, and it does not issue audit reports or certifications.

How do we test prompt defense before and after the switch?

Use promptfoo's red teaming to generate attack probes and an evaluation suite that you run against both the existing Lakera path and the candidate rails. promptfoo runs locally, so prompts and responses do not have to leave your machine when you use the CLI. Its documentation references the OWASP LLM Top 10, the NIST AI Risk Management Framework and the EU AI Act as frameworks for systematic testing before deployment. Keep the results as evidence, and rerun the suite whenever you change a rail, a model or a threshold.

What a self-hosted prompt defense costs to run

The license line is the smallest part of the comparison for most teams. Lakera Guard is a commercial service, so its cost is a subscription or, for self-hosting, an Enterprise license that you negotiate with the vendor. NeMo Guardrails and Guardrails AI are Apache-2.0 licensed, so the software itself carries no license fee. What you pay for instead is the work around it: engineering time to write and maintain rails or validators, compute for any detection models you run locally, and the infrastructure that serves them. Ask Lakera for the exact terms of any Enterprise license, including what it covers for self-hosted containers and whether it recurs per year, per request volume or per deployment. Ask yourself the same question about open-source components: which of them need a paid model API or GPU capacity, since those are the costs that will grow with traffic.

Implementation and red-team testing are one-time costs, and they are where most of the effort sits. Mapping existing Lakera policies to input and output rails, writing Colang or validator chains, and agreeing on what a block means for each application all happen before go-live. Red-team work with promptfoo's local evaluation tooling is also front-loaded, but the community edition's monthly probe allowance and the decision to buy Enterprise features such as team sharing or SSO should be checked against your needs. Self-hosted promptfoo needs its own deployment decision, since its documentation says the local SQLite store is not recommended for production. A DeployOpen quote would list these as separate line items in the written scope, so you can see which parts you keep in-house.

Recurring costs are model and compute usage, infrastructure operations, upgrades and ongoing tuning. Tuning is the cost teams underestimate: attack techniques change, and false positives on legitimate user traffic need review every time a rail or threshold changes. Compute cost rises with request volume, the size of the detection model and whether it runs on GPUs or CPUs, so benchmark those on your own traffic before budgeting. Ask any implementation partner to price these as recurring work with named roles, such as the engineer who owns rail changes and the person who reviews red-team results. Confirm the current NeMo Guardrails release cadence and the Guardrails AI validator update process in their repositories, since upgrades are a planned cost, not an incident.

How DeployOpen scopes and delivers a prompt defense replacement

DeployOpen plans and implements self-hosted open-source platforms inside your own cloud accounts, data centers or air-gapped networks. For a prompt defense replacement, we start with a written, fixed scope that covers which Lakera Guard checks move, where the replacement runs and how detection quality will be measured before any traffic is switched.

How we scope

  • Inventory which Lakera Guard checks your applications call today, including prompt attack, harmful content and data leakage policies.
  • Agree in writing which candidates are in scope, such as NeMo Guardrails rails or Guardrails AI validators, and which are excluded.
  • Confirm hosting targets, Python and Kubernetes constraints, and whether any GPU or CPU capacity for detection models is available.

How we build

  • Deploy the chosen guardrail framework in your environment, with configuration kept in version control alongside your application code.
  • Map each existing policy to input, output or execution rails, or to validator chains, and record every mapping decision.
  • Run red-team test suites such as promptfoo against both the current and replacement controls to measure detection and false positives.

How we hand over

  • Deliver the configuration, deployment manifests, test suites and results in documents your engineers can maintain without us.
  • Document the switchover plan, rollback steps and the evidence collected, so security reviewers can trace each control decision.
  • Prepare controls and evidence for your compliance assessments; independent auditors and certification bodies perform the assessment itself.

How we support

  • Ongoing support, upgrades and continuous testing are available as a retainer after the fixed-scope engagement closes.
  • Retainers can cover framework version upgrades, re-running red-team suites when models or prompts change, and tuning of rails.
  • Ask for the support terms, response expectations and upgrade cadence in the written quote before work starts.

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.