The best open source AI security tools in 2026 are Garak and PyRIT for red teaming, Promptfoo for evals and red teaming in CI, NVIDIA NeMo Guardrails and Guardrails AI for runtime guardrails, LLM Guard for input and output scanning, Meta LlamaFirewall for agent defense, and Vigil for prompt injection detection. All eight are free and open source, and most can be self-hosted.
Key takeaways
- Garak, PyRIT and Promptfoo cover pre-deployment testing: probe the model for jailbreaks, injection and leakage before it ships.
- NeMo Guardrails, Guardrails AI, LLM Guard and LlamaFirewall cover runtime defense: screening prompts and outputs in production.
- Start with Promptfoo in CI and one guardrail in production — testing without runtime defense, or defense without testing, leaves a gap.
Large language models brought a new attack surface with them: prompt injection, jailbreaks, data leakage, toxic output and agents that can be tricked into misusing their tools. The good news is that you do not need an enterprise budget to defend against them. The open source tools below are maintained, documented and free — and several of them are the same tools large teams use.
How did we choose these tools?
Every tool on this list had to be open source, maintained, and documented on its own repository or official docs. We checked licenses, versions and capabilities against primary pages as reported in September 2026 round-ups, and we grouped tools by the job they do, not by marketing claims.
We did not run hands-on tests, and we do not claim these tools were tested by us. What we did check is that each one is genuinely open source, has had a recent release, and does what its own documentation says it does. Prices, versions and licenses drift, so confirm the current license and release before you adopt a tool.
- Pre-deployment testing: probe the model before it ships, so failures are found in testing, not in production.
- Runtime guardrails: screen prompts and responses in production, in real time.
- Agent defense: watch what an agent does with its tools, not just what it says.
- Self-hosting: run it yourself, so your prompts and data stay inside your infrastructure.
Which open source AI security tool is best? Compared
Garak is the best scanner for probing a model before release, Promptfoo is the best for folding security into CI, and NeMo Guardrails is the best programmable guardrail. Use the table to match a tool to your job, not to a ranking.
| Tool | Best for | License | Price | Where it runs |
|---|---|---|---|---|
| Garak | LLM vulnerability scanning | Apache 2.0 | Free | Python CLI and library |
| PyRIT | Scripted red-team campaigns | MIT | Free | Python library and CLI |
| Promptfoo | Evals and red teaming in CI | MIT | Free core; enterprise custom | CLI and library in CI |
| NeMo Guardrails | Programmable guardrails | Apache 2.0 | Free | Python library or server |
| Guardrails AI | Input and output validation | Apache 2.0 | Free core | Python library or server |
| LLM Guard | Input and output scanning | MIT | Free | Python library |
| LlamaFirewall | Agent and prompt defense | Open source (Meta) | Free | Python library |
| Vigil | Prompt injection detection | MIT | Free | Server |
Licenses and versions were checked in September 2026: Garak v0.17.0, PyRIT v1.1.0, Promptfoo 0.123.1, NeMo Guardrails v0.24.1 and Guardrails AI v0.11.0. Check the project's current release before you adopt it.
What is AI security, and what are these tools defending?
AI security means protecting a language model application from attacks that target the model itself, not just the server it runs on. The OWASP Top 10 for LLM Applications lists prompt injection, sensitive information disclosure, supply chain flaws and excessive agency among the main risks.
Prompt injection is the best-known attack: an attacker hides instructions in data the model reads — a web page, a document, an email — and the model follows them as if they came from the user. Jailbreaks are a related trick, persuading the model to ignore its own safety rules. Data leakage happens when a model reveals training data, system prompts or other users' information. Agent attacks go further, tricking an agent into misusing the tools it can call, such as sending email or running code.
No single tool covers all of these. That is why this list is grouped by job: testing tools find the failures, guardrails block them in production, and agent tools watch what the agent actually does.
1. Garak — best for LLM vulnerability scanning
Garak, the Generative AI Red-teaming & Assessment Kit, is an Apache 2.0-licensed vulnerability scanner for LLMs. It probes a model the way an attacker would, then measures whether it fails in ways you do not want.
- What it does: probes a live model across many failure modes, including prompt injection, jailbreaks, toxic generation and data leakage.
- License and price: Apache 2.0, free. Version 0.17.0 was released on 9 September 2026, according to the September 2026 round-up.
- Pros: exhaustive probing, works against many model endpoints, runs as a Python CLI and library.
- Cons: it finds failures; it does not fix them, and it needs a guardrail or a model change to act on what it finds.
Who should pick it: teams shipping a model or LLM endpoint who want to probe it for failures before release. See the Trent LLM security tools comparison for its release and license details.
2. PyRIT — best for scripted red-team campaigns
PyRIT, the Python Risk Identification Tool for generative AI, is Microsoft's MIT-licensed framework for red-teaming generative AI systems at scale. It lets you write repeatable red-team campaigns rather than running one-off probes.
- What it does: automates multi-turn adversarial attacks, including Crescendo and TAP-style attacks, against LLM systems.
- License and price: MIT, free. Version 1.1.0 was released on 4 September 2026, according to the September 2026 round-up.
- Pros: repeatable campaigns you can write yourself, optional GUI and server, works across many endpoints.
- Cons: it is a framework, not a turnkey scanner, so it needs more setup than Garak or Promptfoo.
Who should pick it: security teams who want to run structured, repeatable red-team campaigns and track results over time.
3. Promptfoo — best for evals and red teaming in CI
Promptfoo is an MIT-licensed CLI and library that started as a prompt evaluation tool and grew into one of the most widely used open source options for LLM security testing, with adoption reportedly spanning applications serving tens of millions of end users.
- What it does: runs prompt and model evals, and folds adversarial red-team checks into the same harness you use for quality evals, so security runs on every pull request.
- License and price: MIT, free core; enterprise version is custom priced. Version 0.123.1 was released on 18 September 2026, according to the September 2026 round-up.
- Pros: fits naturally into CI, local viewer for results, OWASP presets for red teaming.
- Cons: the open source core is free, but the enterprise SaaS or on-prem version is not publicly priced.
Who should pick it: any team that already runs evals and wants security checks in the same pipeline. Note that Promptfoo now says it is part of OpenAI, so check its current ownership and licensing before adopting it.
4. NVIDIA NeMo Guardrails — best programmable guardrails
NeMo Guardrails is NVIDIA's Apache 2.0 toolkit for adding programmable guardrails to LLM applications, using a domain-specific language called Colang to define dialog flows and safety policies.
- What it does: lets you write conversation policy as code, controlling what a conversational app is allowed to say and do across multi-turn conversations and agent workflows.
- License and price: Apache 2.0, free. Version 0.24.1 was released on 16 September 2026, according to the September 2026 round-up.
- Pros: fine-grained, codified control; LangGraph integration; no licensing cost.
- Cons: Colang is a new language to learn, and it is heavier than a simple scanner library.
Who should pick it: teams building complex conversational apps or agent workflows who want policy written as code. See the Safeguard LLM security comparison for how it compares with other guardrails.
5. Guardrails AI — best for input and output validation
Guardrails AI is an open source validation framework for securing AI at runtime, using composable validators to inspect prompts and outputs for prompt injection, unsafe output, PII and other risks.
- What it does: wraps LLM inputs and outputs with named validators, available as modular packages, and can run as a Python library or a REST server any service can call.
- License and price: Apache 2.0, free core. Version 0.11.0 was released on 14 August 2026, according to the September 2026 round-up. Some validators on Guardrails Hub are commercial.
- Pros: composable validators, strong at structured outputs and schema compliance, server mode for non-Python services.
- Cons: the core is free, but some Hub validators are paid, so check which validators you need.
Who should pick it: developers who want structured, validated LLM outputs — for example, guaranteed JSON — with security checks built in.
6. LLM Guard — best free input and output scanning library
LLM Guard, by Protect AI, is an open source toolkit for sanitizing both prompts and responses, with a large set of scanners that block prompt injection, redact PII and filter toxic or unsafe output.
- What it does: scans both the input and the output side of an LLM call, so it catches injection going in and leakage or toxicity coming out.
- License and price: MIT, free and open source.
- Pros: large scanner set, simple to add to an existing pipeline, LLM-agnostic.
- Cons: it is a library, not a hosted service, so you run and tune it yourself.
Who should pick it: teams who want a free, self-hosted scanning layer in production without writing their own detectors.
7. Meta LlamaFirewall — best for agent defense
LlamaFirewall is Meta's open source guardrail project for catching agent goal hijacking, with a scanner that audits the agent's reasoning, not only its inputs.
- What it does: gives you compact, purpose-built detectors for injection and jailbreak attempts that you can run inline, plus agent-focused checks on what the agent is about to do.
- License and price: open source from Meta, free.
- Pros: designed for agents, not just chat; lightweight classifiers that run inline.
- Cons: newer and narrower than NeMo Guardrails, so check its current coverage for your use case.
Who should pick it: teams shipping AI agents with tool access, where the risk is not just what the model says, but what it does next.
8. Vigil — best for dedicated prompt injection detection
Vigil is a dedicated prompt injection detection server. Unlike general guardrail libraries, it specializes deeply in one threat: detecting attempts to manipulate your LLM.
- What it does: runs as a server that screens prompts for injection attempts, using scanners and models tuned for that single job.
- License and price: MIT, free and open source.
- Pros: focused and simple to reason about; easy to put in front of an existing LLM endpoint.
- Cons: it only covers prompt injection, so you still need other layers for PII, toxicity and agent misuse.
Who should pick it: teams who want a dedicated injection screen in front of an LLM, alongside a broader guardrail. See the Obot open source AI security round-up for how the main tools compare.
How do you choose the right AI security tool?
Start with the job, not the tool. If you have not tested your model, start with testing. If you have tested it but have nothing in production, start with a guardrail. If you have agents with tool access, add agent defense.
- Shipping a model or endpoint: Garak to probe it, Promptfoo to keep probing it in CI.
- Running a chatbot in production: NeMo Guardrails for policy, or LLM Guard for a simpler scanning layer.
- Need structured outputs: Guardrails AI, for validated JSON and schema compliance.
- Running agents with tools: LlamaFirewall, plus logging and least-privilege tool access.
- One focused risk: Vigil, for prompt injection alone.
Check ownership before you buy or adopt, too. Several tools on this list have changed hands: Lakera Guard is owned by Check Point, Prompt Security ships inside SentinelOne, and Promptfoo now says it is part of OpenAI. Ownership changes do not make a tool bad, but they can change its license, pricing and roadmap.
What should you avoid with open source AI security tools?
Avoid three mistakes: treating a tool as a guarantee, adopting a tool that is no longer maintained, and giving the model more power than it needs. Each one creates a false sense of safety.
- Do not treat any guardrail as a guarantee. No tool stops prompt injection completely. Limit what the model and its tools can do, and log everything.
- Check maintenance before adopting. A tool with no release or push in a year may not cover the latest attacks. Every tool here had a release or push in 2026, but check again before you adopt.
- Do not give agents excessive agency. An agent that can send email, run code or move money is a bigger risk than a chatbot that can only reply. Give each agent the least privilege it needs.
- Do not send sensitive data to a hosted scanner without checking. Self-hosting keeps prompts and data inside your infrastructure; a hosted service may not.
- Do not skip logging. If you cannot see what prompts, outputs and tool calls happened, you cannot investigate an incident.
For a wider view of securing the systems around your AI app — patching, MFA, backups and logging — see our small business cybersecurity checklist.
Prompt injection is a form of social engineering aimed at a model rather than a person, so the same verification habits apply: read our guide to spear phishing to see how attackers persuade people — and models — to do things they should not.
The bottom line
Start with Promptfoo in CI and one guardrail in production — LLM Guard for a simple scanning layer, or NeMo Guardrails if you want policy as code. Add Garak before a major release, and LlamaFirewall if you ship agents with tool access.
All eight tools on this list are free and open source, so the cost is your time, not a license. Check the current release and license on each project's own page, and check your own app's exposure with the free security headers checker.
Frequently asked questions
What is the best open source AI security tool?
It depends on the job. Garak is the best open source LLM vulnerability scanner for pre-deployment probing, Promptfoo is the best for evals and red teaming in CI, and NVIDIA NeMo Guardrails is the best programmable open source guardrail for production. Most teams need at least one testing tool and one runtime tool.
Are open source AI security tools free?
The tools on this list are free and open source under Apache 2.0 or MIT licenses. Some have paid enterprise versions or hosted offerings, but the open source core costs nothing to run yourself.
What is LLM red teaming?
Red teaming means probing a model or LLM application the way an attacker would — trying jailbreaks, prompt injection, data leakage and toxic generation — to find failures before release. Garak, PyRIT and Promptfoo automate that probing.
What are LLM guardrails?
Guardrails sit between users and the model in production, screening inputs and outputs in real time for prompt injection, PII leakage, toxic content and policy violations. NeMo Guardrails, Guardrails AI, LLM Guard and LlamaFirewall all do this in different ways.
Can open source tools stop prompt injection?
They can reduce the risk a lot, but no tool stops prompt injection completely. Use a guardrail to screen inputs and outputs, limit what the model and its tools can do, and test with red teaming. Defense in depth matters more than any single tool.
Do I need to self-host these tools?
Most of them are designed to be self-hosted, which keeps your prompts and data inside your own infrastructure. Some also offer hosted or enterprise versions if you prefer not to run them yourself.
Which tool should a small team start with?
Start with Promptfoo in CI, because it folds security checks into the evals you already run, and add LLM Guard or Guardrails AI as a runtime screen. Both are free, well documented and quick to try.
Sources
The engineers and analysts who build Cysoro's domain scanner, email-authentication checks and free security tools. We test what we write about every day — SPF, DKIM, DMARC, certificates, look-alike domains and phishing — and check each guide against the relevant standards, government guidance and vendor documentation.
Checked against project repositories, licenses and official docs as reported in September-November 2026 round-ups; versions and licenses were checked in September 2026 and may have changed.
How we write and fact-check →